Bug 219937 - security/hashcat: build fails if libiconv port installed
Summary: security/hashcat: build fails if libiconv port installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Nikolai Lifanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-12 11:12 UTC by John Hein
Modified: 2017-06-12 21:54 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (lifanov)


Attachments
[patch] try to force including base iconv.h in case /usr/local/include/iconv.h exists (453 bytes, patch)
2017-06-12 11:51 UTC, John Hein
no flags Details | Diff
[patch] add USES=iconv (339 bytes, patch)
2017-06-12 12:37 UTC, John Hein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 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 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 2017-06-12 21:54:46 UTC
Committed, thanks!