Bug 246289 - net/ntopng: add -lcrypto
Summary: net/ntopng: add -lcrypto
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Guido Falsi
Depends on:
Reported: 2020-05-07 17:34 UTC by yds
Modified: 2020-05-10 16:52 UTC (History)
0 users

See Also:
madpilot: maintainer-feedback+
madpilot: merge-quarterly+

add -lcrypto (529 bytes, patch)
2020-05-07 17:34 UTC, yds
no flags Details | Diff
build output without -lcrypto (7.24 KB, text/plain)
2020-05-07 19:34 UTC, yds
no flags Details
full build log (217.41 KB, text/plain)
2020-05-08 15:06 UTC, yds
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description yds 2020-05-07 17:34:11 UTC
Created attachment 214239 [details]
add -lcrypto

nTopNG fails to build on 12.1-STABLE without linking -lcrypto
Comment 1 Guido Falsi freebsd_committer 2020-05-07 19:06:21 UTC

I'm unable to reproduce the issue. In poudriere the port compiles fine on all supported FreeBSD releases and recent head.

Could you provide a build log of a failing build?

Are you using base OpenSSL or an SSL library provided by the ports system?
Comment 2 yds 2020-05-07 19:34:00 UTC
Created attachment 214245 [details]
build output without -lcrypto

build failed again without -lcrypto using the base system OpenSSL on 12.1-STABLE
Comment 3 Guido Falsi freebsd_committer 2020-05-08 08:16:09 UTC
(In reply to yds from comment #2)

To understand what is going on I need a FULL build log, from start to end of the process.

From what you have posted I notice a difference with my own log. On my system the build system seems to correctly find the required options (-lcrypto included) and correctly compile ntopng.

Before modifying a port which is building fine in poudriere and in the build cluster I need to understand exactly why it is failing. It could be a specific problem in your installation.

You have not replied my question, do you have any ports provided SSL library installed? If you did in the past, simply removing it is not enough to make sure it is not influencing new builds anymore.
Comment 4 yds 2020-05-08 15:06:29 UTC
Created attachment 214277 [details]
full build log

I have never installed any OpenSSL from ports on the 12.1-STABLE boxes where this failure happens. FWIW, nTopNG 3.8 built fine, this became an issue with the upgrade to 4.0

if you look at `files/patch-configure.seed` where I'm adding `-lcrypto` -- it's already part of a FreeBSD specific hint to find the base system OpenSSL libs:
+  dnl Workaround for FreeBSD
+  elif test -f "/usr/lib/libssl.so"; then
+    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
+    SSL_INC="-I/usr/include"
+    SSL_LIB="-L/usr/lib -lssl"

if you look at the start of the `pkg-config --exists libssl` block of code on line 168 of configure.seed, `-lcrypto` is specified there:
pkg-config --exists libssl
if test "$?" -ne 1; then
  AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
  SSL_INC="`pkg-config --cflags libssl` -I/usr/include/openssl"
  SSL_LIB="`pkg-config --libs libssl` -lssl -lcrypto"

I do not see any ill effect from explicitly linking to both `-lssl -lcrypto` same as `pkg-config` does on line 172.

it does cure the build failure on 5 of my 12.1-STABLE boxes where I tried this with and without `-lcrypto`
Comment 5 Guido Falsi freebsd_committer 2020-05-08 16:11:05 UTC
Now I see and you got me convinced about the need for the change.

Please note that my inquiry was no negation of the correctness of your patch. As a committer I'm  the one responsible for what I commit, so I asked for explanations to get a full understanding of the situation, and you provided just that.

I'll commit the change after some more testing.
Comment 6 commit-hook freebsd_committer 2020-05-09 15:44:47 UTC
A commit references this bug:

Author: madpilot
Date: Sat May  9 15:44:00 UTC 2020
New revision: 534782
URL: https://svnweb.freebsd.org/changeset/ports/534782

  Fix build with openssl on 12.1-STABLE.

  PR:		246289
  Submitted by:	yds@Necessitu.de
  MFH:		2020Q2

Comment 7 Guido Falsi freebsd_committer 2020-05-09 15:54:42 UTC
Fix flag usage.
Comment 8 commit-hook freebsd_committer 2020-05-10 16:49:51 UTC
A commit references this bug:

Author: madpilot
Date: Sun May 10 16:49:36 UTC 2020
New revision: 534855
URL: https://svnweb.freebsd.org/changeset/ports/534855

  MFH: r534782

  Fix build with openssl on 12.1-STABLE.

  PR:		246289
  Submitted by:	yds@Necessitu.de

  Approved by:	ports-secteam (joneum)

_U  branches/2020Q2/
Comment 9 Guido Falsi freebsd_committer 2020-05-10 16:52:05 UTC
Committed and merged. Patch also submitted upstream.