gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cross compile gpsd-3.20.1~dev for arm with buildroot


From: Gary E. Miller
Subject: Re: Cross compile gpsd-3.20.1~dev for arm with buildroot
Date: Tue, 9 Jun 2020 17:16:05 -0700

Yo Florian!
 
> On Mon, 8 Jun 2020 14:20:46 +0200
> Florian Kiera <florian.kiera@logicway.de> wrote:
> 
> > Please unpack buildroot-logs.tar.gz for the 3 files 
> > "compile-3.18_success.txt", "compile-3.19_success.txt" and 
> > "compile-3.20_fail.txt".  

I took another look at these, and found a fatal problem in your
procedure.  The compile-3.20_fail.txt shows a git pull, and an scons
build, but no clean.  So that file is missing essential data, the config
pass.  Forgetting to "scons -c" is the cause of many problems.

I see at the fail point, the two versions are building differently:

The 3.19 is linking libgps with g++:

/home/florian/Desktop/buildroot-2019.02.8.2/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-g++
 -o libgps.so.25.0.0 
--sysroot=/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot
 -pthread -shared -Wl,-Bsymbolic -Wl,-soname=libgps.so.25 ais_json.os bits.os 
gpsdclient.os gps_maskdump.os gpsutils.os hex.os json.os libgps_core.os 
libgps_dbus.os libgps_json.os libgps_shm.os libgps_sock.os netlib.os 
os_compat.os rtcm2_json.os rtcm3_json.os shared_json.os libgpsmm.os -L. 
-L/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib
 
-L/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib
 -lrt -ldbus-1 -ldbus-1 -lr

In that case g++ just calls the linker, passing on the -Wl parameters.

The 3.20 is linking libgps with ld:

/home/florian/Desktop/buildroot-2019.02.8.2/output/host/bin/arm-buildroot-linux-uclibcgnueabihf-ld
 -o libgps.so.27.0.0 
--sysroot=/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot
 -pthread -shared -Wl,-Bsymbolic -Wl,-soname=libgps.so.27 ais_json.os bits.os 
gpsdclient.os gps_maskdump.os gpsutils.os hex.os json.os libgps_core.os 
libgps_dbus.os libgps_json.os libgps_shm.os libgps_sock.os netlib.os 
os_compat.os rtcm2_json.os rtcm3_json.os shared_json.os timespec_str.os 
libgpsmm.os -L. 
-L/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib
 
-L/home/florian/Desktop/buildroot-2019.02.8.2/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib
 -lstdc++ -lrt -lnsl -lm -ldbus-1 -ldbus-1 -lrt -lnsl

But scons neglected to remove the -Wl, part of the linker options.  I have
no idea why.  gpsd SConstruct just tells scons what to link, and leaves
how to do it up to scons.  That is all a black box to gpsd.

When I build native amd64, my scons uses g++:

g++ -o libgps.so.27.0.0 -pthread -shared -Wl,-Bsymbolic 
-Wl,-soname=libgps.so.27 ais_json.os bits.os gpsdclient.os gps_maskdump.os 
gpsutils.os hex.os json.os libgps_core.os libgps_dbus.os libgps_json.os 
libgps_shm.os libgps_sock.os netlib.os os_compat.os rtcm2_json.os rtcm3_json.os 
shared_json.os timespec_str.os libgpsmm.os -L. -lrt -lnsl -lm -ldbus-1 -ldbus-1 
-lrt -lnsl
Create symlinks for: 'libgps.so.27.0.0': 'libgps.so.27'->'libgps.so.27.0.0', 
'libgps.so'->'libgps.so.27.0.0'

Similar for arm64:

g++ -o libgps.so.27.0.0 -pthread -shared -Wl,-Bsymbolic 
-Wl,-soname=libgps.so.27 ais_json.os bits.os gpsdclient.os gps_maskdump.os 
gpsutils.os hex.os json.os libgps_core.os libgps_dbus.os libgps_json.os 
libgps_shm.os libgps_sock.os netlib.os os_compat.os rtcm2_json.os rtcm3_json.os 
shared_json.os timespec_str.os libgpsmm.os -L. -lrt -lnsl -lm -ldbus-1 -ldbus-1 
-lrt -lnsl

The -Bsymbolic comes from scons:

/usr/lib64/python3.6/site-packages/SCons/Tool/gnulink.py:
    env['SHLIBVERSIONFLAGS'] = SCons.Util.CLVar('-Wl,-Bsymbolic')

In your 3.19, your arm-buildroot-linux-uclibcgnueabihf-ld is never used.
Maybe set LD to your CXX?  LD=$CXX

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgp_tN2eLX3fQ.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]