. Advertisement .
. Advertisement .
I’m building a new program, but when I run it, an error pops up. The error displayed is as follows:
gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith -Wdeclaration-after-statement -Wformat-security -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -Wno-override-init -g -O2 -export-dynamic ***-lpthread*** -o utilities/ovs-dpctl utilities/ovs-dpctl.o lib/libopenvswitch.a /home/jyyoo/src/dpdk/build/lib/librte_eal.a /home/jyyoo/src/dpdk/build/lib/libethdev.a /home/jyyoo/src/dpdk/build/lib/librte_cmdline.a /home/jyyoo/src/dpdk/build/lib/librte_hash.a /home/jyyoo/src/dpdk/build/lib/librte_lpm.a /home/jyyoo/src/dpdk/build/lib/librte_mbuf.a /home/jyyoo/src/dpdk/build/lib/librte_ring.a /home/jyyoo/src/dpdk/build/lib/librte_mempool.a /home/jyyoo/src/dpdk/build/lib/librte_malloc.a -lrt -lm /usr/bin/ld: /home/jyyoo/src/dpdk/build/lib/librte_eal.a(eal.o): undefined reference to symbol '[email protected]@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
I have tried several workarounds, but they still do not get the desired results. If you have come across this situation and have a solution for the “error adding symbols: dso missing from command line” problem, pls let me know. Here is what I do:
$ readelf -s /lib/x86_64-linux-gnu/libpthread.so.0 | grep pthread_create 199: 0000000000008220 2814 FUNC GLOBAL DEFAULT 13 [email protected]@GLIBC_2.2.5 173: 0000000000008220 2814 FUNC LOCAL DEFAULT 13 __pthread_create_2_1 462: 0000000000008220 2814 FUNC GLOBAL DEFAULT 13 [email protected]@GLIBC_2.2
The cause: I think the cause of this error is that you don’t mention the library on the command line before the object files being compiled.
The solution: After the object files are compiled, you should mention the library on the command line:
Explanation: The sequence of modules affects the linkage. Symbols are requested first, then linked in from a library with them. As a result, you must identify modules that use libraries first, followed by libraries. As an example:
Distribution / compiler version is what determines the error message
Ubuntu Raring: (more information)
Solution It is possible that you are missing a library during your compilation steps. In my case, I added “-lz” to makefile/GCC flags.
Background A dynamic shared object (or shared library) is DSO.