aikidokatech / meta-openxt

WIP converting OpenXT to a modern OE layer
0 stars 1 forks source link

Autotool configure failures due to --as-needed gcc flag #9

Open rossphilipson opened 10 years ago

rossphilipson commented 10 years ago

So for example, this happens:

configure:12624: i586-oe-linux-gcc  -m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/home/aikidoka/oe-core/builds/tmp-eglibc/sysroots/openxt-stubdomain -o conftest  -O2 -pipe -g -feliminate-unused-debug-types   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lv4v conftest.c  >&5
/tmp/ccWtK8Qn.o: In function `main':
/home/aikidoka/oe-core/builds/tmp-eglibc/work/core2-32-oe-linux/libdmbus/git-r0/git/libdmbus/conftest.c:72: undefined reference to `v4v_socket'
collect2: error: ld returned 1 exit status

Because there is a check like this in configure.in:

AC_CHECK_FUNC([v4v_socket], [], [have_libv4v=false])

The failure is because gcc is using --as-needed which discards libraries that are not needed - i.e. not referenced. Because of the order: -lv4v conftest.c it fails because the linker has not seen any references to v4v and tosses it before it gets to the conftest module.

The possible fixes are to remove --as-needed or get the gcc command line re-ordered. I am not sure what is laying out the gcc command line so I don't know how to do the latter. The following spells out the problem:

https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

And this one talks about it too:

http://sigquit.wordpress.com/2011/02/16/why-asneeded-doesnt-work-as-expected-for-your-libraries-on-your-autotools-project/

aikidokatech commented 10 years ago

Marking this as an enhancement for now as we have a simple work around. This may be an autotools problem that is already fixed in OE after the daisy branch.