In all cases where land rent accrues and remains unpaid, whether under a lease or otherwise, all buildings upon the premises while the rent accrues are subject to a lien and to attachment for the rent due, as provided in section 3451, although other persons than the lessee may own the whole or a part thereof, and whether or not the land was leased for the purpose of erecting such buildings. If any person except the lessee is interested in said buildings, the proceedings shall be substantially in the forms directed for enforcing liens against vessels, with such additional notice to supposed or unknown owners as any justice of the court having jurisdiction of the proceedings orders, or the attachment and levy of execution shall not be valid except against the lessee.