Open kloczek opened 5 months ago
It works fine on Gentoo here (git checkout of tag v2.6.8, cmocka 1.1.5, gcc 13.2.1):
[ OK ] argv_str__multiple_argv__correct_output
[ RUN ] argv_insert_head__non_empty_argv__head_added
[ OK ] argv_insert_head__non_empty_argv__head_added
[ RUN ] argv_insert_head__empty_argv__head_only
[ OK ] argv_insert_head__empty_argv__head_only
[==========] 14 test(s) run.
[ PASSED ] 14 test(s).
PASS: argv_testdriver
so I'm afraid it's something with your RPM build environment. What Linux version is this exactly? Does it work if you build & test outside of rpmbuild? The RPM gcc command line adds quite a number of switches that might cause the link fail.
Interesting enough we did have a report about the same issue in 2.5.0, also with rpmbuild
, in our old ticket system - https://community.openvpn.net/openvpn/ticket/1346 - and the original poster never provided any information, so it was closed without resolution.
Would need at least the version of your distro and of gcc to be able to try to reproduce. But as @cron2 said, it is likely that one of the various compiler/linker flags is the problem here.
I suspect you need LTO (-flto
) to trigger it. Our automated tinderboxing effort with LTO hit this at https://bugs.gentoo.org/877741.
I've seen quirks with -Wl,--wrap
and LTO in other places but not yet tried to understand the problem.
I suspect you need LTO (
-flto
) to trigger it. Our automated tinderboxing effort with LTO hit this at https://bugs.gentoo.org/877741.I've seen quirks with
-Wl,--wrap
and LTO in other places but not yet tried to understand the problem.
I can only confirm that I'm using LTO as well 😋
I've spent a bit of time staring at the gentoo bug, the gentoo build log (which is -j16
, so hard to follow) and reproducing this on one of my gentoo test systems.
So, indeed, if built with
$ ./configure 'CFLAGS=-O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0'
I get the same error out of make check V=1
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I../../../src/openvpn -I../../../src/compat -I../../../include -Wall -Wno-stringop-truncation -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -std=c99 -I/usr/include/libnl3 -MT ../../../src/openvpn/argv_testdriver-argv.o -MD -MP -MF ../../../src/openvpn/.deps/argv_testdriver-argv.Tpo -c -o ../../../src/openvpn/argv_testdriver-argv.o `test -f '../../../src/openvpn/argv.c' || echo './'`../../../src/openvpn/argv.c
mv -f ../../../src/openvpn/.deps/argv_testdriver-argv.Tpo ../../../src/openvpn/.deps/argv_testdriver-argv.Po
/bin/sh ../../../libtool --tag=CC --mode=link gcc -I../../../src/openvpn -I../../../src/compat -I../../../include -Wall -Wno-stringop-truncation -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -std=c99 -I/usr/include/libnl3 -lssl -lcrypto -llzo2 -lcmocka -L../../../src/openvpn -Wl,--wrap=parse_line -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -o argv_testdriver argv_testdriver-test_argv.o argv_testdriver-mock_msg.o argv_testdriver-mock_get_random.o ../../../src/openvpn/argv_testdriver-platform.o ../../../src/openvpn/argv_testdriver-buffer.o ../../../src/openvpn/argv_testdriver-win32-util.o ../../../src/openvpn/argv_testdriver-argv.o -lnl-genl-3 -lnl-3 -lcap-ng
libtool: link: gcc -I../../../src/openvpn -I../../../src/compat -I../../../include -Wall -Wno-stringop-truncation -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -std=c99 -I/usr/include/libnl3 -Wl,--wrap=parse_line -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -o argv_testdriver argv_testdriver-test_argv.o argv_testdriver-mock_msg.o argv_testdriver-mock_get_random.o ../../../src/openvpn/argv_testdriver-platform.o ../../../src/openvpn/argv_testdriver-buffer.o ../../../src/openvpn/argv_testdriver-win32-util.o ../../../src/openvpn/argv_testdriver-argv.o -lssl -lcrypto -llzo2 -lcmocka -L../../../src/openvpn -lnl-genl-3 -lnl-3 -lcap-ng
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/cct2glrE.ltrans0.ltrans.o: in function `argv_parse_cmd.constprop.0':
<artificial>:(.text+0x1326): undefined reference to `__wrap_parse_line'
collect2: error: ld returned 1 exit status
I'm not sure if we can fix this, except by "not using -Wl,-wrap=...
- which would work for this particular test case, but for other cases it's not so straightforward to build a meaningful unit test with wrapper functions to provide test data when compiling unmodified source files (which is the point of the unit tests).
I'm not sure I understand what is happening here, but it seems -flto
and -Wl,-wrap=
upset each other. So, please do not build the unit tests with -flto
.
Looks like it is something wrong with test suite