1

I'm writting a program that relies on a shared object libLTK.so

I also write the code of libLTK.so which relies on libunwind.so

libunwind.so was fetched using regular package installation.

I am able to compile libLTK.so and the resulting ELF dependency shows :

  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libunwind.so.8]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x1000
 0x000000000000000d (FINI)               0x35cc
 0x0000000000000019 (INIT_ARRAY)         0x5df8
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x5e00
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x260
 0x0000000000000005 (STRTAB)             0x700
 0x0000000000000006 (SYMTAB)             0x310
 0x000000000000000a (STRSZ)              471 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x6000
 0x0000000000000002 (PLTRELSZ)           528 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0xa18
 0x0000000000000007 (RELA)               0x970
 0x0000000000000008 (RELASZ)             168 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x930
 0x000000006fffffff (VERNEEDNUM)         1
 0x000000006ffffff0 (VERSYM)             0x8d8
 0x000000006ffffff9 (RELACOUNT)          3
 0x0000000000000000 (NULL)               0x0

I am not able to compile the final program getting this errors :

/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_init_local'
/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_step'
/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_get_proc_name'

Here is what I do to compile :

$ make -C PROJECT
make: Entering directory '/home/lewis/Documents/libltk/PROJECT'
mkdir -p bin
gcc -Wall -Wno-undef -g -c -fPIC -pedantic -o bin/instance.o src/instance.c -D_XOPEN_SOURCE=700 -DVER=\"\" -Iinclude
gcc -Wall -Wno-undef -g -c -fPIC -pedantic -o bin/utils.o src/utils.c -D_XOPEN_SOURCE=700 -DVER=\"\" -Iinclude
gcc -shared -o bin/lib.so bin/instance.o bin/utils.o -lunwind
make: Leaving directory '/home/lewis/Documents/libltk/PROJECT'
$ gcc -Wall -g -o main main.c dummy.c -lLTK -lunwind
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libLTK.so: undefined reference to `_Ux86_64_init_local'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libLTK.so: undefined reference to `_Ux86_64_step'
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/libLTK.so: undefined reference to `_Ux86_64_get_proc_name'
collect2: error: ld returned 1 exit status
[lewis@lan-portable libltk]$ gcc -Wall -g -o main main.c dummy.c -LPROJECT/bin -lLTK -L/usr/lib64 -lunwind
/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_init_local'
/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_step'
/usr/bin/ld: /usr/lib64/libLTK.so: undefined reference to `_Ux86_64_get_proc_name'
collect2: error: ld returned 1 exit status
$ ll /usr/lib64 | grep unwind
lrwxrwxrwx.  1 root root       27 Jan 31 16:35 libunwind-coredump.so -> libunwind-coredump.so.0.0.0
lrwxrwxrwx.  1 root root       27 Jan 31 16:35 libunwind-coredump.so.0 -> libunwind-coredump.so.0.0.0
-rwxr-xr-x.  1 root root    19992 Jan 31 16:35 libunwind-coredump.so.0.0.0
lrwxrwxrwx.  1 root root       19 Jan 31 16:35 libunwind-generic.so -> libunwind-x86_64.so
-rw-r--r--.  1 root root    89444 Jan 31 16:35 libunwind-ptrace.a
lrwxrwxrwx.  1 root root       18 Jan 31 16:35 libunwind.so -> libunwind.so.8.0.1
lrwxrwxrwx.  1 root root       18 Jan 31 16:35 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x.  1 root root    62008 Jan 31 16:35 libunwind.so.8.0.1
lrwxrwxrwx.  1 root root       25 Jan 31 16:35 libunwind-x86_64.so -> libunwind-x86_64.so.8.0.1
lrwxrwxrwx.  1 root root       25 Jan 31 16:35 libunwind-x86_64.so.8 -> libunwind-x86_64.so.8.0.1
-rwxr-xr-x.  1 root root    78600 Jan 31 16:35 libunwind-x86_64.so.8.0.1

Can you help me?

Lewis Anesa
  • 102
  • 3
  • 12
  • Please show your exact link command line. Do you have `-lunwind`? That is still needed for the final executable link. – kaylum Jun 10 '20 at 23:29
  • tryed nm on /usr/lib64/libunwind.so `nm: /usr/lib64/libunwind.so: no symbols` I don't understand why this lib is void. Loaded from dnf fedora... – Lewis Anesa Jun 11 '20 at 19:22
  • Solution is here : https://stackoverflow.com/questions/49438381/getting-linker-errors-when-linking-against-libunwind-for-a-library-in-my-project – Lewis Anesa Jun 11 '20 at 19:54

0 Answers0