Bug 219937

Summary: security/hashcat: build fails if libiconv port installed
Product: Ports & Packages Reporter: John Hein <jcfyecrayz>
Component: Individual Port(s)Assignee: Nikolai Lifanov <lifanov>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (lifanov)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
[patch] try to force including base iconv.h in case /usr/local/include/iconv.h exists
none
[patch] add USES=iconv none

Description John Hein 2017-06-12 11:12:44 UTC
If the converters/libiconv port is installed, security/hashcat (3.6.0) has the following error:

================

cc    -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -std=c99 -Iinclude -IOpenCL -Iinclude/lzma_sdk src/main.c libhashcat.so -L. -lhashcat -fstack-protector -lpthread -DCOMPTIME=1497244702 -DVERSION_TAG=\"pull/1273/head\" -DINSTALL_FOLDER=\"/usr/local/bin\" -DSHARED_FOLDER=\"/usr/local/share/hashcat\" -DDOCUMENT_FOLDER=\"/usr/local/share/doc/hashcat\" -o hashcat
libhashcat.so: undefined reference to `libiconv'
libhashcat.so: undefined reference to `libiconv_close'
libhashcat.so: undefined reference to `libiconv_open'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [src/Makefile:394: hashcat] Error 1

==================

This is because the compilation looks in /usr/local/include first (due to USES=localbase) when building a couple .c files that include iconv.h

Noticed on 10.x and 11.x.
Comment 1 John Hein 2017-06-12 11:51:59 UTC
Created attachment 183422 [details]
[patch] try to force including base iconv.h in case /usr/local/include/iconv.h exists

This possible patch forces /usr/include to be searched before /usr/local/include.  Thus /usr/include/iconv.h will be found before /usr/local/include/iconv.h and the references to libiconv_* symbols becomes iconv_* (satisfied by /usr/lib/libiconv.so that is in all supported OS versions - i.e., basically 10.x+ now).
Comment 2 John Hein 2017-06-12 12:37:36 UTC
Created attachment 183427 [details]
[patch] add USES=iconv

This patch adds USES=iconv instead.  I think this is better than forcing /usr/include before /usr/local/include.

This will have the effect of adding converters/libiconv to BUILD_DEPENDS if converters/libiconv is installed due to the current Uses/iconv.mk.  But that's just a BUILD_DEPEND (can be removed after build), and I think Uses/iconv.mk could be altered to not force that BUILD_DEPEND addition (separate patch sent to tijl@).
Comment 3 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-12 21:44:31 UTC
I like the USES=iconv approach.
Let me test a couple of things and I'll get it in.
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-06-12 21:53:32 UTC
A commit references this bug:

Author: lifanov
Date: Mon Jun 12 21:53:05 UTC 2017
New revision: 443471
URL: https://svnweb.freebsd.org/changeset/ports/443471

Log:
  fix build with libiconv installed by USES=iconv

  PR:		219937
  Submitted by:	John Hein <z7dr6ut7gs@snkmail.com>

Changes:
  head/security/hashcat/Makefile
Comment 5 Nikolai Lifanov freebsd_committer freebsd_triage 2017-06-12 21:54:46 UTC
Committed, thanks!