Opportunistic signals (e.g., WiFi, magnetic fields, and ambient light) have been extensively studied for low-cost indoor localization, especially via fingerprinting. We present an automatic site survey approach to build the signal maps in space-constrained environments (e.g., modern office buildings). The survey can be completed by a single smartphone user during normal walking, say, with a little human intervention. Our approach follows the classical GraphSLAM framework: the front end constructs a pose graph by incorporating the relative motion constraints from the pedestrian dead-reckoning (PDR), the loop-closure constraints by magnetic sequence matching with the WiFi signal similarity validation, and the global heading constraints from the opportunistic magnetic heading measurements; and the back end generates a globally consistent trajectory via graph optimization to provide ground-truth locations for the collected signal fingerprints along the survey path. We then build the signal map (also known as fingerprint database) upon these location-labeled fingerprints by the Gaussian processes regression (GPR) for later online localization. Specifically, we exploit the pseudowall constraints from the GPR variance map of magnetic fields and the observations of ceiling lights to correct the PDR drifts with a particle filter. We evaluate our approach on several data sets collected from both the HKUST academic building and a shopping mall. We demonstrate the real-time localization on a smartphone in an office area, with 50th percentile accuracy of 2.30 m and 90th percentile accuracy of 3.41 m. Note to Practitioners —This paper was motivated by the problem of the efficient signal map construction for fingerprinting-based localization on smartphones. The conventional manual site survey method, known to be time-consuming and labor-intensive, hinders the penetration of fingerprinting methods in practice. This paper suggests a GraphSLAM-based approach to automate this signal map construction process by reducing the survey overhead significantly. A surveyor is merely asked to walk through an indoor venue with an Android smartphone held in hand with a little human intervention. Meanwhile, opportunistic signals (e.g., WiFi and magnetic fields) are captured by smartphone sensors. We construct a GraphSLAM engine to first identify the measurement constraints from these signal observations and then recover the surveyor’s walking trajectory by the graph optimization. We can generate signal maps using the captured signals alongside the recovered trajectory. In this paper, we propose a WiFi signal similarity validation method to reduce false positive loop-closures and exploit the magnetic headings to improve the trajectory optimization performance. In addition, we propose to use the generated magnetic field variance map and the lights distribution map for localization. The efficacy of the proposed site survey approach is proven through field experiments, and real-time localization is demonstrated on a smartphone using the generated signal maps. The localization experiment was conducted by a single user with the same Android smartphone that was used in the site survey. Therefore, the usability of signal maps on other devices and the generality to other users have not yet been testified. We will leave these issues in our future work.