Discussion:
AW: Net SNMP Application Development using Eclipse
Michael Jäger
2010-09-27 12:28:23 UTC
Permalink
I downloaded a net-snmp-5.5.zip and extracted it in a msys folder.



When following the introduction on the net-snmp page I get confused.

Configure net-snmp using the configure flags as shown:



BASEDIR=c:/usr



./configure --prefix="$BASEDIR" \

--with-mibdirs="$BASEDIR/share/snmp/mibs" \

--with-mib-modules="agentx disman/event-mib examples/example" \

--disable-embedded-perl --without-perl-modules \





Do I have to configure the net-snmp.zip content or do I have to configure
the installed “stuff” on windows, since I’m assigning my windows netsnmp
installation folder to BASEDIR.

Nevertheless, when configuring I’m getting and error which makes following
“make” not possible:



checking for nlist in -lelf...no

checking for library containing socket... no

configure: error: socket(2) not found.



Sorry for bothering you Bart, but I’m pretty clueless about those things.



Cheers and regards

Michael



Von: ***@gmail.com [mailto:***@gmail.com] Im Auftrag
von Bart Van Assche
Gesendet: Montag, 27. September 2010 12:46
An: Michael Jäger
Betreff: Re: Net SNMP Application Development using Eclipse



On Mon, Sep 27, 2010 at 12:40 PM, Michael Jäger <***@hs-owl.de>
wrote:

Hello Bart,



thank you for your fast reply.



Can you tell me how to change the MSCV header to the Unix header? I’m not
sure how to recognize that it is that kind of error, but I’m not familiar
with eclipse.



I only have one net-snmp-config.h files on my pc. It is located in

C:\Net-SNMP\usr\include





Could you tell me a little bit more please?




Hello Michael,

You should remove the currently installed Net-SNMP headers, download the
appropriate Net-SNMP source tar archive, open a MinGW/MSYS shell, extract
the Net-SNMP tar archive, configure it (./configure ...), build and install
it (make && make install). Then you will have MinGW-compatible Net-SNMP
headers available in the location that was specified via --prefix=...

Please send further questions to the Net-SNMP coders list such that the
other Net-SNMP maintainers also can have a look at them.

Bart.
Bart Van Assche
2010-09-27 15:25:07 UTC
Permalink
Post by Michael Jäger
I downloaded a net-snmp-5.5.zip and extracted it in a msys folder.
When following the introduction on the net-snmp page I get confused.
BASEDIR=c:/usr
./configure --prefix="$BASEDIR" \
--with-mibdirs="$BASEDIR/share/snmp/mibs" \
--with-mib-modules="agentx disman/event-mib examples/example" \
--disable-embedded-perl --without-perl-modules \
Do I have to configure the net-snmp.zip content or do I have to configure
the installed “stuff” on windows, since I’m assigning my windows netsnmp
installation folder to BASEDIR.
Nevertheless, when configuring I’m getting and error which makes following
checking for nlist in -lelf...no
checking for library containing socket... no
configure: error: socket(2) not found.
Please try Net-SNMP 5.6.pre3. If you get the same issue with Net-SNMP
5.6.pre3, there is an issue with your MinGW setup.

Bart.
Wes Hardaker
2010-09-27 21:03:57 UTC
Permalink
(he actually meant "net-snmp-5.6.rc3")
^^^

(not pre3)
--
Wes Hardaker
Please mail all replies to net-snmp-***@lists.sourceforge.net
Michael Jäger
2010-09-28 07:44:57 UTC
Permalink
I compiled and "made" the net-snmp libraries from version 5.6-rc3.

When I set up a new project in eclipse and compile my application the following error occurs. I made no specific adjustments regarding including libraries or something like that in eclipse.
The #include statements are not marked as an error.

