LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-05-2005, 12:16 PM   #1
Varadharajan
LQ Newbie
 
Registered: Apr 2005
Posts: 3

Rep: Reputation: 0
compilation error


Hello everyone,
I have installed libpcap,libnet libraries for ICMP packet generation.While trying to compile the file icmpnum.c ,i am getting the following errors.Can anyone give a solution to rectify
this problem.


[root@core-2-06 root]# gcc 'libnetnet-config --defines' -o icmpenum icmpenum.c -lnet -lpcap

gcc: libnetnet-config --defines: No such file or directory
In file included from icmpenum.c:5:/usr/include/libnet.h:87:2: #error "byte order has not been specified, you'llneed to #define either LIBNET_LIL_ENDIAN or LIBNET_BIG_ENDIAN. See the
documentation regarding the libnet-config script."

thanking you,
S.Varadharajan.
 
Old 05-05-2005, 01:13 PM   #2
pedro.velho
LQ Newbie
 
Registered: Apr 2005
Location: Brazil
Distribution: Slackware 10.1
Posts: 10

Rep: Reputation: 0
Wink

Try libnet instead libnetnet.

Code:
# gcc 'libnetnet-config --defines' -o icmpenum icmpenum.c -lnet -lpcap ==> wrong

# gcc 'libnet-config --defines' -o icmpenum icmpenum.c -lnet -lpcap ==> right
 
