[oe] [meta-oe][PATCH 1/2] gpsd: don't compile with gold

Khem Raj raj.khem at gmail.com
Sun May 28 19:11:26 UTC 2017


On Sun, May 28, 2017 at 11:11 AM, Max Krummenacher <max.oss.09 at gmail.com> wrote:
> Am Sonntag, den 28.05.2017, 09:04 -0700 schrieb Khem Raj:
>> On Sun, May 28, 2017 at 4:10 AM, Max Krummenacher <max.oss.09 at gmail.com> wrote:
>> > When linking with gold libgps and libgpsd error out with:
>> >  | ./libgpsd.so: error: undefined reference to 'atan2'
>> >  | ./libgpsd.so: error: undefined reference to 'pow'
>> >  | ./libgpsd.so: error: undefined reference to 'sqrt'
>> >  | ./libgpsd.so: error: undefined reference to 'sin'
>> >  | ./libgpsd.so: error: undefined reference to 'cos'
>> >  | collect2: error: ld returned 1 exit status
>> >
>> > Using the bfd linker fixes the issue.
>>
>> It seems packages dont have proper linker rules.
>> perhaps a better fix is to add -lm to linker cmdline.
> -lm is part of the linker cmdline.
>
>  | arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -
> -sysroot=/home/res/develop/oe-core/build/tmp-glibc/sysroots/apalis-imx6 -o gpsd -Wl,-O1 -Wl,--hash
> -style=gnu -Wl,--as-needed --sysroot=/home/res/develop/oe-core/build/tmp-glibc/sysroots/apalis-imx6
> -pthread -Wl,-rpath=/home/res/develop/oe-core/build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux
> -gnueabi/gpsd/3.14-r0/gpsd-3.14 gpsd.o timehint.o shmexport.o dbusexport.o sd_socket.o -L.
> -L/home/res/develop/oe-core/build/tmp-glibc/sysroots/apalis-imx6/usr/lib -lrt -lbluetooth -ldbus-1
> -lgpsd -lusb-1.0 -lbluetooth -lgps -lm -ldbus-1
>
> One can get this link by linking the two shared objects '-lgps -lm' swapped '-lm -lgps', however I
> do not understand why that order matters.
> It does not help to add -lm when linking libgps.so.
>
> gpsd 3.16 seems do not be affected, the scons file however has been given quite same change.
>
> So, IMHO I'd rather use the linker which we now produces working binaries than to add yet one more
> patch to the scons file. That gives a commit we can use to backport for pyro and morty.
> Going forward we can use the update to 3.16 which allows to drop the majority of the patches we have
> now and builds also with gold.

its fine to use a workaround if there is no better solution. Lets try
to understand the root cause too while here before resorting to
shunning gold here. Since if we do it once issue will go latent.

gold warns about undefined symbols in shared libraries for which gold
has seen all the DT_NEEDED entries.  So if  shared libraries rely on
picking up symbols from other shared libraries that they do not
explicitly depend on, you will get an undefined symbol error. Which
could be the case with libgps.so here and if so that should be fixed
by correcting the linker cmd of libgps.so. alternatively that can be
avoided by using the --allow-shlib-undefined option.

>
> Max
>
>> >
>> > Signed-off-by: Max Krummenacher <max.krummenacher at toradex.com>
>> > ---
>> >  meta-oe/recipes-navigation/gpsd/gpsd_3.14.bb | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/meta-oe/recipes-navigation/gpsd/gpsd_3.14.bb b/meta-oe/recipes
>> > -navigation/gpsd/gpsd_3.14.bb
>> > index 4d00fea6d..fb02f9598 100644
>> > --- a/meta-oe/recipes-navigation/gpsd/gpsd_3.14.bb
>> > +++ b/meta-oe/recipes-navigation/gpsd/gpsd_3.14.bb
>> > @@ -36,6 +36,8 @@ SYSTEMD_OESCONS = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true',
>> > 'f
>> >  export STAGING_INCDIR
>> >  export STAGING_LIBDIR
>> >
>> > +LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '',
>> > d)}"
>> > +
>> >  PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'bluetooth', 'bluez', '', d)}"
>> >  PACKAGECONFIG[bluez] = "bluez='true',bluez='false',${BLUEZ}"
>> >  PACKAGECONFIG[qt] = "qt='yes',qt='no',qt4-x11-free"
>> > --
>> > 2.12.0
>> >
>> > --
>> > _______________________________________________
>> > Openembedded-devel mailing list
>> > Openembedded-devel at lists.openembedded.org
>> > http://lists.openembedded.org/mailman/listinfo/openembedded-devel



More information about the Openembedded-devel mailing list