**** Internal Builder is used for build ****
gcc -oSNMPWin.exe MIBExtraction.o
MIBExtraction.o: In function `main':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:31: undefined reference to `init_snmp'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:34: undefined reference to `snmp_sess_init'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:39: undefined reference to `snmp_open'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:43: undefined reference to `snmp_perror'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:44: undefined reference to `snmp_log'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:96: undefined reference to `snmp_close'
MIBExtraction.o: In function `macAddrReq':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:137: undefined reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:138: undefined reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:139: undefined reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:141: undefined reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:145: undefined reference to `print_value'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:157: undefined reference to `snmp_free_pdu'
MIBExtraction.o: In function `getBulkTest':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:169: undefined reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:170: undefined reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:171: undefined reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:172: undefined reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:176: undefined reference to `snmp_free_pdu'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 290 ms.


It seems to be the same error as before? I don't know. When I press right click -> open declaration on function of the net-snmp library I am redirected to the respective header file, thus I am wondering why
such an error occurs .


Cheers and regards
Michael

-----UrsprÃŒngliche Nachricht-----
Von: Wes Hardaker [mailto:***@users.sourceforge.net]
Gesendet: Montag, 27. September 2010 23:04
An: Bart Van Assche
Cc: Michael JÀger; net-snmp-***@lists.sourceforge.net
Betreff: Re: Net SNMP Application Development using Eclipse


(he actually meant "net-snmp-5.6.rc3")
^^^

