View Full Version : /usr/bin/ld: cannot find -ldl
cell
July 25th, 2009, 20: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, 21: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, 21: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, 22: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, 05:06
Compile threaded apps with "-pthread", not "-lpthread" or variations thereof.
From AvoidingLinuxisms (http://wiki.freebsd.org/AvoidingLinuxisms).
cell
July 30th, 2009, 11: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?
Nex
January 13th, 2013, 09:13
I have the same problem (/usr/bin/ld: cannot find -ldl).
So you should be able to simply remove -ldl from CFLAGS and try compile.
But where?
There is file flags.make, but it doesn't have such flag:
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# compile C with /usr/bin/gcc
# compile CXX with /usr/bin/c++
C_FLAGS = -O3 -DNDEBUG -fPIC -I/media/disk1/gmat/trunk/gmat-code/src/../depends/cspice/cspice64/include -I/media/disk1/gmat/trunk/gmat-code/src/base/./include -I/media/disk1/gmat/trunk/gmat-code/src/base/./foundation -I/media/disk1/gmat/trunk/gmat-code/src/base/./hardware -I/media/disk1/gmat/trunk/gmat-code/src/base/./executive -I/media/disk1/gmat/trunk/gmat-code/src/base/./attitude -I/media/disk1/gmat/trunk/gmat-code/src/base/./spacecraft -I/media/disk1/gmat/trunk/gmat-code/src/base/./asset -I/media/disk1/gmat/trunk/gmat-code/src/base/./forcemodel -I/media/disk1/gmat/trunk/gmat-code/src/base/./forcemodel/harmonic -I/media/disk1/gmat/trunk/gmat-code/src/base/./propagator -I/media/disk1/gmat/trunk/gmat-code/src/base/./subscriber -I/media/disk1/gmat/trunk/gmat-code/src/base/./command -I/media/disk1/gmat/trunk/gmat-code/src/base/./solarsys -I/media/disk1/gmat/trunk/gmat-code/src/base/./factory -I/media/disk1/gmat/trunk/gmat-code/src/base/./stopcond -I/media/disk1/gmat/trunk/gmat-code/src/base/./interpreter -I/media/disk1/gmat/trunk/gmat-code/src/base/./util -I/media/disk1/gmat/trunk/gmat-code/src/base/./interpolator -I/media/disk1/gmat/trunk/gmat-code/src/base/./interface -I/media/disk1/gmat/trunk/gmat-code/src/base/./parameter -I/media/disk1/gmat/trunk/gmat-code/src/base/./configs -I/media/disk1/gmat/trunk/gmat-code/src/base/./burn -I/media/disk1/gmat/trunk/gmat-code/src/base/./solver -I/media/disk1/gmat/trunk/gmat-code/src/base/./function -I/media/disk1/gmat/trunk/gmat-code/src/base/./coordsystem -I/media/disk1/gmat/trunk/gmat-code/src/base/./math -I/media/disk1/gmat/trunk/gmat-code/src/base/./plugin -I/media/disk1/gmat/trunk/gmat-code/src/base/./event
C_DEFINES = -DGmatBase_EXPORTS -DNO_GCC_PRAGMA -DUSE_64_BIT_LONGS -D_DYNAMICLINK -DGMAT_EXPORTS -DEXP_STL -D__USE_SPICE__
CXX_FLAGS = -fno-strict-aliasing -ffriend-injection -fPIC -O3 -fPIC -I/media/disk1/gmat/trunk/gmat-code/src/../depends/cspice/cspice64/include -I/media/disk1/gmat/trunk/gmat-code/src/base/./include -I/media/disk1/gmat/trunk/gmat-code/src/base/./foundation -I/media/disk1/gmat/trunk/gmat-code/src/base/./hardware -I/media/disk1/gmat/trunk/gmat-code/src/base/./executive -I/media/disk1/gmat/trunk/gmat-code/src/base/./attitude -I/media/disk1/gmat/trunk/gmat-code/src/base/./spacecraft -I/media/disk1/gmat/trunk/gmat-code/src/base/./asset -I/media/disk1/gmat/trunk/gmat-code/src/base/./forcemodel -I/media/disk1/gmat/trunk/gmat-code/src/base/./forcemodel/harmonic -I/media/disk1/gmat/trunk/gmat-code/src/base/./propagator -I/media/disk1/gmat/trunk/gmat-code/src/base/./subscriber -I/media/disk1/gmat/trunk/gmat-code/src/base/./command -I/media/disk1/gmat/trunk/gmat-code/src/base/./solarsys -I/media/disk1/gmat/trunk/gmat-code/src/base/./factory -I/media/disk1/gmat/trunk/gmat-code/src/base/./stopcond -I/media/disk1/gmat/trunk/gmat-code/src/base/./interpreter -I/media/disk1/gmat/trunk/gmat-code/src/base/./util -I/media/disk1/gmat/trunk/gmat-code/src/base/./interpolator -I/media/disk1/gmat/trunk/gmat-code/src/base/./interface -I/media/disk1/gmat/trunk/gmat-code/src/base/./parameter -I/media/disk1/gmat/trunk/gmat-code/src/base/./configs -I/media/disk1/gmat/trunk/gmat-code/src/base/./burn -I/media/disk1/gmat/trunk/gmat-code/src/base/./solver -I/media/disk1/gmat/trunk/gmat-code/src/base/./function -I/media/disk1/gmat/trunk/gmat-code/src/base/./coordsystem -I/media/disk1/gmat/trunk/gmat-code/src/base/./math -I/media/disk1/gmat/trunk/gmat-code/src/base/./plugin -I/media/disk1/gmat/trunk/gmat-code/src/base/./event
CXX_DEFINES = -DGmatBase_EXPORTS -DNO_GCC_PRAGMA -DUSE_64_BIT_LONGS -D_DYNAMICLINK -DGMAT_EXPORTS -DEXP_STL -D__USE_SPICE__
MadHatter
February 12th, 2013, 09:22
First of all, sorry for the up.
Try to find in CMakeLists.txt a target_link_libraries function that includes ld and remove it.
For example in a cairo-dock CMakeList.txt file i replaced:
target_link_libraries("gldi"
${PACKAGE_LIBRARIES}
${GTK_LIBRARIES}
${XEXTEND_LIBRARIES}
${LIBCRYPT_LIBS}
icon-factory
implementations
dl)
with
target_link_libraries("gldi"
${PACKAGE_LIBRARIES}
${GTK_LIBRARIES}
${XEXTEND_LIBRARIES}
${LIBCRYPT_LIBS}
icon-factory
implementations)
and CMake creates the link.txt files without -ldl
Nex
February 14th, 2013, 17:53
In my case that was LINK_LIBRARIES("dl").
Anyway thank you.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.
0