Hello there!
Apologies if this is going into the wrong list, but I honestly was n't sure,e
specially since this very issue was discussed a long time ago - found an exchange about
this in the archive through Google - so I ended up just posting it here.
I am currently building a toolset for RISC-V to use as a rootfs for a Docker Container
that can then be used as a Jenkins agent to eventually build my way through Alpine's
abuild/aports, so that I can reconstruct the alpine:3.19 image, but for RISC-V (there are
only snapshots and the :edge image, right now).
Most things built just fine; kernel, toolchain and alike. But when it tries to configure
libatomic for the target, this happens:
configure:14906: riscv64-openadk-linux-uclibc-cc -o conftest -g -O2 -g -Os
-fno-sync-libcalls -pthread conftest.c
>&5/nvme/opt/openadk/toolchain_generic-riscv64_uclibc-ng/usr/lib/gcc/riscv64-openadk-linux-uclibc/13.2.0/../../../../riscv64-openadk-linux-uclibc/bin/ld:
/nvme/opt/openadk/toolchain_generic-riscv64_uclibc-ng/usr/lib/gcc/riscv64-openadk-linux-uclibc/13.2.0/libgcc.a(unwind-dw2-fde-dip.o):
in function `_Unwind_Find_FDE':
(.text+0x1adc): undefined reference to `dl_iterate_phdr'
collect2: error: ld returned 1 exit status
configure:14906: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Atomic Library"
| #define PACKAGE_TARNAME "libatomic"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Atomic Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
| #define PACKAGE "libatomic"
| #define VERSION "1.0"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define LT_OBJDIR ".libs/"
| #define IFUNC_RESOLVER_ARGS void
| #define STDC_HEADERS 1
| #define STRING_WITH_STRINGS 1
| #define HAVE_INT1 1
| #define HAVE_INT2 1
| #define HAVE_INT4 1
| #define HAVE_INT8 1
| #define HAVE_INT16 1
| #define HAVE_ATOMIC_LDST_1 1
| #define HAVE_ATOMIC_LDST_2 1
| #define HAVE_ATOMIC_LDST_4 1
| #define HAVE_ATOMIC_LDST_8 1
| #define HAVE_ATOMIC_LDST_16 0
| #define HAVE_ATOMIC_TAS_1 1
| #define HAVE_ATOMIC_TAS_2 1
| #define HAVE_ATOMIC_TAS_4 1
| #define HAVE_ATOMIC_TAS_8 1
| #define HAVE_ATOMIC_TAS_16 1
| #define HAVE_ATOMIC_EXCHANGE_1 1
| #define HAVE_ATOMIC_EXCHANGE_2 1
| #define HAVE_ATOMIC_EXCHANGE_4 1
| #define HAVE_ATOMIC_EXCHANGE_8 1
| #define HAVE_ATOMIC_EXCHANGE_16 0
| #define HAVE_ATOMIC_CAS_1 1
| #define HAVE_ATOMIC_CAS_2 1
| #define HAVE_ATOMIC_CAS_4 1
| #define HAVE_ATOMIC_CAS_8 1
| #define HAVE_ATOMIC_CAS_16 0
| #define HAVE_ATOMIC_FETCH_ADD_1 1
| #define HAVE_ATOMIC_FETCH_ADD_2 1
| #define HAVE_ATOMIC_FETCH_ADD_4 1
| #define HAVE_ATOMIC_FETCH_ADD_8 1
| #define HAVE_ATOMIC_FETCH_ADD_16 0
| #define HAVE_ATOMIC_FETCH_OP_1 1
| #define HAVE_ATOMIC_FETCH_OP_2 1
| #define HAVE_ATOMIC_FETCH_OP_4 1
| #define HAVE_ATOMIC_FETCH_OP_8 1
| #define HAVE_ATOMIC_FETCH_OP_16 0
| #define WORDSIZE 8
| /* end confdefs.h. */
| #include <pthread.h>
| void *g(void *d) { return NULL; }
| int
| main ()
| {
| pthread_t t; pthread_create(&t,NULL,g,NULL);
| ;
| return 0;
| }
configure:14922: riscv64-openadk-linux-uclibc-cc -o conftest -g -O2 -g -Os
conftest.c -lpthread >&5
/nvme/opt/openadk/toolchain_generic-riscv64_uclibc-ng/usr/lib/gcc/riscv64-openadk-linux-uclibc/13.2.0/../../../../riscv64-openadk-linux-uclibc/bin/ld:
/nvme/opt/openadk/toolchain_generic-riscv64_uclibc-ng/usr/lib/gcc/riscv64-openadk-linux-uclibc/13.2.0/libgcc.a(unwind-dw2-fde-dip.o):
in function `_Unwind_Find_FDE':
(.text+0x1adc): undefined reference to `dl_iterate_phdr'
collect2: error: ld returned 1 exit status
configure:14922: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU Atomic Library"
| #define PACKAGE_TARNAME "libatomic"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU Atomic Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libatomic/"
| #define PACKAGE "libatomic"
| #define VERSION "1.0"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define LT_OBJDIR ".libs/"
| #define IFUNC_RESOLVER_ARGS void
| #define STDC_HEADERS 1
| #define STRING_WITH_STRINGS 1
| #define HAVE_INT1 1
| #define HAVE_INT2 1
| #define HAVE_INT4 1
| #define HAVE_INT8 1
| #define HAVE_INT16 1
| #define HAVE_ATOMIC_LDST_1 1
| #define HAVE_ATOMIC_LDST_2 1
| #define HAVE_ATOMIC_LDST_4 1
| #define HAVE_ATOMIC_LDST_8 1
| #define HAVE_ATOMIC_LDST_16 0
| #define HAVE_ATOMIC_TAS_1 1
| #define HAVE_ATOMIC_TAS_2 1
| #define HAVE_ATOMIC_TAS_4 1
| #define HAVE_ATOMIC_TAS_8 1
| #define HAVE_ATOMIC_TAS_16 1
| #define HAVE_ATOMIC_EXCHANGE_1 1
| #define HAVE_ATOMIC_EXCHANGE_2 1
| #define HAVE_ATOMIC_EXCHANGE_4 1
| #define HAVE_ATOMIC_EXCHANGE_8 1
| #define HAVE_ATOMIC_EXCHANGE_16 0
| #define HAVE_ATOMIC_CAS_1 1
| #define HAVE_ATOMIC_CAS_2 1
| #define HAVE_ATOMIC_CAS_4 1
| #define HAVE_ATOMIC_CAS_8 1
| #define HAVE_ATOMIC_CAS_16 0
| #define HAVE_ATOMIC_FETCH_ADD_1 1
| #define HAVE_ATOMIC_FETCH_ADD_2 1
| #define HAVE_ATOMIC_FETCH_ADD_4 1
| #define HAVE_ATOMIC_FETCH_ADD_8 1
| #define HAVE_ATOMIC_FETCH_ADD_16 0
| #define HAVE_ATOMIC_FETCH_OP_1 1
| #define HAVE_ATOMIC_FETCH_OP_2 1
| #define HAVE_ATOMIC_FETCH_OP_4 1
| #define HAVE_ATOMIC_FETCH_OP_8 1
| #define HAVE_ATOMIC_FETCH_OP_16 0
| #define WORDSIZE 8
| /* end confdefs.h. */
| #include <pthread.h>
| void *g(void *d) { return NULL; }
| int
| main ()
| {
| pthread_t t; pthread_create(&t,NULL,g,NULL);
| ;
| return 0;
| }
configure:14925: error: Pthreads are required to build libatomic
I went and looked up what that function is, exactly, and learned quickly that this is
caused by me having chosen a static build. That said, this was also already discussed:
https://uclibc.uclibc.narkive.com/079V4ltx/dl-iterate-phdr-missing-in-libc
So, I am at a loss on what to do right now. I changed my setting to also build dynamic
objects, then cleaned uClibc-ng and rebuilt and then attempted again to let the normal
build run. But, that too, did not help.
My questions:
- Is dl_iterate_phdr in libc.a? According to grep, it matches, but that doesn-ät mean
much.
- I am using the 1.0.46 version of uClibc as openADK selects that.
- Is there anything I can do to fix this, or do I have to start over and just build with
shared libraries? I honestly would not be surprised if GCC just didn#t want to be
statically linked; static is the devil, after all. ;)
Thanks and kind regards,
Ingwie