Old 05-05-2005, 02:02 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I think you're using the wrong quotation marks. You're using single quotes ( ' ) when I believe you should be using backticks ( ` ). Here's the difference:

The command treats anything inside sigle quotes literally. So your command says to treat 'libnetnet-config --defines' exactly as it appears. So, gcc is expecting to find a file named 'libnetnet-config --defines' (with a space and the dashes as part of its name).

The backticks are treated much differently. The shell interprets anything between backticks as a command. Then, the shell replaces the command with the command's output before executing the remaining item(s).

Try your compile with backticks instead of single quotes. On my keyboard (US layout), the backtick is on the same key as the tilde ( ~ ); near the top-left of the keyboard.
 
Old 02-01-2007, 08:10 PM   #4
hhegab
Member
 
Registered: Apr 2002
Location: IL, USA
Distribution: Fedora 13, Ubuntu 10.04 LTS
Posts: 162

Rep: Reputation: 30
Same Problem

I have this same problem, with the following output:
----
[hatim@D0-Atlas icmpenum-1.1.1]$ gcc `libnet-config --defines` -o icmpenum icmpenum.c -lnet -lpcap
icmpenum.c: In function ‘send_packets’:
icmpenum.c:146: error: ‘LIBNET_IP_H’ undeclared (first use in this function)
icmpenum.c:146: error: (Each undeclared identifier is reported only once
icmpenum.c:146: error: for each function it appears in.)
icmpenum.c:152: error: ‘LIBNET_ERR_FATAL’ undeclared (first use in this function)
icmpenum.c:171: error: ‘LIBNET_ICMP_TS_H’ undeclared (first use in this function)
icmpenum.c:196: warning: passing argument 1 of ‘libnet_do_checksum’ from incompatible pointer type
icmpenum.c:196: warning: passing argument 2 of ‘libnet_do_checksum’ makes pointer from integer without a cast
icmpenum.c:196: error: too few arguments to function ‘libnet_do_checksum’
icmpenum.c:238: error: ‘LIBNET_ERR_WARNING’ undeclared (first use in this function)
icmpenum.c: In function ‘receive_packets_normal’:
icmpenum.c:284: error: dereferencing pointer to incomplete type
icmpenum.c: In function ‘grab_icmp’:
icmpenum.c:321: error: dereferencing pointer to incomplete type
icmpenum.c: In function ‘main’:
icmpenum.c:550: error: ‘LIBNET_ICMP_ECHO_H’ undeclared (first use in this function)
icmpenum.c:554: error: ‘LIBNET_ICMP_TS_H’ undeclared (first use in this function)
[hatim@D0-Atlas icmpenum-1.1.1]$
----

What should I do?

H H
 
Old 02-01-2007, 09:32 PM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Your problem is not with the linking stage, but with the compilation stage. The errors seem to suggest that one (or more) of your files are missing a necessary #include file.
 
Old 02-01-2007, 09:58 PM   #6
hhegab
Member
 
Registered: Apr 2002
Location: IL, USA
Distribution: Fedora 13, Ubuntu 10.04 LTS
Posts: 162

Rep: Reputation: 30
Thanks for the reply,

Have you any idea how may I solve this?
I mean what should I do to have icmpenum compiled?

H H
 
Old 02-01-2007, 10:22 PM   #7
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I can't say with any certainty how to solve it. Without having a copy of the code to examine, all I can say is look at your source code files to make sure you #include all the files that are necessary. All of this should be in either the man pages for the functions in libnet or on some web-based online documentation for libnet.

Some libraries require only #includes.

Some libraries require #includes and #defines.

Some libraries support commands such as "libnet-config --cflags".

You need to read the libnet documentation carefully. It should answer any and all questions you have in using the library properly.

I haven't used libnet before and I can't say what it wants.
 
Old 02-02-2007, 04:53 AM   #8
hhegab
Member
 
Registered: Apr 2002
Location: IL, USA
Distribution: Fedora 13, Ubuntu 10.04 LTS
Posts: 162

Rep: Reputation: 30
Thanks a lot?

H H
 
Old 02-02-2007, 05:20 PM   #9
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
I'm sorry if you feel like my help isn't what you were looking for, but let me point out a few things.

First, Varadharajan's original message identified a problem he was having with a compilation command, and he gave the command he was using. I was able to look at the command he used, saw the problem, and told him how to correct it. You, on the other hand, chose to identify a compilation problem, but provided no source code. Very few people can diagnose a compilation error by looking at only error results--there is simply not enough information.

Second, without code to look at, I cannot possibly fathom what you're trying to use the library for or in what way. Clearly, someone (e.g. Varadharajan) has used libnet to create their own program. The library works and can be used. There many ways that a library setup can be broken. Again, you have chosen only to show the error messages which gives no information to the root cause.

Third, you posted your response in an already existing thread. I have not professed to be a libnet expert of any sort. The original problem was solved because of a syntactical problem Varadharajan had with his command--a shell issue, not a libnet issue. I am not going to download libnet, read its documentation, and then write you a reader's digest version on how to use the library. All that is out there already. You should have read it yourself. And again, without source code, I would be at a loss even if I did do your research for you.

You have posted an error you received. You have given no source code. You haven't indicated anything else you've tried and what results those attempts gave. All things considered, my advice is still legitimate: re-read the documentation to make sure you're doing what you need to use the library properly. Until you give more information, that's the only advice anyone can give.

If you feel I'm being a jerk, feel free start a new thread, post the message you used above, and count the number of replies before someone says to "post the source code".

Last edited by Dark_Helmet; 02-02-2007 at 05:22 PM.
 
Old 02-04-2007, 02:56 AM   #10
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Because I actually am a nice guy, I looked around some more. For anyone that reads this, icmpenum.c appears to be a file provided by Symantec (which no one mentioned previously, leading me to believe these were from-scratch projects). Its purpose, according to the description, is a proof-of-concept utility to map network machines by using ICMP requests. Because it's a proof of concept tool by a security company, I have a hard time believing there's a legitimate use here because network administrators actually interested in testing their networks would probably know how to compile this software easily. Similarly, any university/college where this type of detection would be put to use for research purposes would likely be used by people fully capable of compiling it.

Regardless, on the off-chance that anyone using this utility is not some script-kiddie trying to break into other machines, verify that both required libraries are installed completely on the system - not just compiled in a local, home directory. The compilation error above is likely caused by a failure to find an appropriate header file (or finding the wrong one). If installing required libraries is still too cumbersome, a pre-compiled executable can be found at Packet Storm (something that could have been found by minimal searching - perhaps in looking to find the answer for a compilation problem).

Last edited by Dark_Helmet; 02-04-2007 at 02:59 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel compilation error: Error 15: File not found Niceman2005 Linux - General 9 10-04-2007 04:45 AM
Compilation error DaBlade Linux - Software 13 05-03-2005 04:45 PM
Compilation Error abdullahgee Programming 9 05-21-2004 01:29 AM
Sqwebmail compilation error ... [maildirsearchC.o] Error 1 boogie_maan Linux - Software 0 10-26-2002 08:21 PM
compilation error guppy Linux - Newbie 1 06-15-2001 04:41 AM


All times are GMT -5. The time now is 06:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration