Benefitting from the easy availability of image-level labels, weakly supervised semantic segmentation (WSSS) methods based on class activation maps (CAMs) have made significant progress in building extraction from remote sensing imagery. However, image-level labels lack precise spatial locations and boundary ranges of buildings, posing challenges in achieving comprehensive and structurally clear building extraction. Furthermore, due to the complex background interference and the diversity of building in high-resolution remote sensing imagery (HRRS), small and sparse buildings suffer from insufficient attention in CAMs. To solve the above problems, this paper proposes a spatial structure constraint and local semantic awareness-based WSSS method, CANet, for extracting buildings from HRRS. Specifically, we design a spatial structure constraint module to generate CAMs with finer spatial structural details of buildings, which minimizes feature differences from patches of different granularities and the whole image. Moreover, a local semantic awareness module is designed to address the issue of insufficient coverage of CAMs on sparse and tiny building. This module first strengthens the feature extraction network by embedding discriminative suppression units to force the network to focus on more non-discriminative regions. Subsequently, visual words learning is introduced to identify additional object categories. Finally, four WSSS datasets are constructed based on publicly datasets with two simple and two complex scenarios. The results demonstrate that the proposed method outperforms eleven state-of-the-art methods, improving the intersection over union by at least 3.46% and 0.29% in both simple and complex scenarios, respectively.