undefined reference to `libiconv_open`

Recently I had a problem while compiling php and apache  to a cpanel server and while looking at the easyapache log I saw the following:

 ext/iconv/iconv.c:1128: undefined reference to `libiconv’
iconv/iconv.c:1160: undefined reference to `libiconv’
/ext/iconv/iconv.c:1319: undefined reference to `libiconv_close’
ext/iconv/iconv.c:1228: undefined reference to `libiconv’
/ext/iconv/iconv.c:1259: undefined reference to `libiconv’
/ext/iconv/iconv.c:1303: undefined reference to `libiconv’
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket’:
ext/iconv/iconv.c:2615: undefined reference to `libiconv’
ext/iconv/iconv.c:2537: more undefined references to `libiconv’ follow
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor’:

/home/cpeasyapache/src/php-5.2.17/ext/iconv/iconv.c:2491: undefined reference to `libiconv_open’
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
!! ‘make’ failed with exit code ‘512’ !!
!! Restoring original working apache !!
!! Executing ‘/scripts/initsslhttpd’ !!
!! Restarting ‘httpd’ … !!
!! ‘httpd’ restart complete. !!
Building global cache for cpanel…Done
!! Executing ‘/scripts/initfpsuexec’ !!
!! Executing ‘/scripts/initsslhttpd’ !!
!! Executing ‘/scripts/update_apachectl’ !!
Compiling report…

The reason could either be glibc-common and glibc-devel packages. So I have force fully reinstalled the packages and put the proper iconv binary back on the system and the proper iconv headers.
root@server [~]# rpm -Uvh –nodeps –force glibc-common.rpm

root@server [~]# rpm -Uvh –nodeps –force glibc-devel.rpm

 

You should now be able to recompile the php without any issues.
undefined reference to `libiconv_open`

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub