Ifscons' fails, it is possible that your target system has moved toPython 3 and removed the program 'python'. Python.org says that ifyou have an installed Python, there should be a program in your pathcalled 'python'. This is specified in PEP 394. This rule is not alwaysfollowed. You can work around this by linking python3 to python likethis
Occasionally, builds may fail in completely bizarre ways due to acorrupted scons database. This seems to relate to ^Cing the build atan inopportune moment. If you suspect that, see "Reverting to a cleanstate" below and then try again.
C99 conformance is required in the compiler. The C code depends on oneC11 feature (supported by GCC, clang, and pretty much any C compilerthat also speaks C++): anonymous unions. We could eliminate these,but the cost would be source-level interface breakage if we have tomove certain structure members in and out of unions.
Some portions of the code using shared-memory segments are improved bythe C11 stdatomic.h features for lockless concurrency. These are: theSHM export mode in shmexport.c, the code for writing clock correctionsto NTP in ntpshmwrite.c, and the code for reading NTP corrections inntpshmread.c. These features have been supported in GCC since 4.7 andclang since 3.1.
GPSD is normally built and tested with GCC. Do not compile with a versionolder than 4.1.1; there are several known issues with older versions,including (a) non-standards-conformant floating-point generation thatmesses up regression testing, (b) a compiler bug affecting RTCM2 codegeneration, (c) the option -Wno-missing-field-initializers isunavailable, leading to a flood of warnings (this is due to generatedcode and cannot be fixed).
While Python is required to build GPSD from source (the build usessome code generators in Python), it is not required to run the servicedaemon. In particular, you can cross-compile onto an embedded systemwithout having to take Python with you.
scons finds the python used for scons separately from the python thatshould be used for the target. It seems to look for the target pythonas "python", which as above is supposed to exist per python norms.However, some packaging systems avoid a bare python, preferring tobind a program to a particular release as it is built. On systemswithout a "python" command, invoking scons as: scons target_python=python3.7seems to help.
You will need both basic Python and (if your package system makes thedistinction) the Python development package used for building Cextensions. Usually these are called "python" and "python-dev". Youwill know you are missing the latter if your compilation failsbecause of a missing Python.h.
If you have libusb-1.0.0 or later, the GPSD build will autodetectthis and use it to discover Garmin USB GPSes, rather than grovelingthrough /proc/bus/usb/devices (which has been deprecated by theLinux kernel team).
If your kernel provides the RFC 2783 KPPS (kernel PPS) API, gpsd willuse that for extra accuracy. Many Linux distributions have a packagecalled "pps-tools" that will install KPPS support and the timepps.hheader file. We recommend you do that. If your kernel is built inthe normal modular way, this package installation will suffice.
Under Ubuntu and most other Debian-derived distributions, an easy wayto pick up the prerequisites is: "apt-get build-dep gpsd". Notethat your sources.list will need "deb-src" lines for this, notjust "deb" lines.
To clean the built files, run 'scons -c' or 'scons --clean'.Run 'rm -f .sconsign.*dblite' to clear the sconsdatabase. Doing both should return your working directory to anear pristine state as far as building is concerned. Some user createdfiles may remain, and source code changes will not have been reverted..
If your linker run fails with missing math symbols, see the FIXMEcomment relating to implicit_links in the scons recipe; you probablyneed to build with implicit_link=no. If this happens, please reportyour platform, ideally along with a way of identifying it from Python,to the GPSD maintainers.
After building, please run 'scons check' to test the correctnessof the build. It is not necessary to install first. Python isrequired for regression tests. If any of the tests fail, you probablyhave a toolchain issue. The most common such problem is failures ofstrict C99 conformance in floating-point libraries.
Once you have verified that the code is working, "scons install"will install it in the system directories. "scons uninstall" willundo this. Note: because scons is a single-phase build system, thismay recompile everything. If you want feature-configuration options,you need to specify them here.
You will need php and php-gd installed to support the PHP web pagegenerator included with the distribution. To install it, copy the file'gpsd.php' to your HTML document directory. Then see thepost-installation instructions in INSTALL.adoc for how to configure it.
Some of these variables are typically used to adapt to differinglayout conventions. For example, pkgsrc would usedocdir=share/doc/gpsd as per-package documentation is placed inprefix/share/doc/PKGNAME, and mandir=man as man pages are inprefix/man rather than prefix/share/man.
Software that is needed to build gpsd may in general be in variouslocations. (While many GNU/Linux users doing a straightforward buildwill have all prerequisites in /usr, most other operating systems haveadditional software in other than /usr, and even on Linux one may wishto build a separate copy of gpsd with alternate versions ofprerequisites.)
In addition, scons will use pkgconfig to find some prerequisites.These will be found if the pc files are in the default pkgconfigsearch path, and the resulting -I and -L flags added to the compileand link lines.
The gpsd scons build scripts also support passing in CPPFLAGS andLDFLAGS via environment variables, similar to how these are used withautoconf and almost all other build systems. As an example,CPPFLAGS=-I/usr/foo/include will cause -I/usr/foo/include to be addedto compilation lines.
gpsd will build, install and run on the Raspberry Pi (RasPi) and Pi 2using Debian Jessie. Other distributions based on Debian (raspbian, etc)will work fine as well. The gpsd package in Debian Wheezy is known to beflaky, be sure to update to a new version of gpsd from source.
Git-core is required to build from a git repository.pps-tools is for PPS timing.Build-essential installs the compiler and associated tools.Manpages-dev is for the associated man pages.Pkg-config is a helper for scons.
If you wish to build the documentation, be warned it pulls in alot of packages. Build the documentation is a prerequisite tobuilding the HTML files for the website (www/), and also to makea source tarball (scons dist). To install the tools to build thedocumentation:
Most of the drivers supply the current leap second, after the GNSSreceiver sends it in a message to gpsd. But none of the standard NMEA0183 messages supply the current leap second. Thus the need for a fallback leap second value.
The leap second value is mainly used to check for invalid UTC time fromthe GNSS receiver. If the receiver is affected by the GPS Week NumberRoll Over (WKNO) bug, then the UTC time it reports will be off by 1024weeks.
All GNSS receivers may be using the wrong leap second internally onstartup. This may happen if it has been less than about 12 minutes sincepower-up; the receiver has not yet received the current leapsecondoffset as part of the periodic almanac download. Page 18, subframe 4,of the almanac contains the leap second data.
qt=yes: libQgpsmm is a Qt version of the libgps/libgpsmmpair. Thanks to the multi-platform approach of Qt, it allows the gpsdclient library to be available on all the Qt supported platforms.Please see -platforms.html for astatus of Qt supported platforms as of version 4.6.
minimal=no: people building for extremely constrained environmentsmay want to set this. It changes the default for all boolean (feature)options to false; thus, you get only the options you specify on thecommand line. Thus, for example, if you want to turn off all featuresexcept socket export. Note the nmea0183 driver is always built.
Both the builds and the tests are highly parallelizable via the scons-j option, which can gain a substantial speedup on a multicore machine.Because the output from the various jobs is interleaved, it may be moredifficult to understand error results with multiple jobs. In that event,simply rerun without the -j option for more straightforward output.
The scons equivalent of 'make clean' is 'scons -c' or 'scons--clean'. This will revert your source tree to a clean state nearly asthough you had just cloned or downloaded it; some scons housekeepingstuff is left in place.
I use the official google toolchain from the Android NDK (NativeDevelopment Kit). You can also use the toolchain from code sourcery Iguess. I cross-compile from a "regular" (with GNU userland) linux box.
The sysroot option tells the compiler and linker to use libraries andheaders from the given path as if they were placed at / prefix. Duringthis build the option allows linking with target ncurses (with the optionof having more packages at the --sysroot path) and including correctheaders without specifying -I and -L options.
3a8082e126