Bug 198302 - net/ntopng: Doesn't link with libzmq static library when libzmq is built with PGM/CURVE
Summary: net/ntopng: Doesn't link with libzmq static library when libzmq is built with...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-05 09:40 UTC by daniel.engberg.lists
Modified: 2015-05-22 13:44 UTC (History)
4 users (show)

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


Attachments
Fix ntopng build linking against shared library (2.94 KB, patch)
2015-05-13 18:39 UTC, Renato Botelho
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description daniel.engberg.lists 2015-03-05 09:40:27 UTC
ntopng doesn't build, build error is very similar to the one reported here and trying libzmq4 doesn't fix it.

===>  Building for ntopng-1.2.1_1
gmake[2]: Entering directory '/usr/ports/net/ntopng/work/ntopng-1.2.1'
/usr/bin/clang++  Ntop.o  ParserInterface.o  NdpiStats.o  Categorization.o  EthStats.o  HTTPserver.o  Host.o  Lua.o  ProtoStats.o  NetworkInterface.o  Flow.o  StringHost.o  ActivityStats.o  HTTPBL.o  AlertCounter.o  Utils.o  PcapInterface.o  PF_RINGInterface.o  SimpleStringHost.o  PacketStats.o  GenericHashEntry.o  DnsStats.o  Redis.o  main.o  StringHash.o  PeriodicActivities.o  AddressResolution.o  HostContacts.o  HistoricalInterface.o  Prefs.o  Mutex.o  ExportInterface.o  EppStats.o  IpAddress.o  DB.o  GenericHash.o  RuntimePrefs.o  FlowHash.o  TrafficStats.o  GenericHost.o  Trace.o  Geolocation.o  NtopGlobals.o  CollectorInterface.o  HostHash.o -Wall -L/usr/local/lib -lndpi   -lpcap -L/usr/local/lib -lluajit-5.1   -L/usr/local/lib -lrrd   /usr/local/lib/libzmq.a -L/usr/local/lib -ljson-c    -lsqlite3  -lGeoIP  -fstack-protector -L/usr/local/lib -lrt -lm -lpthread -o ntopng
/usr/local/lib/libzmq.a(libzmq_la-ipc_listener.o): In function `zmq::ipc_listener_t::set_address(char const*)':
ipc_listener.cpp:(.text+0x7d4): warning: warning: tempnam() possibly used unsafely; consider using mkstemp()
/usr/local/lib/libzmq.a(libzmq_la-zmq.o): In function `zmq_ctx_new':
zmq.cpp:(.text+0x58): undefined reference to `pgm_init'
zmq.cpp:(.text+0x79): undefined reference to `pgm_error_free'
/usr/local/lib/libzmq.a(libzmq_la-zmq.o): In function `zmq_ctx_destroy':
zmq.cpp:(.text+0x198): undefined reference to `pgm_shutdown'
/usr/local/lib/libzmq.a(libzmq_la-socket_base.o): In function `zmq::socket_base_t::connect(char const*)':
socket_base.cpp:(.text+0x1bcf): undefined reference to `pgm_freeaddrinfo'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::init_address(char const*, pgm_addrinfo_t**, unsigned short*)':
pgm_socket.cpp:(.text+0x1d0): undefined reference to `pgm_getaddrinfo'
pgm_socket.cpp:(.text+0x226): undefined reference to `pgm_error_free'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::init(bool, char const*)':
pgm_socket.cpp:(.text+0x34c): undefined reference to `pgm_socket'
pgm_socket.cpp:(.text+0x3d3): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x3f7): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x40d): undefined reference to `pgm_socket'
pgm_socket.cpp:(.text+0x49b): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x4cd): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x4f8): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x59e): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x5c2): undefined reference to `pgm_setsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o):pgm_socket.cpp:(.text+0x5e6): more undefined references to `pgm_setsockopt' follow
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::init(bool, char const*)':
pgm_socket.cpp:(.text+0x8a7): undefined reference to `pgm_gsi_create_from_data'
pgm_socket.cpp:(.text+0x91c): undefined reference to `pgm_bind3'
pgm_socket.cpp:(.text+0x9af): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x9de): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0x9ef): undefined reference to `pgm_freeaddrinfo'
pgm_socket.cpp:(.text+0xa20): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0xa54): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0xa8b): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0xab4): undefined reference to `pgm_setsockopt'
pgm_socket.cpp:(.text+0xac8): undefined reference to `pgm_connect'
pgm_socket.cpp:(.text+0xc12): undefined reference to `pgm_close'
pgm_socket.cpp:(.text+0xc27): undefined reference to `pgm_freeaddrinfo'
pgm_socket.cpp:(.text+0xc3d): undefined reference to `pgm_error_free'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::get_max_tsdu_size()':
pgm_socket.cpp:(.text+0xd4c): undefined reference to `pgm_getsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::~pgm_socket_t()':
pgm_socket.cpp:(.text+0xdff): undefined reference to `pgm_close'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::get_receiver_fds(int*, int*)':
pgm_socket.cpp:(.text+0xf0d): undefined reference to `pgm_getsockopt'
pgm_socket.cpp:(.text+0xf3f): undefined reference to `pgm_getsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::get_sender_fds(int*, int*, int*, int*)':
pgm_socket.cpp:(.text+0x10ee): undefined reference to `pgm_getsockopt'
pgm_socket.cpp:(.text+0x1121): undefined reference to `pgm_getsockopt'
pgm_socket.cpp:(.text+0x1154): undefined reference to `pgm_getsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o):pgm_socket.cpp:(.text+0x1187): more undefined references to `pgm_getsockopt' follow
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::send(unsigned char*, unsigned long)':
pgm_socket.cpp:(.text+0x1430): undefined reference to `pgm_send'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::get_rx_timeout()':
pgm_socket.cpp:(.text+0x1563): undefined reference to `pgm_getsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::get_tx_timeout()':
pgm_socket.cpp:(.text+0x1602): undefined reference to `pgm_getsockopt'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::receive(void**, pgm_tsi_t const**)':
pgm_socket.cpp:(.text+0x1722): undefined reference to `pgm_recvmsgv'
pgm_socket.cpp:(.text+0x178e): undefined reference to `pgm_free'
/usr/local/lib/libzmq.a(libzmq_la-pgm_socket.o): In function `zmq::pgm_socket_t::process_upstream()':
pgm_socket.cpp:(.text+0x1b2a): undefined reference to `pgm_recvmsgv'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:79: recipe for target 'ntopng' failed
gmake[2]: *** [ntopng] Error 1
gmake[2]: Leaving directory '/usr/ports/net/ntopng/work/ntopng-1.2.1'
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net/ntopng
*** Error code 1

Stop.
make: stopped in /usr/ports/net/ntopng

FreeBSD 11.0-CURRENT #0 r278472: Sat Feb 14 08:59:31 CET 2015 (AMD64)
Ports tree is updated around the same time

Best regards,
Daniel
Comment 1 daniel.engberg.lists 2015-03-05 09:41:38 UTC
Forgot to refer to the old build error report. Sorry!
https://lists.freebsd.org/pipermail/freebsd-ports/2014-November/096465.html
Comment 2 daniel.engberg.lists 2015-03-05 14:51:24 UTC
...and apparently it also fails on the FreeBSD building cluster too
http://beefy2.isc.freebsd.org/build.html?mastername=head-amd64-default&build=2015-02-27_04h51m50s

Ignored ports --> ntopng
"is marked as broken: Fails to link"

Best regards,
Daniel
Comment 3 daniel.engberg.lists 2015-03-05 17:38:35 UTC
Builds (and works) with libzmq4 if you disable CURVE and PGM
Comment 4 Muhammad Moinur Rahman freebsd_committer 2015-03-05 20:07:47 UTC
Hi Koobs,

I need to create slave port for either net/libzmq[3|4]. ntopng breaks due to the default options of PGM and CURVE. If I disable it works fine. In previous when it was added in libzmq4 I down shifted to libzmq3. But as it was added in libzmq3 too now I have nowhere to run. There are two options:
1. I add a slave port removing the default options.
2. You remove the CURVE and PGM and create another slave ports with those options enabled.

As more experienced I am looking forward for your advice.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2015-03-06 01:17:30 UTC
Hmm, not a good position to be in.

If a fix for ntopng with libzmq including PGM/CURVE is non-trivial (though this is preferable), then I agree on creating a libzmq4-lite slave port of libzmqX, where X is the latest version ntopng works with (ideally the latest stable), that has no OPTIONS enabled by default Feel free to be MAINTAINER for it. Don't forget CONFLICTS

Longer term however, I would be reporting the issue upstream (if it exists and is maintained), and getting them to fix it. I imagine:

a) most people want the security features that come with libzmq
b) libzmq4-lite will need to CONFLICT with the libzmq4, which may/will cause issues for users that have software that already depends on it.
Comment 6 Renato Botelho freebsd_committer 2015-05-13 18:39:15 UTC
Created attachment 156755 [details]
Fix ntopng build linking against shared library

It links fine with zmq shared library instead of static one. Probably libzmq.a is the culprit. I did a patch that force it to use shared zmq library and build as expected.

Sponsored by: Netgate
Comment 7 commit-hook freebsd_committer 2015-05-14 09:09:15 UTC
A commit references this bug:

Author: bofh
Date: Thu May 14 09:08:22 UTC 2015
New revision: 386306
URL: https://svnweb.freebsd.org/changeset/ports/386306

Log:
  net/ntopng: Unbreak

  - ntopng broke due to linking with libzmq static library when built with
    PGM/CURVE

  PR:		198302
  Submitted by:	daniel.engberg.lists@pyret.net
  Sponsored by:	Netgate

Changes:
  head/net/ntopng/Makefile
  head/net/ntopng/files/patch-Makefile.in