[ZBX-12756] configure script fails on FreeBSD with "Unable to use iconv (libiconv check failed)" Created: 2017 Sep 21  Updated: 2019 Feb 16  Resolved: 2018 Apr 16

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Installation (I)
Affects Version/s: 3.2.7
Fix Version/s: 3.4.9rc1, 4.0.0alpha6, 4.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Andris Mednis Assignee: Michael Veksler
Resolution: Fixed Votes: 0
Labels: freebsd, iconv
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

FreeBSD 11


Issue Links:
Duplicate
is duplicated by ZBX-10402 Wrong include and library path for iconv Closed
Team: Team C
Sprint: Sprint 31
Story Points: 1

 Description   

If libiconv package is installed AND --with-libcurl option is specified then configure script fails:

$ CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2" ./configure --enable-server --enable-proxy --enable-agent \
    --enable-ipv6 --with-net-snmp --with-unixodbc --with-libxml2 --with-libcurl --with-ssh2 \
  --with-openipmi --with-ldap --with-mysql --with-openssl --prefix=`pwd` 2>&1 | tee my_configure.out
...
checking whether libcurl is usable... yes
checking for curl_free... yes
checking for curl_easy_escape... yes
checking for ICONV support... configure: error: Unable to use iconv (libiconv check failed)

If libiconv package is removed OR --with-libcurl option is not used then configure script succeeds.

The issue can be worked around by adding --with-iconv=/usr/local to configure options:

$ CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2" ./configure --enable-server --enable-proxy --enable-agent \
    --enable-ipv6 --with-net-snmp --with-unixodbc --with-libxml2 --with-libcurl --with-ssh2 \
  --with-openipmi --with-ldap --with-mysql --with-openssl --with-iconv=/usr/local --prefix=`pwd` 2>&1 | tee my_configure.out


 Comments   
Comment by Andris Mednis [ 2017 Sep 21 ]

Apparently, if libiconv package is not installed, then ICONV functions from FreeBSD LIBC are used. Installing libiconv package brings in /usr/local/lib/libiconv.so.2 which is used for ICONV functions.

Errors in configure.log:

configure:11723: checking for ICONV support
configure:11765: cc -o conftest -I/usr/local/include -g -O2 -D_FORTIFY_SOURCE=2   -rdynamic   conftest.c -lkvm -lm -lexecinfo -ldevstat   >&5
configure:11765: cc -o conftest -I/usr/local/include -g -O2 -D_FORTIFY_SOURCE=2   -rdynamic   conftest.c -lkvm -lm -lexecinfo -ldevstat   >&5
/tmp/conftest-712caa.o: In function `main':
/usr/home/andris/ZBX-12466/3.2.6-1/conftest.c:167: undefined reference to `libiconv_open'   <---- Exists is /usr/local/lib/libiconv.so
/usr/home/andris/ZBX-12466/3.2.6-1/conftest.c:168: undefined reference to `libiconv'        <---- Exists in /usr/local/lib/libiconv.so
/usr/home/andris/ZBX-12466/3.2.6-1/conftest.c:169: undefined reference to `libiconv_close'  <---- Exists in /usr/local/lib/libiconv.so
cc: error: linker command failed with exit code 1 (use -v to see invocation)
configure:11765: $? = 1
Comment by Andris Mednis [ 2017 Sep 21 ]

Files in libiconv package:

$ pkg info -l libiconv-1.14_10
libiconv-1.14_10:
        /usr/local/bin/iconv
        /usr/local/include/iconv.h
        /usr/local/include/libcharset.h
        /usr/local/include/localcharset.h
        /usr/local/lib/charset.alias
        /usr/local/lib/libcharset.a
        /usr/local/lib/libcharset.so
        /usr/local/lib/libcharset.so.1
        /usr/local/lib/libcharset.so.1.0.0
        /usr/local/lib/libiconv.a
        /usr/local/lib/libiconv.so
        /usr/local/lib/libiconv.so.2
        /usr/local/lib/libiconv.so.2.5.1
        /usr/local/man/man1/iconv.1.gz
        /usr/local/man/man3/iconv.3.gz
        /usr/local/man/man3/iconv_close.3.gz
        /usr/local/man/man3/iconv_open.3.gz
        /usr/local/man/man3/iconv_open_into.3.gz
        /usr/local/man/man3/iconvctl.3.gz
        /usr/local/share/doc/libiconv/iconv.1.html
        /usr/local/share/doc/libiconv/iconv.3.html
        /usr/local/share/doc/libiconv/iconv_close.3.html
        /usr/local/share/doc/libiconv/iconv_open.3.html
        /usr/local/share/doc/libiconv/iconv_open_into.3.html
        /usr/local/share/doc/libiconv/iconvctl.3.html
        /usr/local/share/licenses/libiconv-1.14_10/GPLv3
        /usr/local/share/licenses/libiconv-1.14_10/LICENSE
        /usr/local/share/licenses/libiconv-1.14_10/catalog.mk
Comment by Andris Mednis [ 2017 Sep 21 ]

Some related comments in ZBX-12466.

Comment by Sergejs Paskevics [ 2018 Apr 11 ]

Successfully tested

Generated at Thu Mar 28 19:52:18 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.