OS: Gentoo slibtool: b1be90f yara: https://github.com/VirusTotal/yara/commit/8fa55cde4c0cde8a1ba4ced1c131827eb4005f0d
Gentoo
When building the tests in yara with make check it fails.
make check
rdlibtool --tag=CC --mode=link gcc -Wall -D_GNU_SOURCE -I./libyara/include -O3 -fvisibility=hidden -DUSE_LINUX_PROC -DDOTNET_MODULE -DHASH_MODULE -DBUCKETS_128=1 -DCHECKSUM_1B=1 -static -o test-arena tests/test-arena.o tests/util.o libyara.la -lcrypto -lcrypto -lcrypto -lcrypto -lcrypto -lcrypto -lm rdlibtool: lconf: {.name="libtool"}. rdlibtool: fdcwd: {.fdcwd=AT_FDCWD, .realpath="/tmp/yara"}. rdlibtool: lconf: fstatat(AT_FDCWD,".",...) = 0 {.st_dev = 44, .st_ino = 514926}. rdlibtool: lconf: openat(AT_FDCWD,"libtool",O_RDONLY,0) = 3. rdlibtool: lconf: found "/tmp/yara/libtool". rdlibtool: link: gcc tests/test-arena.o tests/util.o -Wall -D_GNU_SOURCE -I./libyara/include -O3 -fvisibility=hidden -DUSE_LINUX_PROC -DDOTNET_MODULE -DHASH_MODULE -DBUCKETS_128=1 -DCHECKSUM_1B=1 -L.libs -lyara -lcrypto -lm -lcrypto -o .libs/test-arena /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: tests/test-arena.o: in function `main': test-arena.c:(.text.startup+0x49): undefined reference to `yr_arena_create' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x6a): undefined reference to `yr_arena_allocate_memory' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x99): undefined reference to `yr_arena_write_string' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0xbe): undefined reference to `yr_arena_write_string' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0xdb): undefined reference to `yr_arena_release' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0xfe): undefined reference to `yr_arena_create' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x12b): undefined reference to `yr_arena_allocate_struct' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x151): undefined reference to `yr_arena_ref_to_ptr' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x169): undefined reference to `yr_arena_write_string' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x176): undefined reference to `yr_arena_ref_to_ptr' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x18f): undefined reference to `yr_arena_write_string' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x19c): undefined reference to `yr_arena_ref_to_ptr' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x201): undefined reference to `yr_arena_write_string' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x264): undefined reference to `yr_arena_save_stream' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x2b2): undefined reference to `yr_arena_release' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x2bf): undefined reference to `yr_arena_load_stream' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x2dd): undefined reference to `yr_arena_ref_to_ptr' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: test-arena.c:(.text.startup+0x319): undefined reference to `yr_arena_release' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: tests/util.o: in function `_assert_atoms': util.c:(.text+0x9b9): undefined reference to `yr_atoms_heuristic_quality' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0x9d5): undefined reference to `yr_atoms_extract_from_re' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: tests/util.o: in function `assert_re_atoms': util.c:(.text+0xab4): undefined reference to `yr_re_parse' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xabb): undefined reference to `yr_atoms_heuristic_quality' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xadd): undefined reference to `yr_atoms_extract_from_re' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xb64): undefined reference to `yr_re_ast_destroy' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xb9b): undefined reference to `yr_re_ast_destroy' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: tests/util.o: in function `assert_hex_atoms': util.c:(.text+0xbe2): undefined reference to `yr_re_parse_hex' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xbe9): undefined reference to `yr_atoms_heuristic_quality' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xc0b): undefined reference to `yr_atoms_extract_from_re' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xc94): undefined reference to `yr_re_ast_destroy' /usr/lib/gcc/x86_64-gentoo-linux-musl/13/../../../../x86_64-gentoo-linux-musl/bin/ld: util.c:(.text+0xccb): undefined reference to `yr_re_ast_destroy' collect2: error: ld returned 1 exit status rdlibtool: error logged in slbt_exec_link_create_executable(), line 245: flow error: unexpected condition or other. rdlibtool: < returned to > slbt_exec_link(), line 440. make[2]: *** [Makefile:1611: test-arena] Error 2 make[2]: Leaving directory '/tmp/yara' make[1]: *** [Makefile:3043: check-am] Error 2 make[1]: Leaving directory '/tmp/yara' make: *** [Makefile:3046: check] Error 2
Where GNU libtool works.
/bin/sh ./libtool --tag=CC --mode=link gcc -Wall -D_GNU_SOURCE -I./libyara/include -O3 -fvisibility=hidden -DUSE_LINUX_PROC -DDOTNET_MODULE -DHASH_MODULE -DBUCKETS_128=1 -DCHECKSUM_1B=1 -static -o test-arena tests/test-arena.o tests/util.o libyara.la -lcrypto -lcrypto -lcrypto -lcrypto -lcrypto -lcrypto -lm libtool: link: gcc -Wall -D_GNU_SOURCE -I./libyara/include -O3 -fvisibility=hidden -DUSE_LINUX_PROC -DDOTNET_MODULE -DHASH_MODULE -DBUCKETS_128=1 -DCHECKSUM_1B=1 -o test-arena tests/test-arena.o tests/util.o ./.libs/libyara.a -lcrypto -lm
In Makefile.am test-arena and the other tests set -static in the LDFLAGS and libyara.la in LDADD.
test-arena
-static
libyara.la
test_arena_SOURCES = tests/test-arena.c tests/util.c test_arena_LDADD = libyara.la test_arena_LDFLAGS = -static
Where -static causes GNU libtool to link with ./.libs/libyara.a where slibtool links with -L.libs -lyara, but this doesn't work since no symbols are global and libyara is built using -fvisibility=hidden.
./.libs/libyara.a
-L.libs -lyara
-fvisibility=hidden
For reference I am also experiencing test failures that are unrelated to GNU libtool or slibtool.
https://github.com/VirusTotal/yara/issues/2045 https://github.com/VirusTotal/yara/issues/2046
Thanks for the catch! Reproduced and confirmed.
Fixed. 9bbe9f6
Metadata Update from @orbea: - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.