3

i experience the undefined reference to `dlopen' problems since I have upgraded to ubuntu 13.10 and gcc 4.8.1.

The makefiles are working for years already. the particular call is

gcc -rdynamic -o ov_dbutil ov_dbutil.o libov.so -ldl

The errors are:

libov.so: undefined reference to `dlopen'
libov.so: undefined reference to `dlclose'
libov.so: undefined reference to `dlerror'
libov.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [ov_dbutil] Error 1

is it a gcc problem?

ov_dbutil is compiled with the following lines

gcc -g -Wall -O0 -shared -std=c99 -fno-strict-aliasing   -DPLT_SYSTEM_LINUX=1 -DPLT_USE_BUFFERED_STREAMS=1 -DPLT_SERVER_TRUNC_ONLY=1 -DNDEBUG   -DOV_SYSTEM_LINUX=1    -I../../../plt/include/ -I../../../ks/include/ -I../../include/ -I../../model/ -I../../source/codegen/ -I../../source/builder/ -I../../source/example/ -I../../source/kshist/ -I../../source/dynov/ -I../../source/tasklib/ -I../../source/dbparse/ -I../../source/dbdump/ -I../../../../libml/ -I../../include/runtimeserver/ -I. -c ../../source/dbutil/ov_dbutil.c -o ov_dbutil.o

no errors or warnings

Mat
  • 202,337
  • 40
  • 393
  • 406
Stasik
  • 2,568
  • 1
  • 25
  • 44

2 Answers2

0

Add -Wl,--no-as-needed as linker arguments.

tomato
  • 747
  • 5
  • 11
0

My issue was solved by adding -ldl in the lining line of the .so you want to link agains, it was called libov.so in the upper example.

Stasik
  • 2,568
  • 1
  • 25
  • 44