opnsense / ports

OPNsense ports on top of FreeBSD
https://opnsense.org/
Other
163 stars 116 forks source link

Error compiling ntopng #43

Closed mimugmail closed 6 years ago

mimugmail commented 7 years ago

Hi,

I did a

opnsense-code tools ports
cd /usr/ports/net/ntopng
make install

But I get a:

* * * * * * * * * * * * * * * * * * * * * * * *

===>   ntopng-3.0.2017.06.05 depends on shared library: libmysqlclient.so.18 - found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>   Returning to build of ntopng-3.0.2017.06.05
===>   ntopng-3.0.2017.06.05 depends on shared library: libsqlite3.so - found (/usr/local/lib/libsqlite3.so)
===>  Configuring for ntopng-3.0.2017.06.05
===>   FreeBSD 10 autotools fix applied to /usr/obj/usr/ports/net/ntopng/work/ntopng-3de9516/third-party/rrdtool-1.4.8/config.rpath
configure: loading site script /usr/ports/Templates/config.site
checking for gcc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cpp
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking for /usr/local/src/lib/.libs/libndpi.a... not found /usr/local/src/lib/.libs/libndpi.a: compiling
./configure: ./autogen.sh: not found
make[1]: no target to make.

make[1]: stopped in /usr/local
checking for ntopng professional edition... not found
checking for pcap_open_live in -lpcap... no
Please install libpcap(-dev) (http://tcpdump.org)
===>  Building for ntopng-3.0.2017.06.05
gmake[1]: Entering directory '/usr/obj/usr/ports/net/ntopng/work/ntopng-3de9516'
gmake[1]: Makefile: No such file or directory
gmake[1]: *** No rule to make target 'Makefile'.  Stop.
gmake[1]: Leaving directory '/usr/obj/usr/ports/net/ntopng/work/ntopng-3de9516'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/net/ntopng
root@OPNsense:/usr/ports/net/ntopng #

Any idea whats missing?

fichtner commented 7 years ago

devel/libpcap not in the dependencies?

but you won't be able to build ntop, it clashes with the rrdtool version we use.

fichtner commented 7 years ago

https://github.com/opnsense/ports/issues/27

mimugmail commented 7 years ago

@fichtner Wasn't sure whats the current state since you wanted to fix it in 17.1 :)

So there's no chance to build it?

fichtner commented 7 years ago

If you pkg delete -f rrdtool12 you can build it for testing. but rrdtools12 will be grabbed from the opnsense dependencies and flush the whole thing again or prevent upgrades.

mimugmail commented 7 years ago

Ok, and the libpcap dependency has to look like ...? :)

fichtner commented 7 years ago

just cd /usr/ports/devel/libpcap && make install and try again. not sure what's wrong here

fichtner commented 7 years ago

sorry, it's net/libpcap

fichtner commented 7 years ago

PS: don't forget to opnsense-code tools, it has /etc/make.conf modifications you will need.

mimugmail commented 7 years ago

Yep, I did opnsense-code tools ports and fetched make.conf manually?

Now I get:

configure: loading site script /usr/ports/Templates/config.site checking for gcc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cpp checking whether we are using the GNU C++ compiler... yes checking whether c++ accepts -g... yes checking for /usr/local/src/lib/.libs/libndpi.a... not found /usr/local/src/lib/.libs/libndpi.a: compiling ./configure: ./autogen.sh: not found make[1]: no target to make.

