Undefined reference to AO_pt_lock on Ubuntu 22.04 when building with configure and clang-16
ivmai opened this issue · 2 comments
ivmai commented
Build: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/602706880
Source: master (3e53e26)
Host: Ubuntu 22.04 / x64
Compiler: clang version 16.0.0 ; Target: x86_64-unknown-linux-gnu ; Thread model: posix
How to build: ./autogen.sh && ./configure --enable-werror && make check CFLAGS_EXTRA="-D AO_USE_PTHREAD_DEFS"
Output:
clang -Werror -Wall -Wextra -Wpedantic -Wno-long-long -g -O2 -D AO_USE_PTHREAD_DEFS -o test_malloc test_malloc.o ../src/.libs/libatomic_ops_gpl.a /home/travis/build/ivmai/libatomic_ops/src/.libs/libatomic_ops.a
/usr/bin/ld: test_stack.o: in function `run_one_test':
test_stack.c:(.text+0x21a): undefined reference to `AO_pt_lock'
/usr/bin/ld: ../src/.libs/libatomic_ops_gpl.a(atomic_ops_stack.o): in function `AO_stack_push_release':
atomic_ops_stack.c:(.text+0x52): undefined reference to `AO_pt_lock'
/usr/bin/ld: atomic_ops_stack.c:(.text+0x93): undefined reference to `AO_pt_lock'
/usr/bin/ld: atomic_ops_stack.c:(.text+0xef): undefined reference to `AO_pt_lock'
How to reproduce: ./configure --enable-werror && clang-16 -DHAVE_CONFIG_H -I src -D AO_USE_PTHREAD_DEFS tests/test_atomic.c src/*.c
ivmai commented
The reason of this is: configure defines AO_NO_PTHREADS.
AC_CHECK_LIB(pthread, pthread_self, have_pthreads=true)
fails if -Werror
autoconf version: 2.71
config.log:
configure:13177: clang-16 -o conftest -Werror -Wall -Wextra -Wpedantic -Wno-long-long -g -O2 conftest.c -lpthread >&5
conftest.c:32:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
char pthread_self ();
^
void
ivmai commented
Build successful: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/602753347