Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LIBICONV variable as detected by autoconf to link libiconv #76

Closed
koobs opened this issue Jul 16, 2014 · 17 comments
Closed

Use LIBICONV variable as detected by autoconf to link libiconv #76

koobs opened this issue Jul 16, 2014 · 17 comments

Comments

@koobs
Copy link

koobs commented Jul 16, 2014

I just noticed that the FreeBSD port I maintain for libhtp (0.5.12) was not correctly linking to libiconv, even though configure had been correctly detecting iconv support:

checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv
checking for iconv declaration...
         extern size_t iconv (iconv_t cd, const char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);

This was only noticed when attempting to upgrade the suricata FreeBSD port to 2.0.2 using --enable-non-bundled-htp:

checking for htp_conn_create in -lhtp... no
   ERROR! libhtp library not found

suricata config.log shows:

configure:17204: checking for htp_conn_create in -lhtp
configure:17229: clang -o conftest -O2 -pipe -fno-strict-aliasing -Wextra -Werror-implicit-function-declaration -Wall -Wno-unused-parameter -std=gnu99 -DOS_FREEBSD  -
/usr/local/lib/libhtp.so: undefined reference to `libiconvctl'
/usr/local/lib/libhtp.so: undefined reference to `libiconv'
/usr/local/lib/libhtp.so: undefined reference to `libiconv_close'
/usr/local/lib/libhtp.so: undefined reference to `libiconv_open'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I also noticed the use of @LIBICONV@ in test/Makefile.am to correctly link the target, but not in the generated htp/Makefile (post-configure)

libhtp.la: $(libhtp_la_OBJECTS) $(libhtp_la_DEPENDENCIES) $(EXTRA_libhtp_la_DEPENDENCIES)
        $(AM_V_CCLD)$(libhtp_la_LINK) -rpath $(libdir) $(libhtp_la_OBJECTS) $(libhtp_la_LIBADD) $(LIBS)

As per GNU Gettext: Autoconf Macros (AM_ICONV), libhtp's generated Makefile variables are correctly populated:

LDFLAGS =  -L/usr/local/lib
LIBICONV = -liconv
LIBOBJS =
LIBS = -lz
<snip>
LTLIBICONV = -liconv
koobs added a commit to freebsd/freebsd-ports that referenced this issue Aug 15, 2014
- Update to 0.5.15
- Wrangle autoconf/make on linking libiconv with a workaround [1]
- pkg-descr: Remove Author:

[1] OISF/libhtp#76
@ivanr
Copy link
Contributor

ivanr commented Aug 17, 2014

Apologies for the delay, it took me some time to get a FreeBSD virtual machine up and running.

I can't replicate your problem, using LibHTP 0.5.15 (my release) and Suricata 2.0.3. FreeBSD is "FreeBSD 10.0-RELEASE #0 r260789". I encounter the problem of htp.pc being in the wrong place (/usr/local/lib/pkgconfig/), but once I move it to /usr/local/libdata/pkgconfig/, I am able to configure Suricata and compile it.

@koobs
Copy link
Author

koobs commented Aug 18, 2014

Thanks @ivanr, the devel/libhtp port correctly places the htp.pc file in /usr/local/libdata

What's the contents of your htp.pc file?

@ivanr
Copy link
Contributor

ivanr commented Aug 18, 2014

I created #79 for the htp.pc problem on FreeBSD, let's continue that discussion there. As far as I am aware the contents of htp.pc is not relevant, but you can see it here: https://github.com/ironbee/libhtp/blob/master/htp.pc.in

As for this ticket, should I close it?

@koobs
Copy link
Author

koobs commented Aug 19, 2014

