Mtr

Cannot compile on Mac OSX 10.8.3

Bug #1160321 reported by Derek Balling
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mtr
New
Undecided
Unassigned

Bug Description

$ make
make all-recursive
Making all in img
make[2]: Nothing to be done for `all'.
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -Wno-pointer-sign -MT mtr.o -MD -MP -MF .deps/mtr.Tpo -c -o mtr.o mtr.c
In file included from mtr.c:37:
asn.h:19:18: error: glib.h: No such file or directory
In file included from mtr.c:37:
asn.h:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
make[2]: *** [mtr.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Revision history for this message
Derek Balling (dredd) wrote :
Revision history for this message
richb-hanover (richb-hanover) wrote :

Additional info:

1) I found a link to a built 0.82 version at: https://support.eapps.com/index.php?/Knowledgebase/Article/View/442/28/mtr-for-mac-os-x

2) I found this article with a potential fix. http://blog.justus-beyer.de/2012/11/installing-my-traceroute-mtr-on-mac-os-x-mountain-lion/

Using this technique still gives an error:

bash-3.2$ make
make all-recursive
Making all in img
make[2]: Nothing to be done for `all'.
gcc -DHAVE_CONFIG_H -I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I. -g -O2 -Wall -Wno-pointer-sign -MT mtr.o -MD -MP -MF .deps/mtr.Tpo -c -o mtr.o mtr.c
mv -f .deps/mtr.Tpo .deps/mtr.Po
gcc -DHAVE_CONFIG_H -I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I. -g -O2 -Wall -Wno-pointer-sign -MT asn.o -MD -MP -MF .deps/asn.Tpo -c -o asn.o asn.c
asn.c: In function ‘asn_lookup’:
asn.c:46: error: ‘PACKETSZ’ undeclared (first use in this function)
asn.c:46: error: (Each undeclared identifier is reported only once
asn.c:46: error: for each function it appears in.)
asn.c:58: error: ‘C_IN’ undeclared (first use in this function)
asn.c:58: error: ‘T_TXT’ undeclared (first use in this function)
asn.c:62: error: ‘HEADER’ undeclared (first use in this function)
asn.c:70: warning: implicit declaration of function ‘GETSHORT’
asn.c:75: error: ‘INT16SZ’ undeclared (first use in this function)
asn.c:46: warning: unused variable ‘answer’
make[2]: *** [asn.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
bash-3.2$ ls

Revision history for this message
Derek Balling (dredd) wrote : Re: [Bug 1160321] Cannot compile on Mac OSX 10.8.3

On Mar 28, 2013, at 6:50 AM, richb-hanover <email address hidden> wrote:

> Additional info:
>
> 1) I found a link to a built 0.82 version at:
> https://support.eapps.com/index.php?/Knowledgebase/Article/View/442/28
> /mtr-for-mac-os-x

Yeah, that's what I ended up doing, but I want to start contributing useful feedback and maybe even small patches, but I can't do that if I can't even get it to compile initially. :)

> 2) I found this article with a potential fix. http://blog.justus-
> beyer.de/2012/11/installing-my-traceroute-mtr-on-mac-os-x-mountain-lion/
>
> Using this technique still gives an error:

If I go the route of THOSE instructions, I don't even get that far:

[.. configure configure configure ..]
checking for floor in -lm... yes
checking for pkg-config... no
checking for GLIB... no
configure: error: in `/Users/derek.balling/Downloads/mtr-0.84':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables GLIB_CFLAGS
and GLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
$

Revision history for this message
Antonio Querubin (aaq) wrote :

Try this patch.

Revision history for this message
Derek Balling (dredd) wrote :

Antonio:

In my default scenario, that makes no change.

In my "revised" scenario, I still don't get past the configure as it is missing pkg-config (so the error says).

Revision history for this message
Pablo Fritz (pablo-a) wrote :

Hi, I solved the puzzle. I have several ways to make this.

1.- the preferred one:
./configure --prefix=/usr --without-gtk
export DEFS="-DHAVE_CONFIG_H -DHAVE_ARPA_NAMESER_COMPAT_H"
make --environment-overrides
sudo make install

2.- manually editing:
the problem are these lines in asn.c:
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif

to include arpa/nameser_compat.h you need to pass HAVE_ARPA_NAMESER_COMPAT_H to the compiler.

the first way then is to edit asn.c and delete the line before and after the include, so the file is included everytime.
another way is to take the command that gives you an error:
 gcc -DHAVE_CONFIG_H -I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I. -g -O2 -Wall -Wno-pointer-sign -MT asn.o -MD -MP -MF .deps/asn.Tpo -c -o asn.o asn.c
and include manually -DHAVE_ARPA_NAMESER_COMPAT_H like this:
 gcc -DHAVE_CONFIG_H -DHAVE_ARPA_NAMESER_COMPAT_H -I/usr/local/Cellar/glib/2.34.3/include/glib-2.0 -I/usr/local/Cellar/glib/2.34.3/lib/glib-2.0/include -I/usr/local/Cellar/gettext/0.18.1.1/include -I. -g -O2 -Wall -Wno-pointer-sign -MT asn.o -MD -MP -MF .deps/asn.Tpo -c -o asn.o asn.c

I couldn't find a way to directly set HAVE_ARPA_NAMESER_COMPAT_H, so the first commands:
export DEFS="-DHAVE_CONFIG_H -DHAVE_ARPA_NAMESER_COMPAT_H"
make --environment-overrides
change the definition of DEFS, from the current DEFS="-DHAVE_CONFIG_H" to this command. If the default for DEFS changes, the commands have to change.

Revision history for this message
Derek Balling (dredd) wrote : Re: [Bug 1160321] Re: Cannot compile on Mac OSX 10.8.3

This still fails for me at the configure stage here:

<cut>
checking for GLIB... no
configure: error: in `/Users/derek.balling/src/mtr-0.85':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables GLIB_CFLAGS
and GLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
</cut>

Revision history for this message
yvs (lrou2014) wrote :

This is probably fixed 6 months ago with commit:25a2456 (glib dependency fixes.):
https://github.com/traviscross/mtr/commit/25a2456845b341066adb5f9fcc553dec12a751b7

Please try the latest version:
https://github.com/traviscross/mtr/tarball/99dbe3f/mtr-99dbe3f.tar.gz

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.