# Cannot install ntop from ports (9.1)



## selfish (Jan 16, 2013)

Good evening everybody, first post here.  

I set up a minimal install a few weeks ago to be my new home firewall.  Everything is working well with pf and bridging, everything is upgraded as much as possible with freebsd-update and portsnap.

I decided it was time to monitor my traffic so ntop should fit the bill.  After a day of compiling all the dependencies it fails.  My keen detective skills make me think it's somehow related to Python, but I don't know where to start looking.  Is this a Python version mismatch?


```
/usr/local/include/pth/pthread.h:532:1: warning: this is the location of the previous definition
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:575:1: warning: "send" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:533:1: warning: this is the location of the previous definition
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:576:1: warning: "recvfrom" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:534:1: warning: this is the location of the previous definition
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:577:1: warning: "sendto" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:535:1: warning: this is the location of the previous definition
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:578:1: warning: "pread" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:536:1: warning: this is the location of the previous definition
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:579:1: warning: "pwrite" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:537:1: warning: this is the location of the previous definition
In file included from ntop.h:523,
                 from globals-core.c:26:
globals-core.h:900:1: warning: "sleep" redefined
In file included from /usr/local/include/python2.7/Python.h:166,
                 from ntop.h:485,
                 from globals-core.c:26:
/usr/local/include/pth/pth.h:562:1: warning: this is the location of the previous definition
gmake[2]: *** [globals-core.lo] Error 1
gmake[2]: Leaving directory `/usr/ports/net/ntop/work/ntop-5.0.1'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/ports/net/ntop/work/ntop-5.0.1'
gmake: *** [all] Error 2
*** [do-build] Error code 1

Stop in /usr/ports/net/ntop.
*** [install] Error code 1

Stop in /usr/ports/net/ntop.
root@fw:/usr/ports/net/ntop #
```


Thanks for looking.


----------



## SirDice (Jan 16, 2013)

Try and rebuild lang/python27 and enable PTH. See if that solves it.


----------



## selfish (Jan 16, 2013)

Nope, didn't change anything.  I ran this to do the rebuild:

`portmaster -fR --force-config lang/python27`

PTH was already selected, and I didn't change any config options on the dependencies.  Still getting the same error:


```
warning: this is the location of the previous definition
```


----------



## cpm@ (Jan 16, 2013)

Please, show entirely the log of failed build process, use pastebin.com and paste the URL here.


----------



## selfish (Jan 17, 2013)

Here is the entire log from:

`portmaster -H net/ntop`

http://pastebin.com/4Vgvk9yj


----------



## selfish (Jan 17, 2013)

This bit from the log is interesting:


```
**Testing Optional libraries and headers**
 
checking for Multithreading... ok
checking for openSSL... ok
checking for zlib... ok
checking for python-config... /usr/local/bin/python2.7
>>>> Unable to locate python-config: using workaround <<<<
checking for python... (cached) /usr/local/bin/python2.7
checking Checking python version... Python 2.6 or newer is available
```

/usr/local/bin/python2.7-config does exist and has permissions of 555.


----------



## cpm@ (Jan 17, 2013)

About the warning related:

```
/usr/local/include/pth/pth.h:575:1: warning: "send" redefined
In file included from ntop.h:254,
                 from globals-core.c:26:
/usr/local/include/pth/pthread.h:533:1: warning: this is the location of the previous definition
```

The globals-core.c source file includes the header /usr/local/include/pth/pthread.h then includes the header pth.h. Both header files contain a #define send entry in the direction indicated by the warning, the first defined as "send" and subsequent changes to the definition pth_send, and so it is with the others. The warning is just say "Hey you defined this twice different things!". 

Please, show your make.conf

Send a PR for this software bug.


----------



## selfish (Jan 17, 2013)

Sure, it only has two lines, I have never edited it manually:


```
# added by use.perl 2013-01-03 13:16:18
PERL_VERSION=5.14.2
```


----------



## cpm@ (Jan 17, 2013)

Only for checking if works, rebuild lang/python27 without PTH option, then install net/ntop. Later you can reinstall first port with PTH enabled.


----------



## selfish (Jan 18, 2013)

Perfect!  That worked, thanks cpu82.

Just for wrap-up I ran:

`# portmaster -fR --force-config lang/python27`

Deselected PTH but left everything else as default.  Then ran:

`# portmaster net/ntop`

I had to add the new user and rc.conf entries and it looks like everything is working now.


----------



## cpm@ (Jan 18, 2013)

Please, submit a PR to report this bug, now we know that maintainer should remove PTH dependencies or include it as option in port.


----------



## selfish (Jan 18, 2013)

Will do.  I have never done a PR before, so I'm reading the guidelines and such.


----------