@ivanr Correct, it's not relevant. As discussed with @inliniac, not seeing the symptoms on 10.x is likely due to the following change:

  AFFECTS: 10-CURRENT users with any port depending on converters/libiconv
  AUTHOR: madpilot@FreeBSD.org

  10-CURRENT after r254273 (committed on August 13, 2013) has an
  implementation of iconv enabled by default in libc.

  NOTE: after r341775 (committed on January 29, 2014) and other
  following commits, a few ports, including devel/glib20, depend
  on the converters/libiconv again due to missing functionality in the
  base iconv implementation.

  <snip>

The root cause as described in this bug (Not using the autoconf detected variable) applies to any versions < 10 prior to that date, versions that don't include libiconv in base (by user choice, or at any point in the future of FreeBSD), and for users that want to use libiconv from ports, or more precisely, anywhere other than base.

splbio pushed a commit to splbio/freebsd-ports that referenced this issue Nov 24, 2014
- Update to 0.5.15
- Wrangle autoconf/make on linking libiconv with a workaround [1]
- pkg-descr: Remove Author:

[1] OISF/libhtp#76


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@364955 35697150-7ecd-e111-bb59-0022644237b5
@UlasSAYGINIM
Copy link

I see sample problem on 12.1-RELEASE-p7.

I added environment variable by setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig

and also i copied htp.pc on /usr/local/libdata
but no luck.

checking for libhtp... yes
checking htp/htp.h usability... yes
checking htp/htp.h presence... yes
checking for htp/htp.h... yes
checking for htp_conn_create in -lhtp... no

ERROR! libhtp library not found

I attached config log. how can i solve it?
i also installed libnet from git repo.

config.log

@UlasSAYGINIM
Copy link

there is no /usr/local/include/libnet11 directory for command below

configure:21874: cc -o conftest -g -O2 -DOS_FREEBSD -march=native -I/usr/local/include/htp/ -I/usr/local/include -I/usr/local/include/libnet11 -I/usr/local/include -I/usr/local/lib/htp/include -L/usr/local/lib -L/usr/local/lib/libnet11 -L/usr/local/lib/ conftest.c -lhtp -lpcap -lnet -ljansson -lpthread -lyaml -lpcre -lz -L/usr/local/lib -lhtp >&5

@UlasSAYGINIM
Copy link

i changed htp.pc file extension. it is htp.pc file content
htp.pc.log

@catenacyber
Copy link
Contributor

@UlasSAYGINIM I am not sure. Are you expecting something or did you solve your problem ?

@UlasSAYGINIM
Copy link

@catenacyber i am expecting someone will help to solve the problem. there is another ticket #79
but no solution for long time. because of this, i cant install suricata on freebsd 13.

@koobs
Copy link
Author

koobs commented Apr 15, 2021

@catenacyber i am expecting someone will help to solve the problem. there is another ticket #79

but no solution for long time. because of this, i cant install suricata on freebsd 13.

The port works (builds) though correct? I believe we've had a patch in to workaround this since it was added

@UlasSAYGINIM
Copy link

as i remember for freebsd 12 does not work. but now i am trying for freebsd 13.

@UlasSAYGINIM
Copy link

Freebsd has old version 5.0.6 for suricata. can we update both libhtp ,libnet, and other dependencies with suricata?

@catenacyber
Copy link
Contributor

Thanks for the ping.
Is this still the case with the latest dev branches cf OISF/suricata#5340 (comment) ?

@victorjulien
Copy link
Member

I just did a successful build on FreeBSD 13.0-RELEASE today with no issues at all.

@UlasSAYGINIM
Copy link

yes i did it too now. it seems i can install without problem but i didnt run and test functionality.
but if you can update port to latest version suricate, it will be better. is it possible?

@UlasSAYGINIM
Copy link

some dependencies seems they need update to their latest versions.

@catenacyber
Copy link
Contributor

Closing as no problem seen on FreeBSD 13

svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
- Update to 0.5.15
- Wrangle autoconf/make on linking libiconv with a workaround [1]
- pkg-descr: Remove Author:

[1] OISF/libhtp#76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants