Bug 10441

Summary: source-highlight-native world build failures
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: devtools / tool chainAssignee: Ed Bartosh <eduard.bartosh>
Status: VERIFIED FIXED QA Contact: David Lopez Barriba <davidx.lopez.barriba>
Severity: major    
Priority: Medium+ CC: jose.perez.carranza, liezhi.yang, meta.mr.watcher, meta.watcher, randy.macleod
Version: 2.2   
Target Milestone: 2.3 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Richard Purdie 2016-10-16 10:08:44 UTC
We've seen two different world build failures in source-hightlight-native (dependency of source-hightlight). These are coming from libstdc++ incompatibility issues (from boost) coming from uninative.

debian8 (gcc 4.9):

configure:17686: result: no
configure:17651: checking for exit in -lboost_regex
configure:17676: g++  -o conftest -isystem/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/include -O2
 -pipe -D_GLIBCXX_USE_CXX11_ABI=0 -isystem/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/include  -L
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib -L/home/pokybuild/yocto-autobuilder/yocto-worker/
nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-rpath-link,/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroot
s/x86_64-linux/usr/lib -Wl,-rpath-link,/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-rpath,/ho
me/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib -Wl,-rpath,/home/pokybuild/yocto-autobuilder/yocto-w
orker/nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-O1 -L/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroot
s/x86_64-linux/usr/lib conftest.cpp -lboost_regex   >&5
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::r
untime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::o
verflow_error::overflow_error(char const*)@GLIBCXX_3.4.21'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::l
ogic_error::logic_error(char const*)@GLIBCXX_3.4.21'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::invalid_argument::invalid_argument(char const*)@GLIBCXX_3.4.21'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
collect2: error: ld returned 1 exit status
configure:17676: $? = 1
configure: failed program was:
| /* confdefs.h */
:

opensuse132 (gcc 4.8):

configure:17651: checking for exit in -lboost_regex
configure:17676: g++  -o conftest -isystem/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/include -O2
 -pipe -D_GLIBCXX_USE_CXX11_ABI=0 -isystem/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/include  -L
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib -L/home/pokybuild/yocto-autobuilder/yocto-worker/
nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-rpath-link,/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroot
s/x86_64-linux/usr/lib -Wl,-rpath-link,/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-rpath,/ho
me/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib -Wl,-rpath,/home/pokybuild/yocto-autobuilder/yocto-w
orker/nightly-world/build/build/tmp/sysroots/x86_64-linux/lib -Wl,-O1 -L/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroot
s/x86_64-linux/usr/lib conftest.cpp -lboost_regex   >&5
/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-world/build/build/tmp/sysroots/x86_64-linux/usr/lib/libboost_regex.so: undefined reference to `std::_
_throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20'
collect2: error: ld returned 1 exit status
configure:17676: $? = 1
configure: failed program was:
Comment 1 Richard Purdie 2016-10-16 13:08:30 UTC
Posted for discussion on the mailing list:

On a system compiling source-highlight-native with gcc 4.9 where boost-
native was built on a gcc 5 system, we see one error. On a system
compiling source-highlight-native with gcc 4.8 where boost-native was
built on a gcc 4.9 system, we see a different error.

The trouble is that libboost_regex.so in these cases wants the newer
libstdc++ but at link time of executable, it can only see the host
system and hence can't see newer symbols like
std::runtime_error::runtime_error(char const*) or
std::__throw_out_of_range_fmt(char const*, ...).

I have done a lot of experimentation and the only way I can see of
possibly making this work is to add -Wl,--unresolved-symbols=ignore-in-
shared-libs to BUILD_LDFLAGS for source-highlight *and* ensure any
native binaries get tweaked to use our own uninative loader before
they're run. The former is horrible and the latter bit is hard.

Another option would be to have multiple uninative feeds based on gcc
version rather than a single uninative one.

This close to release, I'm reluctant to poke this too much. We don't
have many components that using C++, source-highlight is a
comparatively new one which isn't in our default configuration for now.
I'm therefore tempted to release note and look at this in 2.3.
Comment 2 Ed Bartosh 2016-10-26 14:46:27 UTC
Fixed by implementing gcc version dependant uninative sstate cache.

Please, review:
http://lists.openembedded.org/pipermail/openembedded-core/2016-October/128067.html
Comment 5 Ed Bartosh 2016-12-19 12:47:40 UTC
the fix has been merged to poky master
Comment 6 David Lopez Barriba 2017-05-26 18:11:25 UTC
Verified in e5aa1ac23669a45491de9ecffac491c01e70203f