Bug 212610 - security/yara: build fails on FreeBSD 11 / 64bit
Summary: security/yara: build fails on FreeBSD 11 / 64bit
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Wesley Shields
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-12 16:08 UTC by Gerard Seibert
Modified: 2016-09-21 15:32 UTC (History)
3 users (show)

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


Attachments
Build log (11.28 KB, text/plain)
2016-09-12 16:08 UTC, Gerard Seibert
no flags Details
yara.diff (561 bytes, patch)
2016-09-20 21:07 UTC, Antoine Brodin
no flags Details | Diff
yara.diff v2 (1.45 KB, patch)
2016-09-20 22:10 UTC, Antoine Brodin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerard Seibert 2016-09-12 16:08:29 UTC
Created attachment 174688 [details]
Build log

FreeBSD scorpio.seibercom.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r296485: Tue Mar  8 07:04:36 UTC 2016

The build process ends with this error message:

===>  Building for yara-3.5.0
/usr/bin/make  all-recursive
Making all in libyara
depbase=`echo modules/tests.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; /bin/sh ../libtool  --tag=CC    --mode=compile cc -DHAVE_CONFIG_H  -I. -I..   -I/usr/local/include  -O3 -Wall -Wno-deprecated-declarations -std=gnu99  -I./include -fvisibility=hidden -O2 -pipe  -fstack-protector -fno-strict-aliasing -D_THREAD_SAFE -pthread -DHASH_MODULE -MT modules/tests.lo -MD -MP -MF $depbase.Tpo -c -o modules/tests.lo modules/tests.c && mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -Wall -Wno-deprecated-declarations -std=gnu99 -I./include -fvisibility=hidden -O2 -pipe -fstack-protector -fno-strict-aliasing -D_THREAD_SAFE -pthread -DHASH_MODULE -MT modules/tests.lo -MD -MP -MF modules/.deps/tests.Tpo -c modules/tests.c  -fPIC -DPIC -o modules/.libs/tests.o
libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -Wall -Wno-deprecated-declarations -std=gnu99 -I./include -fvisibility=hidden -O2 -pipe -fstack-protector -fno-strict-aliasing -D_THREAD_SAFE -pthread -DHASH_MODULE -MT modules/tests.lo -MD -MP -MF modules/.deps/tests.Tpo -c modules/tests.c -o modules/tests.o >/dev/null 2>&1
depbase=`echo modules/pe.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; /bin/sh ../libtool  --tag=CC    --mode=compile cc -DHAVE_CONFIG_H  -I. -I..   -I/usr/local/include  -O3 -Wall -Wno-deprecated-declarations -std=gnu99  -I./include -fvisibility=hidden -O2 -pipe  -fstack-protector -fno-strict-aliasing -D_THREAD_SAFE -pthread -DHASH_MODULE -MT modules/pe.lo -MD -MP -MF $depbase.Tpo -c -o modules/pe.lo modules/pe.c && mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  cc -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -O3 -Wall -Wno-deprecated-declarations -std=gnu99 -I./include -fvisibility=hidden -O2 -pipe -fstack-protector -fno-strict-aliasing -D_THREAD_SAFE -pthread -DHASH_MODULE -MT modules/pe.lo -MD -MP -MF modules/.deps/pe.Tpo -c modules/pe.c  -fPIC -DPIC -o modules/.libs/pe.o
ESC[1mmodules/pe.c:2280:3: ESC[0mESC[0;1;31merror: ESC[0mESC[1muse of undeclared identifier
      'YR_MEMORY_BLOCK_ITERATOR'ESC[0m
  YR_MEMORY_BLOCK_ITERATOR* iterator = context->iterator;
ESC[0;1;32m  ^
ESC[0mESC[1mmodules/pe.c:2280:29: ESC[0mESC[0;1;31merror: ESC[0mESC[1muse of undeclared identifier 'iterator'ESC[0m
  YR_MEMORY_BLOCK_ITERATOR* iterator = context->iterator;
ESC[0;1;32m                            ^
ESC[0mESC[1mmodules/pe.c:2280:49: ESC[0mESC[0;1;31merror: ESC[0mESC[1mno member named 'iterator' in
      'struct _YR_SCAN_CONTEXT'ESC[0m
  YR_MEMORY_BLOCK_ITERATOR* iterator = context->iterator;
ESC[0;1;32m                                       ~~~~~~~  ^
ESC[0mESC[1mmodules/pe.c:2525:24: ESC[0mESC[0;1;31merror: ESC[0mESC[1muse of undeclared identifier 'iterator'ESC[0m
  foreach_memory_block(iterator, block)
ESC[0;1;32m                       ^
ESC[0mESC[1mmodules/pe.c:2527:22: ESC[0mESC[0;1;31merror: ESC[0mESC[1mno member named 'fetch_data' in
      'struct _YR_MEMORY_BLOCK'ESC[0m
        block_data = block->fetch_data(block);
ESC[0;1;32m                     ~~~~~  ^
ESC[0m5 errors generated.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/security/yara/work/yara-3.5.0/libyara
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/security/yara/work/yara-3.5.0
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/security/yara/work/yara-3.5.0
*** Error code 1

Stop.
make: stopped in /usr/ports/security/yara

Script done on Mon Sep 12 12:00:46 2016

The build log is attached.
Comment 1 Walter Schwarzenfeld 2016-09-12 17:49:26 UTC
I got an another error:
libyara/.libs/libyara.a(pe.o): In function `pe_parse_certificates':
modules/pe.c:(.text+0x42eb): undefined reference to `X509_get_signature_nid'
--- yara ---
libyara/.libs/libyara.a(pe.o): In function `pe_parse_certificates':
modules/pe.c:(.text+0x42eb): undefined reference to `X509_get_signature_nid'
--- yarac ---
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [yarac] Error code 1

I could fix this  comment out
CPPFLAGS+=     -I${OPENSSLINC}
LIBS+=         -L${OPENSSLLIB}
in the Makefile.

(10.3 with libressl).
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2016-09-20 20:36:00 UTC
Yara upstream doesn't support libressl (yet?).
Comment 3 Wesley Shields freebsd_committer freebsd_triage 2016-09-20 21:01:47 UTC
The original comment looks like it is picking up a header from a previous install and using that over the included headers when building?
Comment 4 Antoine Brodin freebsd_committer freebsd_triage 2016-09-20 21:07:35 UTC
Created attachment 175019 [details]
yara.diff

Gerard:
Do you have both a previous version of yara and openssl from ports installed?

Can you try attached patch?  It will prefer yara includes from sources over installed yara includes from a previous version.
Comment 5 Antoine Brodin freebsd_committer freebsd_triage 2016-09-20 22:10:57 UTC
Created attachment 175020 [details]
yara.diff v2

New version:
- prefer yara headers from sources over installed headers from a previous version
- fix build with libressl (build tested only)
Comment 6 Gerard Seibert 2016-09-20 23:05:54 UTC
(In reply to Antoine Brodin from comment #5)

I installed the patch and now the port builds and installs correctly.
Comment 7 Wesley Shields freebsd_committer freebsd_triage 2016-09-21 13:55:52 UTC
Please commit, and feel free to take ownership too as I am severely time limited lately. :(
Comment 8 Gerard Seibert 2016-09-21 14:35:12 UTC
(In reply to Wesley Shields from comment #7)

Unfortunately, I have neither the time nor the technical skill to maintain this port. Perhaps someone else can take it?
Comment 9 Wesley Shields freebsd_committer freebsd_triage 2016-09-21 15:08:27 UTC
I'll be happy to maintain it until a suitable replacement comes along, if you are willing to commit this diff. ;)

Gerard, would you like to maintain it? Otherwise I'll keep it until I can find someone.
Comment 10 commit-hook freebsd_committer freebsd_triage 2016-09-21 15:12:39 UTC
A commit references this bug:

Author: antoine
Date: Wed Sep 21 15:11:37 UTC 2016
New revision: 422564
URL: https://svnweb.freebsd.org/changeset/ports/422564

Log:
  - Fix build when a previous version is insalled and ssl from ports is used
  - Fix build with libressl
  - Take maintainership

  PR:		212610
  Approved by:	wxs (maintainer)

Changes:
  head/security/yara/Makefile
  head/security/yara/files/
  head/security/yara/files/patch-libyara_modules_pe.c
Comment 11 Wesley Shields freebsd_committer freebsd_triage 2016-09-21 15:32:09 UTC
Oops, I misread who the comment was from earlier. Sorry for the confusion Gerard, and thank you Antoine for picking it up!