1

I'm trying to figure out how to cross-compile GPSD 3.16 as external package in a buildroot environment. I'm already able to tell scons which compiler it should use and it produces correct compiled files.

    scons target=arm-buildroot-linux-gnueabihf-gcc
    file gpsd
    gpsd: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.9.0, not stripped

So it is generally working but the build fails when scons try to link cgps against ncurses. Of course scons produces an error because it tries to link against the buildroot host ncurses library.

    arm-buildroot-linux-gnueabihf-gcc -o cgps -pthread -Wl,-rpath,/buildroot/host/usr/lib -Wl,-rpath,/buildroot/host/lib cgps.o -L. -L/buildroot/host/usr/lib -lgps_static -lm -lrt -lncurses /buildroot/host/usr/lib/libncurses.so: file not recognized: File format not recognized

First I tried to use the command line options includedir and libdir which point to the target files but still scons uses only the host ncurses library. But it seems that scons is using the correct includedir when compiling other gpsd components.

    arm-buildroot-linux-gnueabihf-gcc -o lcdgps.o -c -Wmissing-prototypes -Wextra -Wall -Wno-uninitialized -Wno-missing-field-initializers -Wcast-align -Wmissing-declarations -Wstrict-prototypes -Wpointer-arith -Wreturn-type -pthread -Wmissing-declarations -O2 -pthread "-I/target/usr/local/include -I/target/usr/local/include/ncurses"

I also tried to use the pkgconfig command line option, but I get the same result.

So far I can't get scons to use the target ncurses library instead of the host ones. Using GPSD as an internal buildroot package is not possible in this project, so I'm looking for a solution based on the external GPSD package without having to change the construct file.

steve4711
  • 11
  • 4

2 Answers2

0

By setting the environment variable LINKFLAGS with the same settings as the LDFLAGS, the build process now works without problems.

But I don't understand why it didn't work by setting the includedir and libdir.

steve4711
  • 11
  • 4
0

There is already a package for gpsd in Buildroot, see https://git.buildroot.org/buildroot/tree/package/gpsd/. Why are you trying to create another one ?

Thomas Petazzoni
  • 5,636
  • 17
  • 25
  • I know that there is already a package for `gpsd` in Buildroot, but I have two different targets and I can only use my own kernel for one target. To keep the toolchain the same for both targets, `gpsd` is used as an additional package. – steve4711 Jun 21 '18 at 11:59