Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with PF_RING support #10

Closed
GoogleCodeExporter opened this issue Mar 16, 2015 · 5 comments
Closed

Can't compile with PF_RING support #10

GoogleCodeExporter opened this issue Mar 16, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Install PF_RING using this manual on Debian 7 Wheezy: 
http://www.stableit.ru/2014/06/pfring-debian-7-wheezy.html
2. cp /opt/pf_ring/include/pfring.h /usr/include/; cp /opt/pf_ring/lib/* 
/usr/lib/
3. go get "code.google.com/p/gopacket/pfring" 

What is the expected output?
Compiled tool

What do you see instead?
 go get "code.google.com/p/gopacket/pfring"
# code.google.com/p/gopacket/pfring
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `numa_node_of_cpu'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `clock_gettime'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `numa_bind'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `numa_parse_nodestring'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `numa_available'

After this I added numa to linker config in 
/usr/share/go/src/pkg/code.google.com/p/gopacket/pfring/pfring.go and got new 
error:
go get "code.google.com/p/gopacket/pfring" 
/# code.google.com/p/gopacket/pfring
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libpfring.so: undefined 
reference to `clock_gettime'
collect2: error: ld returned 1 exit status

For solve this I added 'rt' to linker config and tool builded successfully.

All compiles correctly with this flags:
#cgo LDFLAGS: -lpfring -lpcap -lnuma -lrt

Please fix it! 

What version of the product are you using? On what operating system?
go version go1.0.2




Original issue reported on code.google.com by pavel.odintsov on 12 Jun 2014 at 5:29

@GoogleCodeExporter
Copy link
Author

And you can remove pcap because it optional for PF_RING in native mode.

Original comment by pavel.odintsov on 14 Jun 2014 at 6:59

@GoogleCodeExporter
Copy link
Author

Are you able to compile a C/C++ binary that uses PF_RING with your current 
setup?

These errors look like they may be related to a broken install of pfring, just 
want to make sure we check that out.

Original comment by gconnell@google.com on 16 Jun 2014 at 4:46

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Hello!

I created simple  programm for checking PF_RING compilation: 
https://gist.github.com/pavel-odintsov/62f372c882c83d85ed17

And tried to compile it with same results:
gcc test_pf_ring.c  -lpfring -lpcap
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `clock_gettime'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `numa_parse_nodestring'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `numa_node_of_cpu'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `numa_available'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `numa_bind'


Problem was fixed in same way (I added -lnuma -lrt):
gcc test_pf_ring.c -lpfring -lpcap -lnuma
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libpfring.so: 
undefined reference to `clock_gettime'

All compiles fine with this code: gcc test_pf_ring.c -lpfring -lpcap -lnuma -lrt

Original comment by pavel.odintsov on 16 Jun 2014 at 5:15

@GoogleCodeExporter
Copy link
Author

I suppose this issue related with my pf_ring compilation flags, I used non 
standard option --disable-bpf for disabling linking to pcap because it's 
obsolete. Without this flag all works pretty well but only on modern pcap 
library version. 

I think you can close this issue because my compilation flags is non standard. 

Original comment by pavel.odintsov on 16 Jun 2014 at 7:44

@GoogleCodeExporter
Copy link
Author

Thanks for the heads-up!

I'll add a comment in pfring.go so others with the same issues can find out 
what's going on.  Just to be clear, the addition of -lnuma and -lrt are 
necessary if using --disable-bpf with pfring?

Original comment by gconnell@google.com on 16 Jun 2014 at 7:53

  • Changed state: Fixed

prskr pushed a commit to prskr/google-gopacket that referenced this issue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant