Long story short: i was working on a SNMP client on Qt, talking with a Cisco Access Point. I’ve already a Qt software, so i decided to add the Net-SNMP library to my project.
These are the steps to achieve the result:
- Download the Net-SNMP library
- Extract it wherever you want
- Download MSYS and install it
- Run MSYS, you will have a bash shell
- Now, locate the mingw compiler on Qt (see the image below)
- On the MSYS bash type these commands:
- mkdir -p /mingw
- mount c:/Qt/Tools/mingw730_64 /mingw (the path of the mingw you discovered on point 5.)
- go to the Net-SNMP source path
- ./configure –prefix=/mingw –without-openssl –without-perl-modules
- make
- make install
- Now, in the mingw Qt dir, you should have the Net-SNMP library and tools.
- Edit your .pro files and add this line: win32: LIBS += -L$$PWD/net-snmp/lib/ -lnetsnmp -lws2_32
Now you’re ready to build your project.
Some useful tips to remind:
- remember to setup the env variable MIBS, for example netsnmp_setenv(“MIBS”, “+AIRESPACE-WIRELESS-MIB”, 1);
- remember to specify the MIBS directories, for example netsnmp_set_mib_directory(QCoreApplication::applicationDirPath().toLatin1() + “/MIBS”);
- if you want to understand some problem, add these lines:
snmp_set_do_debugging(1);
snmp_enable_stderrlog ();
snmp_enable_calllog();
debug_register_tokens(“read_config,get_mib,parse”);
If you need support, don’t hesitate to add a comment below.