why I got undefined reference to symbol 'dlsym' even though I had added -ldl.It complainted on ubuntu 16.04 as it's ok on the centos.The libdl.so.2 is exist on the ubuntu at /lib/x86_64-linux-gnu.
Asked
Active
Viewed 1,790 times
0
-
Perhaps `/lib` is not in the search path. You can try adding `-L/lib` after `-ldl` when you compile your program. – colelemonz Mar 08 '18 at 03:00
-
@colelemonz Not work...In fact I had tried to use the full path of libdl.so – ql du Mar 08 '18 at 03:10
-
Which version? One requires `#define _GNU_SOURCE` (`dlvsym`), you are good without it with `dlsym`. – David C. Rankin Mar 08 '18 at 03:10
-
@DavidC.Rankin version of libdl.so.2 is 2.23.I am not using dlsym but it is used in .so that I don't have source code. – ql du Mar 08 '18 at 03:25
-
I found the [answer](https://stackoverflow.com/questions/27607130/undefined-reference-to-dlsym-and-dlopen?rq=1) and thanks for your help! – ql du Mar 08 '18 at 06:38