make[1]: stopped in /usr/local checking for ntopng professional edition... not found checking for pcap_open_live in -lpcap... no Please install libpcap(-dev) (http://tcpdump.org) ===> Building for ntopng-3.0.2017.06.05 gmake[1]: Entering directory '/usr/obj/usr/ports/net/ntopng/work/ntopng-3de9516' gmake[1]: Makefile: No such file or directory gmake[1]: No rule to make target 'Makefile'. Stop. gmake[1]: Leaving directory '/usr/obj/usr/ports/net/ntopng/work/ntopng-3de9516' ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. Error code 1

Stop. make: stopped in /usr/ports/net/ntopng root@OPNsense:/usr/ports/net/ntopng # ls /usr/local/src/ /usr/local/src/ not found

fichtner commented 7 years ago

wtf, this makes no sense

mimugmail commented 7 years ago

Same error with the latest update. :( Have you read this: https://github.com/ntop/ntopng/blob/dev/doc/README.FreeBSD

Note that you need to edit third-party/LuaJIT-X.Y.Z/src/Makefile and change "CC= gcc" into "CC= cc" prior to start the compilation.

mveplus commented 6 years ago

@fichtner is there any workaround ntopng dependency on rrdtool-1.7.0_1.txz and OPNsesne depends on rrdtool12-1.2.30_7.txz?

I have tried to compile it from source or install the ntopng from FreeBSD 11 repo and always hit this dependency issue. If I remove rrdtool12-1.2.30_7.txz and OPNsense 18.x pkg and install rrdtool-1.7 I'm able to compile successfully and as far as I've tested ntopng it works fine.

Run in chroot? or it needs to be fixed by ntopng developers to use rrdtool12 instead?

Kind regards,

fichtner commented 6 years ago

Since rrdtool12 is a core dependency there is no easy fix here. We need to upgrade rrdtool to unbreak this. I need to look into it and write a migration script for the database... It's a low value- high risk core target so that's why it's not done yet... :/

dedman commented 6 years ago

Hey did anyone ever resolve this? We are in a low bandwidth situation, and ntopng looks like it is much nicer for historical bandwidth monitoring than bandwidthd and darkstat.

fichtner commented 6 years ago

More or less still #27

fichtner commented 6 years ago

FYI ceacd490b9bd

mimugmail commented 6 years ago

But we still need newer rrd?

fichtner commented 6 years ago

Yes, 18.7 https://github.com/opnsense/core/commit/be8d1271

mimugmail commented 6 years ago

What a beautiful life :) Thanks

mimugmail commented 6 years ago

Ntopng plugin is on me :D

tusc commented 6 years ago

I just compiled ntopng 3.4 using the command at the top of this thread on 18.1.11. I had to enabled redis as a plugin in order for ntopng to start. Would it be possible to renable ntop as an option as a precomipled package for 18.1? Thanks.

fichtner commented 6 years ago

@tusc ntop or ntopng ?

tusc commented 6 years ago

@fichtner ntopng

root@OPNsense:/usr/ports/net/ntopng # cat distinfo TIMESTAMP = 1528128970 SHA256 (ntop-ntopng-3.4.d20180604-468d1eb_GH0.tar.gz) = b021d7d97c2215997559bc164efca801ea889f00247ea3a16f3decf6bb2587d2 SIZE (ntop-ntopng-3.4.d20180604-468d1eb_GH0.tar.gz) = 30715124 root@OPNsense:/usr/ports/net/ntopng # make package root@OPNsense:/usr/ports/net/ntopng # ls -la /usr/obj/usr/ports/net/ntopng/work/pkg/ntopng-3.4.d20180604,1.txz -rw-r--r-- 1 root wheel 3830240 Jul 10 13:57 /usr/obj/usr/ports/net/ntopng/work/pkg/ntopng-3.4.d20180604,1.txz

tusc commented 6 years ago

Looks like there are some dependencies:

root@OPNsense:~ # pkg add -M -f ntopng-3.4.d20180604,1.txz Installing ntopng-3.4.d20180604,1... pkg: Missing dependency 'json-c' pkg: Missing dependency 'libsodium' pkg: Missing dependency 'libzmq4' pkg: Missing dependency 'mysql56-client' pkg: Missing dependency 'ndpi' ===> Creating groups. Creating group 'ntopng' with gid '288'. ===> Creating users Creating user 'ntopng' with uid '288'. Extracting ntopng-3.4.d20180604,1: 100% Message from ntopng-3.4.d20180604,1:


WARNING:

ntopng runs a web interface service by default, it is suggested to protect such network accessible services with packet filters or TCP wrappers.

ntopng requires to connect to a redis server to work. Please install redis server from databases/redis or use -r option via ntopng_flags to specify a remote one.

If you enabled GeoIP support(the default), please use ntopng-geoipupdate.sh to update GeoIP database to the latest available data.

To pass a configuration file to ntopng, which overrides any command line arguments, add something like the following to rc.conf:

ntopng_flags="/path/to/file.conf"

fichtner commented 6 years ago

ntopng will be available in 18.7.1, there is no point to add it before

zhouska commented 6 years ago

How long before we can avail of it? I see it in the GitHub repo, but not on my device...

ntopng will be available in 18.7.1, there is no point to add it before

mimugmail commented 6 years ago

pkg install ntopng

dedman commented 6 years ago

Hey guys, firstly thanks for adding the ntopng port, its really nice. I eventually got it to run by manually running commands and manually starting redis. However I'm not overly familiar with FreeBSD, can anyone list the instructions on how to get it to start automatically?

fichtner commented 6 years ago

There's a GUI plugin under development. Once on OPNsense 18.7.3 (to be released tomorrow) install it from the command line:

# pkg install os-ntopng-devel os-redis

Enable Service: Redis and then follow the menu to Services: Ntopng.

Cheers, Franco

dedman commented 6 years ago

Hey Franco, thanks very much. I can see it in the services menu now. I tried enabling redis and ntopng and restarted, and redis started fine, but ntopng didn't start up again. I watched opnsense startup in the hyperv console and I'm pretty sure I saw an error saying ntopng couldn't start because redis wasn't started yet. Is there anyway to change the order of starting so that redis starts first?

Thanks, even if the automatic start up doesn't work, having ntopng in the UI is such a massive improvement for those of us trying to deal with low/expensive bandwidth situations!

fichtner commented 6 years ago

Hi Andrew, nice catch, I will propose a fix for the race condition.

dedman commented 6 years ago

18.7.4 fixes the race condition on restart for me. Thanks @fichtner!

commandline-be commented 6 years ago

Working with latest production 18.x release as of today NtopNG throws

Oct 23 16:04:12 ntopng: [Utils.cpp:2895] WARNING: Network discovery and other privileged activities will fail
Oct 23 16:04:12 ntopng: [Utils.cpp:2894] WARNING: ntopng has not been compiled with libcap-dev

not sure why this happens, seems like the package or installation process is broken