0

Hi I'm trying to create an executable by linking multiple .so files in linux.

During the linker phase i'm getting undefined reference to `va_end' error in one of th e.so file i'm linking.

I tried to grep the symbol on whole /usr/lib folder to search if it is present in any of the lib and it points to lstdc++. And I have added this library to the linker options but it didn't work out as expected.

I'm using gcc-10 on ubuntu 20.04. Could you help how to resolve this linking error.

Linker command:

usr/bin/gcc -B,asm,/usr/bin -L,ld,/usr/bin -DINCLUDE_HEADER -isystem/usr/include/c++/10 -isystem/usr/include/x86_64-linux-gnu/c++/10 -isystem/usr/include/c++/10/backward -isystem/usr/lib/gcc/x86_64-linux-gnu/10/include -isystem/usr/lib/gcc/x86_64-linux-gnu/10 -isystem/usr/include -isystem/usr/inlcude/x86_64-linux-gnu/ -isystem/usr/local/include -std=c++11 -fPIC  -I/vobs/opensrc/x86_64/boost1580/include -isystem/usr/include/c++/10 -isystem/usr/include/x86_64-linux-gnu/c++/10 -isystem/usr/include/c++/10/backward -isystem/usr/lib/gcc/x86_64-linux-gnu/10/include -isystem/usr/lib/gcc/x86_64-linux-gnu/10 -isystem/usr/include -isystem/usr/inlcude/x86_64-linux-gnu/ -isystem/usr/local/include -std=c++11 -fPIC  -Wl,-rpath-link,/lib/x86_64-linux-gnu -Wl,-rpath-link,/usr/lib/x86_64-linux-gnu/ -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu  -o /home/project/netexec -L/runtime/net /home/project/netexec/bin/cfgfile2.o /home/project/netexec/bin/maincfg2.o /home/project/netexec/bin/snmpcfg.o /home/project/netexec/bin/dynlib.o /home/project/netexec/bin/runtimesupport.o /vobs/magnolia/network/bin/netbase_linux2.o /vobs/magnolia/network/bin/misc_linux2.o /vobs/magnolia/network/bin/notemgr.o /home/project/netexec/bin/cfgfiledefs_linux.o
-Wl,-no-as-needed -ldl -lpthread -lsupc++  -lpq -lpqxx -lbootp -L/home/project/folder2/bin -lInterface -L/vobs/linuxlib/usr/lib64 -lcrypto -lcrypto++  /home/project/netexec/bin/netexec.a
error:
/usr/bin/ld: /home/project/folder2/bin/libInterface.so: undefined reference to `va_end'

I have two questions:

  1. If the symbol is missing, it should have errored out during the creation of Interface.so file. But it didn't complain then. But now it give error
  2. How to proceed to fix this error
sahe
  • 1
  • 1
  • 2
  • Have a read of https://stackoverflow.com/questions/6735277/any-difference-in-linking-with-gcc-vs-g – Richard Critten Jun 20 '22 at 09:25
  • `va_end` is supposed to be a macro. I don't think there should be any symbol of that name. Where is the source for `libInterface` using it? – user17732522 Jun 20 '22 at 09:27
  • You have not linked `libstdc++` by the way. Many of your options don't make sense as linker options (`-std` and `-D` and `-isystem` and `-I`). If you want to link C++ object files, then don't just put `-l` flags on the command line, use `g++` instead of `gcc`, which takes care of using the correct linker flags. – user17732522 Jun 20 '22 at 09:29

0 Answers0