thom311 / libnl

Netlink Library Suite
GNU Lesser General Public License v2.1
423 stars 311 forks source link

Build failure with tests in 3.6.0 (check-direct.c:17: undefined reference to `_nltst_map_stat_id_from_IPSTATS_MIB_v2') #306

Closed thesamesam closed 2 years ago

thesamesam commented 2 years ago

Hit this when packaging the new 3.6.0 for Gentoo:

libtool: link: x86_64-pc-linux-gnu-gcc -m32 -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -Wl,-O1 -Wl,--defsym=__gentoo_check_ldflags__=0 -o tests/check-direct tests/check_direct-check-direct.o  -Wl,--as-needed lib/.libs/libnl-3.so lib/.libs/libnl-nf-3.so lib/.libs/libnl-genl-3.so lib/.libs/libnl-route-3.so tests/.libs/libnl-test-util.a /var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86/lib/.libs/libnl-nf-3.so /var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86/lib/.libs/libnl-genl-3.so /var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86/lib/.libs/libnl-route-3.so /var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86/lib/.libs/libnl-3.so -lcheck -lpthread -Wl,-rpath -Wl,/var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86/lib/.libs
[...]
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: tests/check_direct-check-direct.o: in function `static_checks_fn':
/var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0/tests/check-direct.c:17: undefined reference to `_nltst_map_stat_id_from_IPSTATS_MIB_v2'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:3668: tests/check-direct] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86'
make: *** [Makefile:7125: check-am] Error 2
 * ERROR: dev-libs/libnl-3.6.0::gentoo failed (test phase):
 *   Make check failed. See above for details.

I think the deal here is that check-direct is an external executable and _nltst_map_stat_id_from_IPSTATS_MIB_v2 is (rightly) a private symbol, so when following libnl-route-3.sym, it's not going to be exported, and hence not available.

/var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86 $ nm -D ./lib/.libs/libnl-route-3.so.200 | grep _nlt
/var/tmp/portage/dev-libs/libnl-3.6.0/work/libnl-3.6.0-abi_x86_32.x86 $ echo $?
1

Let me know if I can provide any other information. Full build.log here: build.log

thom311 commented 2 years ago

hi. Thanks for the report, I just noticed too.

the problem is that check-direct wants to statically link the the libs, and when configuring with --disable-static, it fails.

the solution will be, that check-direct only gets build, when static libraries are enabled...

thom311 commented 2 years ago

fixed by fa7f97f8982544c4fcb403893bae6701230d5165.

thesamesam commented 2 years ago

Thank you!

thom311 commented 2 years ago

well, such a plunder... I kept checking things before the release... turned out, immediately an issue can be found.

if it's too severe, we can do a 3.7.0 soon after (no need to wait another 2.5 years) :)

kloczek commented 2 years ago

Thx .. indeed that commit fixed linking issue but now again test suite is failing in one unit 😄

===================================
   libnl 3.6.0: ./test-suite.log
===================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: tests/check-all
=====================

Running suite(s): main
 Abstract addresses
 Netlink attributes
 Clone ematch tree
 netns
90%: Checks: 11, Failures: 1, Errors: 0
tests/nl-test-util.c:98:S:Core:cache_and_clone:0: assert(r == 0) failed (errno=1, Operation not permitted)
FAIL tests/check-all (exit status: 1)

============================================================================
Testsuite summary for libnl 3.6.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log
============================================================================
make[2]: *** [Makefile:6799: test-suite.log] Error 1
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/libnl-3.6.0'
make[1]: *** [Makefile:6907: check-TESTS] Error 2
kloczek commented 2 years ago

FYI I'm runnig my builds in LXC zones which have stripped down some capabilities.

thesamesam commented 2 years ago

Maybe the same as #308?