(not pre3)
--
Wes Hardaker
Please mail all replies to net-snmp-***@lists.sourceforge.net
Bart Van Assche
2010-09-28 18:02:51 UTC
Permalink
Post by Michael Jäger
I compiled and "made" the net-snmp libraries from version 5.6-rc3.
When I set up a new project in eclipse and compile my application the
following error occurs. I made no specific adjustments regarding including
libraries or something like that in eclipse.
The #include statements are not marked as an error.
**** Internal Builder is used for build ****
gcc -oSNMPWin.exe MIBExtraction.o
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:31: undefined
reference to `init_snmp'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:34: undefined
reference to `snmp_sess_init'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:39: undefined
reference to `snmp_open'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:43: undefined
reference to `snmp_perror'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:44: undefined
reference to `snmp_log'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:96: undefined
reference to `snmp_close'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:137: undefined
reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:138: undefined
reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:139: undefined
reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:141: undefined
reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:145: undefined
reference to `print_value'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:157: undefined
reference to `snmp_free_pdu'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:169: undefined
reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:170: undefined
reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:171: undefined
reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:172: undefined
reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:176: undefined
reference to `snmp_free_pdu'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 290 ms.
It seems to be the same error as before? I don't know. When I press right
click -> open declaration on function of the net-snmp library I am
redirected to the respective header file, thus I am wondering why
such an error occurs .
It's not really the same. All the functions listed above are defined in the
Net-SNMP library. If you want to use functions from that library, you have
to tell your compilation environment that it has to link against that
library.

Bart.
Michael Jäger
2010-09-29 06:47:08 UTC
Permalink
Von: Michael Jäger [mailto:***@hs-owl.de]
Gesendet: Mittwoch, 29. September 2010 08:18
An: 'Bart Van Assche'
Betreff: AW: Net SNMP Application Development using Eclipse



Hi Barth,



Thx for your reply. I added some linker entries like shown in the following
picture:



Loading Image...



Right now I’m getting another error L





**** Build of configuration Debug for project SNMPWin ****



**** Internal Builder is used for build ****

gcc -LC:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp\library
-LC:\msys\1.0\home\MJaeger\net-snmp\include
-LC:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp -oSNMPWin.exe
MIBExtraction.o C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp\library
C:\msys\1.0\home\MJaeger\net-snmp\include
C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp

c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: cannot
find C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp\library: Permission
denied

c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: cannot
find C:\msys\1.0\home\MJaeger\net-snmp\include: Permission denied

c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: cannot
find C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp: Permission denied

collect2: ld returned 1 exit status

Build error occurred, build is stopped

Time consumed: 295 ms.





Googleing for this error didn’t bring me any further because they told
something about make files, but I think that eclipse takes care of this on
its own.



Maybe you have an idea about this. Sorry again for inconvenience.



Cheers and regards

Michael



Von: ***@gmail.com [mailto:***@gmail.com] Im Auftrag
von Bart Van Assche
Gesendet: Dienstag, 28. September 2010 20:03
An: Michael Jäger
Cc: Wes Hardaker; net-snmp-***@lists.sourceforge.net
Betreff: Re: Net SNMP Application Development using Eclipse



On Tue, Sep 28, 2010 at 9:44 AM, Michael Jäger <***@hs-owl.de>
wrote:

I compiled and "made" the net-snmp libraries from version 5.6-rc3.

When I set up a new project in eclipse and compile my application the
following error occurs. I made no specific adjustments regarding including
libraries or something like that in eclipse.
The #include statements are not marked as an error.


**** Internal Builder is used for build ****

gcc -oSNMPWin.exe MIBExtraction.o
MIBExtraction.o: In function `main':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:31: undefined
reference to `init_snmp'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:34: undefined
reference to `snmp_sess_init'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:39: undefined
reference to `snmp_open'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:43: undefined
reference to `snmp_perror'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:44: undefined
reference to `snmp_log'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:96: undefined
reference to `snmp_close'
MIBExtraction.o: In function `macAddrReq':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:137: undefined
reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:138: undefined
reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:139: undefined
reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:141: undefined
reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:145: undefined
reference to `print_value'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:157: undefined
reference to `snmp_free_pdu'
MIBExtraction.o: In function `getBulkTest':
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:169: undefined
reference to `snmp_pdu_create'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:170: undefined
reference to `read_objid'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:171: undefined
reference to `snmp_add_null_var'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:172: undefined
reference to `snmp_synch_response'
C:\Eclipse_CDT_Workspace\SNMPWin\Debug/../MIBExtraction.c:176: undefined
reference to `snmp_free_pdu'
collect2: ld returned 1 exit status

Build error occurred, build is stopped

Time consumed: 290 ms.


It seems to be the same error as before? I don't know. When I press right
click -> open declaration on function of the net-snmp library I am
redirected to the respective header file, thus I am wondering why
such an error occurs .


It's not really the same. All the functions listed above are defined in the
Net-SNMP library. If you want to use functions from that library, you have
to tell your compilation environment that it has to link against that
library.

Bart.
Bart Van Assche
2010-09-29 10:24:22 UTC
Permalink
*Gesendet:* Mittwoch, 29. September 2010 08:18
*An:* 'Bart Van Assche'
*Betreff:* AW: Net SNMP Application Development using Eclipse
Hi Barth,
Thx for your reply. I added some linker entries like shown in the following
http://img15.imageshack.us/img15/3135/linkerentries.png
Right now I’m getting another error L
**** Build of configuration Debug for project SNMPWin ****
**** Internal Builder is used for build ****
gcc -LC:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp\library
-LC:\msys\1.0\home\MJaeger\net-snmp\include
-LC:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp -oSNMPWin.exe
MIBExtraction.o C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp\library
C:\msys\1.0\home\MJaeger\net-snmp\include
C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp
Permission denied
cannot find C:\msys\1.0\home\MJaeger\net-snmp\include: Permission denied
cannot find C:\msys\1.0\home\MJaeger\net-snmp\include\net-snmp: Permission
denied
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 295 ms.
Googleing for this error didn’t bring me any further because they told
something about make files, but I think that eclipse takes care of this on
its own.
Maybe you have an idea about this. Sorry again for inconvenience.
I see two errors:
- You must use forward slashes in MinGW / MSYS paths instead of backward
slashes.
- The library path is not correct: .../net-snmp/include/... contains header
files, not libraries.

Bart.

Loading...