Bug 196720

Summary: devel/libhtp fails to compile due to missing function iconvctl() and missing constants ICONV_SET_TRANSLITERATE and ICONV_SET_DISCARD_ILSEQ
Product: Ports & Packages Reporter: Trond Endrestøl <Trond.Endrestol>
Component: Individual Port(s)Assignee: Kubilay Kocak <koobs>
Status: Closed FIXED    
Severity: Affects Only Me Keywords: easy
Priority: --- Flags: koobs: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   
See Also: http://trac.osgeo.org/postgis/ticket/3003
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=186563

Description Trond Endrestøl 2015-01-14 12:12:43 UTC
I'm trying to compile security/suricata, and ran into problems when compiling devel/libhtp.

No matter if I configure security/suricata to use suricata's builtin libhtp or to use devel/libhtp, both attempts fail with error messages such as:

--- htp_transcoder.lo ---
htp_transcoder.c:68:5: warning: implicit declaration of function 'iconvctl' is invalid in C99 [-Wimplicit-function-declaration]
    iconvctl(cd, ICONV_SET_TRANSLITERATE, &iconv_param);
    ^
htp_transcoder.c:68:18: error: use of undeclared identifier 'ICONV_SET_TRANSLITERATE'
    iconvctl(cd, ICONV_SET_TRANSLITERATE, &iconv_param);
                 ^
htp_transcoder.c:70:18: error: use of undeclared identifier 'ICONV_SET_DISCARD_ILSEQ'
    iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, &iconv_param);
                 ^
1 warning and 2 errors generated.
*** [htp_transcoder.lo] Error code 1

make[3]: stopped in /usr/ports/workdirs/usr/ports/devel/libhtp/work/OISF-libhtp-4cb1b99/htp

I even recompiled devel/libiconv and everything depending on that library, before attempting to compile devel/libhtp, but to no avail.

My ports tree is currently at r377002, and the installed devel/libiconv is 1.14_6.
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-14 12:12:43 UTC
Auto-assigned to maintainer koobs@FreeBSD.org
Comment 2 Trond Endrestøl 2015-01-15 20:25:23 UTC
This is on stable/10 amd64 r277210.

Neither /etc/make.conf nor /etc/src.conf contains WITH_ICONV=yes, nor does these files contain WITHOUT_ICONV=yes.

This is the contents of /etc/make.conf:

CC=clang
CXX=clang++
CPP=clang-cpp

WITH_PKGNG=yes
WITH_BDB6_PERMITTED=yes
WITH_SSP_PORTS=yes
WRKDIRPREFIX=/usr/ports/workdirs

TEX_DEFAULT=texlive

DEFAULT_VERSIONS=apache=2.4 bdb=5 firebird=2.5 gcc=4.8 lua=5.2 mysql=5.5 perl5=5.20 pgsql=9.3 php=5.4 python=2.7 python2=2.7 python3=3.4 ruby=1.9 tcltk=8.6

This is the contents of /etc/src.conf:

NO_WERROR=
WERROR=

WITH_CLANG_EXTRAS=yes
WITH_CLANG_FULL=yes
WITH_CTF=yes
WITH_GCC=yes
WITH_GNUCXX=yes
WITH_LIBCPLUSPLUS=yes
WITH_LLDB=yes
WITH_NAND=yes
WITH_PKGTOOLS=yes

Both /usr/include/iconv.h and /usr/local/include/iconv.h contains a declaration of iconvctl(), and definitions of ICONV_SET_TRANSLITERATE and ICONV_SET_DISCARD_ILSEQ.

Why does configure claim iconv to be working when clang fails to see iconvctl(), ICONV_SET_TRANSLITERATE, and ICONV_SET_DISCARD_ILSEQ while compiling htp_transcoder.c?
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2015-01-27 05:44:10 UTC
I can't reproduce this myself on a 10-STABLE machine, but I do however note bug 186563 (fixed by adding USES=iconv:translit) and http://trac.osgeo.org/postgis/ticket/3003 which indicates a similar resolution.

Can you try modifying the port to use USES:iconv:translit and report back on whether that fixes the issue for you please.

If it turns out this is *still* an issue for you, and the above changes fixes it, then the question becomes why can it not be reproduced locally (since we're both testing against 10-STABLE
Comment 4 Trond Endrestøl 2015-01-27 07:50:27 UTC
(In reply to Kubilay Kocak from comment #3)

Success! Thanks!
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2015-01-27 10:11:06 UTC
Lovely, thanks for reporting back, I'll make the change now :)
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-01-27 10:48:25 UTC
A commit references this bug:

Author: koobs
Date: Tue Jan 27 10:47:50 UTC 2015
New revision: 377991
URL: https://svnweb.freebsd.org/changeset/ports/377991

Log:
  devel/libhtp, security/suricata: Use iconv:translit

  Use translit for USES=iconv, fixing a build error on specific (10-STABLE r???)
  versions of FreeBSD that dont contain a libiconv implementation with certain
  features [1] in base.

  PR:		196720 [1]
  Reported by:	<trond.endrestol ximalas info>

Changes:
  head/devel/libhtp/Makefile
  head/security/suricata/Makefile
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2015-01-27 10:50:57 UTC
Committed with minor (unrelated) changes, thanks Trond!