Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#13802 closed defect (fixed)

libpcap 0.9.5 fails to compile

Reported by: albatros@… Owned by: ghosthound
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: Cc: opendarwin.org@…, stefmit@…, admin2@…, simon@…
Port:

Description (last modified by jmpalacios (Juan Manuel Palacios))

colin@tigger:/opt/macports-1.6.0/var/macports> sudo port install libpcap
--->  Fetching libpcap
--->  Verifying checksum(s) for libpcap
--->  Extracting libpcap
--->  Applying patches to libpcap
--->  Configuring libpcap
--->  Building libpcap with target all
Error: Target org.macports.build returned: shell command " cd "/opt/macports-1.6.0/var/macports/build/_opt_macports-1.6.0_var_macports_sources_rsync.macports.org_release_ports_net_libpcap/work/libpcap-0.9.5" && make all " returned error 2
Command output: scanner.l:89: unknown error processing section 1
scanner.l:89: bad character: 2
scanner.l:89: bad character: 0
scanner.l:89: bad character: 0
scanner.l:89: bad character: 0
bison -y -p pcap_ -d grammar.y
mv y.tab.c grammar.c
mv y.tab.h tokdefs.h
/usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c scanner.c
/usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -Dyylval=pcap_lval -c grammar.c
sed -e 's/.*/char pcap_version[] = "&";/' ./VERSION > version.c
/usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I.  -DHAVE_CONFIG_H  -D_U_="__attribute__((unused))" -c version.c
ar rc libpcap.a pcap-bpf.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o  scanner.o grammar.o version.o  
ranlib libpcap.a
rm -f libpcap.dylib
/usr/bin/gcc-4.0 -dynamiclib -o libpcap.`cat VERSION`.dylib \
		-install_name /opt/macports-1.6.0/lib/libpcap.0.dylib \
		-compatibility_version 1.0.0 -current_version `cat VERSION` \
		pcap-bpf.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o  scanner.o grammar.o version.o  
Undefined symbols:
  "_lex_init", referenced from:
      _pcap_compile in gencode.o
  "_lex_cleanup", referenced from:
      _pcap_compile in gencode.o
      _pcap_compile in gencode.o
  "_pcap_lex", referenced from:
      _pcap_parse in grammar.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libpcap.dylib] Error 1

Error: Status 1 encountered during processing.
colin@tigger:/opt/macports-1.6.0/var/macports> sudo port version
Version: 1.600
colin@tigger:/opt/macports-1.6.0/var/macports> sudo port info libpcap
libpcap 0.9.5, Revision 1, net/libpcap (Variants: universal, ipv6, no_shared)
http://www.tcpdump.org/

The Packet Capture library provides a high level interface to packet capture systems. All packets on the network, even those destined for other hosts, are accessible through this mechanism.

Platforms: darwin
Maintainers: opendarwin.org@darkart.com
colin@tigger:/opt/macports-1.6.0/var/macports> uname -a
Darwin tigger.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:46:22 PDT 2007; root:xnu-1228.0.2~1/RELEASE_I386 i386
colin@tigger:/opt/macports-1.6.0/var/macports> which flex
/opt/macports-1.6.0/bin/flex
colin@tigger:/opt/macports-1.6.0/var/macports> which bison
/opt/macports-1.6.0/bin/bison
colin@tigger:/opt/macports-1.6.0/var/macports> gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

Attachments (1)

patch-scanner.l.diff (342 bytes) - added by simon@… 17 years ago.
Patch to fix the flex problem with libpcap.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: opendarwin.org@… added
Milestone: Port Bugs
Summary: macports 1.6.0: libpcap 0.9.5 fails to compilelibpcap 0.9.5 fails to compile

Cc maintainer.

comment:2 Changed 17 years ago by ghosthound

Owner: changed from macports-tickets@… to ricci@…

libpcap was just upgraded to 0.9.8, should be available within 12 hours via 'port sync' (or 'port selfupdate'). Compiles fine for me on 10.5.1 x86, please test and re-open the ticket if you still have problems.

comment:3 Changed 17 years ago by ghosthound

Resolution: worksforme
Status: newclosed

comment:4 Changed 17 years ago by albatros@…

Resolution: worksforme
Status: closedreopened

Did the "port selfupdate", but 0.9.8 still fails:

colin@tigger:/opt/macports-1.6.0/var/macports> sudo port install libpcap ---> Fetching libpcap ---> Verifying checksum(s) for libpcap ---> Extracting libpcap ---> Applying patches to libpcap ---> Configuring libpcap ---> Building libpcap with target all Error: Target org.macports.build returned: shell command " cd "/opt/macports-1.6.0/var/macports/build/_opt_macports-1.6.0_var_macports_sources_rsync.macports.org_release_ports_net_libpcap/work/libpcap-0.9.8" && make all " returned error 2 Command output: scanner.l:89: unknown error processing section 1 scanner.l:89: bad character: 2 scanner.l:89: bad character: 0 scanner.l:89: bad character: 0 scanner.l:89: bad character: 0 bison -y -p pcap_ -d grammar.y mv y.tab.c grammar.c mv y.tab.h tokdefs.h /usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I. -DHAVE_CONFIG_H -D_U_="attribute((unused))" -c scanner.c /usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I. -DHAVE_CONFIG_H -D_U_="attribute((unused))" -Dyylval=pcap_lval -c grammar.c sed -e 's/.*/char pcap_version[] = "&";/' ./VERSION > version.c /usr/bin/gcc-4.0 -O2 -fno-common -O2 -I. -dynamic -fno-common -DHAVE_CONFIG_H -I. -DHAVE_CONFIG_H -D_U_="attribute((unused))" -c version.c ar rc libpcap.a pcap-bpf.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o scanner.o grammar.o version.o ranlib libpcap.a rm -f libpcap.dylib /usr/bin/gcc-4.0 -dynamiclib -o libpcap.cat VERSION.dylib \

