# Where is "dl" library ?



## sw2wolf (Jul 26, 2012)

When I configure a application, FreeBSD reports 
	
	



```
/usr/bin/ld: cannot find -ldl
```

What does it mean ?


Sincerely!


----------



## cpm@ (Jul 26, 2012)

Remove -ldl from CFLAGS


----------



## sw2wolf (Jul 26, 2012)

cpu82 said:
			
		

> Remove -ldl from CFLAGS




```
$cat /etc/make.conf|grep CFLAGS
CFLAGS=-O2 -fno-strict-aliasing -pipe
```

It is a third party application.


Regards!


----------



## cpm@ (Jul 26, 2012)

Which app?


----------



## wblock@ (Jul 26, 2012)

sw2wolf said:
			
		

> ```
> $cat /etc/make.conf|grep CFLAGS
> CFLAGS=-O2 -fno-strict-aliasing -pipe
> ```



Setting custom CFLAGS in make.conf is usually a mistake.  Not only does it offer little improvement at best, it also prevents ports from using more optimized flags when they can.


----------



## sw2wolf (Jul 26, 2012)

wblock@ said:
			
		

> Setting custom CFLAGS in make.conf is usually a mistake.  Not only does it offer little improvement at best, it also prevents ports from using more optimized flags when they can.


Really! Then I should comment the CFLAGS in /etc/make.conf ?


----------



## wblock@ (Jul 26, 2012)

Yes, or remove it.


----------



## idownes (Aug 1, 2012)

Just to expand a little, in FreeBSD the dl functions are in the Standard C library - libc, e.g. see dlopen(3).


----------



## sw2wolf (Feb 12, 2014)

```
#ln -s /usr/lib/libc.so /usr/lib/libdl.so
```
fixed the problem .


----------



## SirDice (Feb 12, 2014)

sw2wolf said:
			
		

> ```
> #ln -s /usr/lib/libc.so /usr/lib/libdl.so
> ```
> fixed the problem .


Don't do things like that, it's going to haunt you when you least expect it.


----------



## kpa (Feb 12, 2014)

SirDice said:
			
		

> sw2wolf said:
> 
> 
> 
> ...



Especially when the detection of the system type and available libraries is done with devel/autoconf and the like this kind of hack will trip the detection logic will cause compilation errors that can very hard to debug. FreBSD does not have a libdl.so library, leave it like that. If you have to deal with broken software that does not use the proper methods for detecting which library provides dlopen(3) and related functions fix the software, FreeBSD is not broken in this regard and does not need fixing.


----------

