PDA

View Full Version : /usr/bin/ld: cannot find -ldl


cell
July 25th, 2009, 21:00
Hi!
I'm trying tu using a program for Linux (RTI DDS) on FreeBSD. This program generate some C++ files and a makefile and I compile the files using "gmake -f makefilename" (the guide of this program say to use this command).
When I use gmake I have this error

/usr/bin/ld: cannot find -ldl

What is ldl? Searching by Google I saw that it is a Linux option. What can I do for using gmake correctly without errors about ldl?
Thanks! ;)

aragon
July 25th, 2009, 22:33
ldl is libdl. It is a linuxism. FreeBSD does not have a libdl. The same functionality that is in linux's libdl is provided in FreeBSD's libc. So you should be able to simply remove -ldl from CFLAGS and try compile.

cell
July 25th, 2009, 22:52
Ok, but now the error message is:

/usr/bin/ld: cannot find -lnsl

Can I remove -lnsl too?
Further more, there are also -lm and -lpthread in my makefile. Shall I remove these too?

aragon
July 25th, 2009, 23:09
-lnsl is another one you can remove - it is included in libc in FreeBSD.

No, -lm is a separate math library and not included in libc. Not too sure about -lpthread, but try set it to -lthr.

dennylin93
July 29th, 2009, 06:06
Compile threaded apps with "-pthread", not "-lpthread" or variations thereof.

From AvoidingLinuxisms (http://wiki.freebsd.org/AvoidingLinuxisms).

cell
July 30th, 2009, 12:19
I tryed to remove -ldl e -lnsl, but I have error from some .o files in some .a library of my application.

But... I thought... is there a way to use linux compatibility tool and, therefore, the libraries in /compat/linux directory?