-install_name /opt/macports-1.6.0/lib/libpcap.0.dylib \ -compatibility_version 1.0.0 -current_version cat VERSION \ pcap-bpf.o fad-getad.o pcap.o inet.o gencode.o optimize.o nametoaddr.o etherent.o savefile.o bpf_filter.o bpf_image.o bpf_dump.o scanner.o grammar.o version.o

Undefined symbols:

"_lex_init", referenced from:

_pcap_compile in gencode.o

"_lex_cleanup", referenced from:

_pcap_compile in gencode.o _pcap_compile in gencode.o

"_pcap_lex", referenced from:

_pcap_parse in grammar.o

ld: symbol(s) not found collect2: ld returned 1 exit status make: * [libpcap.dylib] Error 1

Error: Status 1 encountered during processing.

comment:5 Changed 17 years ago by ghosthound

Okay, time for more information. What OS rev, what hardware (PPC vs x86), etc.? Do you have fink installed? Anything in /usr/local? Any other custom stuff installed?

comment:6 Changed 17 years ago by albatros@…

MacBook Pro, i.e. C2D "Santa Rosa", 2.4 GHz, 4 GB.

10.5.1 (fresh installation of 10.5, then upgrade)

No "weirdies" installed, apart from VMware (which has some kexts), no fink.

MacPorts installed in /opt/macports-1.6.0

There's an ssh in /usr/local, and an streplace.

Seeing that there's a problem with lex: lex is /usr/bin/lex, flex is /opt/macports-1.6.0/bin/flex...

From which place should the undefined symbols be normally picked up?

comment:7 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: stefmit@… added

Stefmit reported the same problem on macports-users.

comment:8 Changed 17 years ago by jmpalacios (Juan Manuel Palacios)

Description: modified (diff)

Please read WikiFormatting to learn how to properly paste Terminal output into tickets, thanks!

-jmpp

comment:9 Changed 17 years ago by albatros@…

Btw, here are lines 84ff from scanner.l, i.e. where the first error occurs (that then seem to trigger the linker errors -- the Makefile doesn't seem to be too bright: it shouldn't attempt to link after such an error in the first place).

%a 18400
%o 21500
%e 7600
%k 4550
%p 27600
%n 2000

And the first lines of error from flex, when running "make" manually.

flex -Ppcap_ -t scanner.l > $$.scanner.c; mv $$.scanner.c scanner.c
scanner.l:84: bad character: %
scanner.l:84: unknown error processing section 1
scanner.l:84: unknown error processing section 1
scanner.l:84: bad character: 1
...

comment:10 Changed 17 years ago by albatros@…

Getting impatient I simply removed the offending lines from scanner.l, which made the compile work, and now I'm running tcpdump and wireshark; who knows whether/when/how it will bite me in the future? ;-)

comment:11 Changed 17 years ago by ghosthound

libpcap appears to fail w/ MP-installed 'flex', works fine with /usr/bin/flex. I'll see if I can convince it to use the system installed flex, in the meantime you can reset your path to have '/usr/bin' before the macports bin directory.

comment:12 Changed 17 years ago by danielluke (Daniel J. Luke)

macports doesn't use the user's path when building stuff (it uses its own sanitized path).

The temporary workaround would be to deactivate flex, build it, and then reactivate flex.

comment:13 Changed 17 years ago by ghosthound

Ha! Lookie that, so it does (use its own path when building). Learn something every day :)

Hmm,for Stefmit - can you try 'sudo port -f -v -d build libpcap'? It builds for me after I deactivate flex.... (on 10.5.1, x86)

comment:14 Changed 17 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: admin2@… added

Noah reported the same problem on macports-users again.

comment:15 Changed 17 years ago by catchmonster@…

deactivating flex and port clean libpcap; port build libpcap; port install libpcap worked for me.

Mac OSX 10.5.1 MacPro intel core 2 duo Regards, --sasha

comment:16 Changed 17 years ago by simon@…

Cc: simon@… added

This is a bug introduced in the last update of flex (2.5.34). See the bug report at the sourceforge page: http://sourceforge.net/tracker/index.php?func=detail&aid=1860773&group_id=97492&atid=618177

As the flex parser ignores the % statements, here is a patch file for libpcap which removes the offending parts.

Simon

Changed 17 years ago by simon@…

Attachment: patch-scanner.l.diff added

Patch to fix the flex problem with libpcap.

comment:17 Changed 17 years ago by ghosthound

Resolution: fixed
Status: reopenedclosed

patch tested with and without MP-installed flex (on leopard x86), libpcap builds either way. patch committed in r34191. Thanks much!

comment:18 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.