/usr/bin/ld: cannot find -ldl

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

Code:
/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! ;)
 
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.
 
Ok, but now the error message is:

Code:
/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?
 
-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.
 
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?
 
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:


Code:
# 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__
 
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:
Code:
target_link_libraries("gldi"
	${PACKAGE_LIBRARIES}
	${GTK_LIBRARIES}
	${XEXTEND_LIBRARIES}
	${LIBCRYPT_LIBS}
	icon-factory
	implementations
	dl)
with
Code:
target_link_libraries("gldi"
	${PACKAGE_LIBRARIES}
	${GTK_LIBRARIES}
	${XEXTEND_LIBRARIES}
	${LIBCRYPT_LIBS}
	icon-factory
	implementations)
and CMake creates the link.txt files without -ldl
 
  • Thanks
Reactions: Nex
Back
Top