Build fails at linker: Snippet: [846/936] cc -o tests/domaincapstest 'tests/59830eb@@domaincapstest@exe/domaincapstest.c.o' -I/usr/local/include -L/usr/local/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,-export-dynamic -pie -Wl,--whole-archive -Wl,--start-group tests/libtest_utils.a tests/libtest_file_wrapper.a -Wl,--no-whole-archive -lkvm -lintl -lutil -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fstack-protector -fstack-protector-strong src/libvirt.so.0.6007.0 src/bhyve/libvirt_driver_bhyve_impl.a -Wl,-export-dynamic -ldl /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgio-2.0.so /usr/local/lib/libgnutls.so /usr/local/lib/libxml2.so -Wl,--end-group -Wl,-z,relro -Wl,-z,now -Wl,-export-dynamic -Wl,-export-dynamic -Wl,-export-dynamic '-Wl,-rpath,$ORIGIN/../src:$ORIGIN/../src/bhyve' -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src/bhyve FAILED: tests/domaincapstest cc -o tests/domaincapstest 'tests/59830eb@@domaincapstest@exe/domaincapstest.c.o' -I/usr/local/include -L/usr/local/lib -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -Wl,-export-dynamic -pie -Wl,--whole-archive -Wl,--start-group tests/libtest_utils.a tests/libtest_file_wrapper.a -Wl,--no-whole-archive -lkvm -lintl -lutil -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fstack-protector -fstack-protector-strong src/libvirt.so.0.6007.0 src/bhyve/libvirt_driver_bhyve_impl.a -Wl,-export-dynamic -ldl /usr/local/lib/libglib-2.0.so /usr/local/lib/libintl.so /usr/local/lib/libgobject-2.0.so /usr/local/lib/libgio-2.0.so /usr/local/lib/libgnutls.so /usr/local/lib/libxml2.so -Wl,--end-group -Wl,-z,relro -Wl,-z,now -Wl,-export-dynamic -Wl,-export-dynamic -Wl,-export-dynamic '-Wl,-rpath,$ORIGIN/../src:$ORIGIN/../src/bhyve' -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src/bhyve /usr/bin/ld: undefined reference to symbol `expand_number' (try adding -lutil) /usr/lib/libutil.so: could not read symbols: Bad value cc: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. *** Error code 1 Stop. See attachment for complete build log.
Created attachment 217694 [details] libvirt poudriere build log I removed some content in the middle of the log to get the file size < 1MB.
(In reply to ddrinnon from comment #1) > /usr/lib/libutil.so: could not read symbols: Bad value Hm, this looks strange. Could you please do "ls -l /usr/lib/libutil.so", this should point to versioned version, on my system I have "/lib/libutil.so.9", and then do e.g. "nm -gD /lib/libutil.so.9" to see what it shows?
I ran the 2 commands inside the Poudriere ref jail: root@freebsd_11-4x64-HEAD:/ # ls -l /usr/lib/libutil.so lrwxr-xr-x 1 root wheel 22 Jun 12 18:27 /usr/lib/libutil.so -> ../../lib/libutil.so.9 root@freebsd_11-4x64-HEAD:/ # nm -gD /lib/libutil.so.9 U _CurrentRuneLocale U _DefaultRuneLocale w _Jv_RegisterClasses U _ThreadRuneLocale 0000000000212030 A __bss_start w __cxa_finalize U __error U __inet_ntoa U __isthreaded U __mb_sb_limit 0000000000008600 T __pw_initpwd 0000000000008650 T __pw_scan U __stack_chk_fail U __stack_chk_guard U __stderrp U __stdoutp U __tls_get_addr 0000000000212030 A _edata 0000000000213b48 A _end U _exit 000000000000ef08 T _fini 0000000000004da0 T _init 000000000000edc0 T _secure_path U asprintf U atoi U atol 000000000000afa0 T auth_cat 000000000000af30 T auth_checknologin 000000000000d460 T auth_getval 0000000000009e80 T auth_hostok 0000000000009ea0 T auth_timeok 0000000000009cf0 T auth_ttyok U bcmp U calloc U cgetcap U cgetclose U cgetent U cgetnum U cgetstr U chmod U close U cpuset U cpuset_setaffinity 000000000000d5e0 W crypt_set_format U dup2 U endusershell U err U errx U execl U execlp U exit 000000000000d300 T expand_number U fchmod U fchown U fflush U fgetln U fileno U flock 000000000000d0f0 T flopen U fnmatch U fork 0000000000008b40 T forkpty 000000000000cd50 T fparseln U fprintf U free U freeaddrinfo U fstat U fsync U ftruncate U fwrite U getaddrinfo U getegid U getenv U geteuid U getgid U getgrnam U gethostbyaddr U gethostbyname U gethostname U getnameinfo U getpid U getprogname U getrlimit U getsid U getttynam U getuid U getusershell 000000000000cb80 T gr_add 000000000000c270 T gr_copy 000000000000cb70 T gr_dup 000000000000c9b0 T gr_equal 000000000000cb10 T gr_fini 000000000000bf50 T gr_init 000000000000c030 T gr_lock 000000000000c6f0 T gr_make 000000000000caa0 T gr_mkdb 000000000000c810 T gr_scan 000000000000c140 T gr_tmp U grantpt 000000000000bdb0 T hexdump 000000000000b9c0 T humanize_number 000000000000dbe0 T in_lt 000000000000db60 T in_ltm 000000000000dc70 T in_ltms 000000000000dd10 T in_lts U initgroups U ioctl U kill 000000000000b6e0 T kinfo_getallproc 000000000000b820 T kinfo_getfile 000000000000b610 T kinfo_getproc 000000000000b470 T kinfo_getvmmap 000000000000b250 T kinfo_getvmobject 000000000000b090 T kld_isloaded 000000000000b220 T kld_load U kldfirstmod U kldload U kldnext U kldstat U link U localeconv U localtime 000000000000ddd0 T login_close 000000000000ec70 T login_getcapbool 000000000000e2b0 T login_getcaplist 000000000000e8a0 T login_getcapnum 000000000000ea30 T login_getcapsize 000000000000e240 T login_getcapstr 000000000000e570 T login_getcaptime 000000000000e1c0 T login_getclass 000000000000de60 T login_getclassbyname 000000000000e4b0 T login_getpath 000000000000e1d0 T login_getpwclass 000000000000eca0 T login_getstyle 000000000000e220 T login_getuserclass 0000000000009d10 T login_hostok 000000000000a150 T login_setcryptfmt 00000000000099d0 T login_str2inlist 0000000000009970 T login_strinlist 0000000000009a70 T login_timelist 0000000000009900 T login_tty 0000000000009b70 T login_ttyok U lseek U lstat U mac_free U mac_from_text U mac_is_present U mac_set_proc U malloc U memchr U memcpy U memmove U mkostemp U mktime U modfnext U modstat U nanosleep U open 0000000000008a50 T openpty 000000000000d620 T parse_lt 00000000000097f0 T pidfile_close 00000000000098d0 T pidfile_fileno 0000000000009310 T pidfile_open 00000000000098c0 T pidfile_remove 00000000000095c0 T pidfile_write U posix_openpt U printf 0000000000009240 T properties_free 0000000000008bd0 T properties_read 00000000000092a0 T property_find U ptsname U putchar 0000000000007df0 T pw_copy 0000000000008470 T pw_dup 0000000000007930 T pw_edit 0000000000007c70 T pw_equal 0000000000007bb0 T pw_fini 00000000000074f0 T pw_init 00000000000085f0 T pw_initpwd 00000000000075d0 T pw_lock 0000000000007d10 T pw_make 0000000000007d90 T pw_make_v7 0000000000007810 T pw_mkdb 00000000000083d0 T pw_scan 0000000000008460 T pw_tempname 00000000000076e0 T pw_tmp U pwrite U qsort 0000000000006880 T quota_check_path 00000000000067e0 T quota_close 0000000000007090 T quota_convert 0000000000006860 T quota_fsname 00000000000068f0 T quota_maxid 0000000000006840 T quota_off 0000000000006810 T quota_on 00000000000062c0 T quota_open 0000000000006870 T quota_qfname 0000000000006980 T quota_read 0000000000006f10 T quota_write_limits 0000000000006b60 T quota_write_usage U quotactl U raise U read 0000000000005ed0 T realhostname 0000000000006020 T realhostname_sa U realloc U reallocarray U reallocf U rename U rtprio 000000000000a9f0 T setclasscontext 000000000000a700 T setclasscpumask 000000000000a330 T setclassenvironment 000000000000a1c0 T setclassresources U setegid U setenv U seteuid U setgid U setlogin U setloginclass U setpriority U setrlimit U setsid U setuid 000000000000aa40 T setusercontext U setusershell U sigaction U sigaddset U sigemptyset U sigfillset U sigprocmask U sleep U snprintf U sprintf U sscanf U stat U statfs U stpcpy U strcasecmp U strchr U strcmp U strcpy U strcspn U strdup U strerror U strlcpy U strlen U strncasecmp U strncmp U strncpy U strrchr U strsep U strspn U strstr U strtok U strtol U strtoq U strtoul U strtoumax U sysctl U sysctlbyname U syslog U tcsetattr U tcsetsid 000000000000d470 T trimdomain U umask U unlink U unlockpt 0000000000005a30 T uu_lock 0000000000005ca0 T uu_lock_txfr 0000000000005e20 T uu_lockerr 0000000000005dc0 T uu_unlock U waitpid U warn U warnx U write root@freebsd_11-4x64-HEAD:/ #
(In reply to ddrinnon from comment #3) Thanks, looks like libutil.so is fine. I've actually was able to reproduce this in my poudiere jail. I noticed the following difference in commands between successfull and the failing build: --- cmd1.split 2020-09-02 15:21:47.764180000 +0400 +++ cmd2.split 2020-09-02 15:21:52.656649000 +0400 @@ -26,6 +26,7 @@ -fstack-protector-strong src/libvirt.so.0.6007.0 src/bhyve/libvirt_driver_bhyve_impl.a +-Wl,--no-copy-dt-needed-entries -Wl,-export-dynamic -ldl /usr/local/lib/libglib-2.0.so @@ -37,9 +38,11 @@ -Wl,--end-group -Wl,-z,relro -Wl,-z,now +-Wl,--no-copy-dt-needed-entries -Wl,-export-dynamic -Wl,-export-dynamic -Wl,-export-dynamic '-Wl,-rpath,$ORIGIN/../src:$ORIGIN/../src/bhyve' -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src -Wl,-rpath-link,/wrkdirs/usr/ports/devel/libvirt/work/libvirt-6.7.0/_build/src/bhyve So it seems that my system uses "-Wl,--no-copy-dt-needed-entries", and that's the only difference. Also, I can see the matching checks: Successful build: Compiler for C supports link arguments -Wl,--no-copy-dt-needed-entries: YES Failing build: Compiler for C supports link arguments -Wl,--no-copy-dt-needed-entries: NO Looking further.
Looks like '-Wl,--no-copy-dt-needed-entries' has nothing to do with this issue. The next thing I'm going to check is replacing add_project_link_arguments() with add_global_link_arguments() for -lutil, because it seems the former does not cover tests.
Created attachment 217708 [details] proposed fix The attached patch fixes the build for me, I'll commit it later today.
Thank you Roman!
A commit references this bug: Author: novel Date: Thu Sep 3 03:52:30 UTC 2020 New revision: 547408 URL: https://svnweb.freebsd.org/changeset/ports/547408 Log: devel/libvirt: fix build on 11.x There are some direct test dependencies missing, which is tolerated by ld(1) on FreeBSD 12.x and newer, but is not tolerated on FreeBSD 11.x. Add these dependencies to fix the build. PR: 249056 Reported by: ddrinnon@cdor.net Changes: head/devel/libvirt/files/patch-tests_meson.build
Should be fixed now, thanks for reporting!