# 'libiconv' Won't Compile: /usr/bin/ld: cannot find -liconv



## dkovacevic (Jan 23, 2014)

This system has Apache, Postgres, and several other packages installed that will not start. The dependency seems to come back to libiconv.


```
cd /usr/ports/converters/libiconv
make install clean
...
===>  Found saved configuration for libiconv-1.14_1
=> libiconv-1.14.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz
libiconv-1.14.tar.gz                          100% of 4867 kB  117 kBps 00m00s
===> Fetching all distfiles required by libiconv-1.14_1 for building
===>  Extracting for libiconv-1.14_1
=> SHA256 Checksum OK for libiconv-1.14.tar.gz.
===>  Patching for libiconv-1.14_1
===>  Applying FreeBSD patches for libiconv-1.14_1
===>  Configuring for libiconv-1.14_1
configure: loading site script /usr/ports/Templates/config.site
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... (cached) /bin/mkdir -p
checking for awk... (cached) /usr/bin/awk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gcc... cc
checking whether the C compiler works... no
configure: error: in `/usr/ports/converters/libiconv/work/libiconv-1.14':
configure: error: C compiler cannot create executables
See `config.log' for more details
===>  Script "configure" failed unexpectedly.
Please report the problem to gnome@FreeBSD.org [maintainer] and attach the
"/usr/ports/converters/libiconv/work/libiconv-1.14/config.log" including the
output of the failure of your make command. Also, it might be a good idea to
provide an overview of all packages installed on your system (e.g. a
/usr/sbin/pkg_info -Ea).
*** Error code 1

Stop in /usr/ports/converters/libiconv.
*** Error code 1

Stop in /usr/ports/converters/libiconv.
```

Output of `/usr/sbin/pkg_info -Ea`:


```
Unreal-3.2.10.2
apache-2.2.21
apr-1.4.6.1.4.1_3
autoconf-2.69
autoconf-wrapper-20131203
automake-1.14
automake-wrapper-20131203
bigreqsproto-1.1.2
binutils-2.24
bison-2.7.1,1
bootstrap-openjdk-r333271
c-ares-config-1.10.0
cmake-2.8.12.1
cmake-modules-2.8.12.1_1
compat7x-amd64-7.4.704000.201310.1
compat8x-amd64-8.4.804000.201310_2
cups-client-1.5.0
db42-4.2.52_5
dejavu-2.34
dialog4ports-0.1.5_2
dnsmasq-2.59,1
expat-2.1.0
expect-5.43.0_4
fixesproto-5.0
fontconfig-2.11.0_1,1
freetype2-2.5.2
gcc-4.6.4
gcc-ecj-4.5
gettext-0.18.1.1
gmake-3.82
gmp-5.1.3
help2man-1.40.10
inputproto-2.3
java-zoneinfo-2013.i
javavmwrapper-2.4_3
jpeg-8_4
kbproto-1.0.6
libICE-1.0.8,1
libSM-1.2.2,1
libX11-1.6.2,1
libXau-1.0.8
libXaw-1.0.12,2
libXdmcp-1.1.1
libXext-1.3.2,1
libXfixes-5.0.1
libXft-2.3.1
libXi-1.7.2,1
libXmu-1.1.2,1
libXp-1.0.2,1
libXpm-3.5.11
libXrender-0.9.8
libXt-1.1.4,1
libXtst-1.2.2
libcheck-0.9.11
libexecinfo-1.1_3
libffi-3.0.13_1
libgcrypt-1.5.0
libgpg-error-1.10
libiconv-1.14_1
libidn-1.22
libpthread-stubs-0.3_4
libsigsegv-2.10
libtool-2.4.2_2
libxcb-1.9.3
libxml2-2.8.0_3
libxslt-1.1.26_3
libyaml-0.1.4_2
m4-1.4.17,1
mpc-1.0.2
mpfr-3.1.2
mysql55-client-5.5.35
mysql55-server-5.5.35
open-motif-2.3.4
openjdk6-b28_7,1
openldap-client-2.4.38
p5-Locale-gettext-1.05_3
pcre-8.33
perl5.12-5.12.5_3
php5-5.3.8
php5-ctype-5.4.15
php5-dom-5.4.15
php5-gd-5.3.8
php5-gd-5.4.15
php5-mysql-5.3.8
php5-openssl-5.4.4
php5-pgsql-5.4.15
php5-session-5.3.8
php5-xml-5.4.15
pkg-config-0.23_1
pkgconf-0.9.4
png-1.5.17
popt-1.16
portmaster-3.17.3
portupgrade-2.4.12,2
postgresql-client-9.1.7_1
postgresql-server-9.1.7_1
printproto-1.0.5
python27-2.7.2_3
recordproto-1.14.2
renderproto-0.11.1
rsync-3.1.0_1
ruby-1.9.3.484,1
ruby19-bdb-0.6.6_3
samba34-3.4.17
screen-4.0.3_14
sudo-1.8.3_1
t1lib-5.1.2_2,1
talloc-2.0.7
tcl84-8.4.20_2,1
unzip-6.0_1
xbitmaps-1.1.1
xcb-proto-1.9
xcmiscproto-1.2.2
xextproto-7.2.1
xf86bigfontproto-1.2.0
xorg-macros-1.18.0
xproto-7.0.25
xtrans-1.3.2
zip-3.0
```

Excerpt from config.log (whole thing available if needed):


```
configure:3905: $? = 0
configure:3894: cc -v >&5
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]
configure:3905: $? = 0
configure:3894: cc -V >&5
cc: '-V' option must have argument
configure:3905: $? = 1
configure:3894: cc -qversion >&5
cc: unrecognized option '-qversion'
cc: No input files specified
configure:3905: $? = 1
configure:3925: checking whether the C compiler works
configure:3947: cc -liconv   conftest.c  >&5
/usr/bin/ld: cannot find -liconv
configure:3951: $? = 1
configure:3989: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "libiconv"
| #define VERSION "1.14"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3994: error: in `/usr/ports/converters/libiconv/work/libiconv-1.14':
configure:3997: error: C compiler cannot create executables
See `config.log' for more details
```

I also have iconv.h on the system. Running `iconv` hangs the shell till a control-c, so it's obviously in the path.


```
# uname -a
FreeBSD gw_files2 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
```

Attempting to start apache: 
	
	



```
# /usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
/usr/local/lib/libapr-1.so.4: Undefined symbol "_ThreadRuneLocale"Starting apache22.
/usr/local/lib/libapr-1.so.4: Undefined symbol "_ThreadRuneLocale"/usr/local/etc/rc.d/apache22: WARNING: failed to start apache22
```

Any suggestions?


----------



## pkubaj (Jan 23, 2014)

*Re: 'libiconv' Won't Compile: /usr/bin/ld: cannot find -lico*

9.0-RELEASE is unsupported. Upgrade to at least 9.1-RELEASE.


----------



## dkovacevic (Jan 27, 2014)

*Re: 'libiconv' Won't Compile: /usr/bin/ld: cannot find -lico*

Thanks, that solved all of my problems.


----------

