SNMP snmp_init() fails
Posted: Fri May 10, 2019 10:55 am
Hi,
I am new to c and I want to implement snmp in my project. I am using the esp-idf 3.2 on the ESP32-PoE.
I have used https://www.nongnu.org/lwip/2_1_x/group__snmp.html to setup snmp. But when I try to build the project the compiler can't find the snmp functions
But Visual Studio is able to find the declaration. Does somebody had the same problem?
So I copied all the snmp files from lwip in my project and included them in my CMakeLists.txt. Now I am able to build the project. However when I run the code I get the following error:
this happens when I run the snmp_init function;
Have anyone got good suggestions?
I am new to c and I want to implement snmp in my project. I am using the esp-idf 3.2 on the ESP32-PoE.
I have used https://www.nongnu.org/lwip/2_1_x/group__snmp.html to setup snmp. But when I try to build the project the compiler can't find the snmp functions
Code: Select all
undefined reference to `snmp_mib2_set_syslocation'
undefined reference to `snmp_set_auth_traps_enabled'
undefined reference to `snmp_mib2_set_sysdescr'
undefined reference to `snmp_mib2_set_sysname'
undefined reference to `snmp_trap_dst_ip_set'
undefined reference to `snmp_trap_dst_enable'
undefined reference to `snmp_set_mibs'
undefined reference to `snmp_init'
So I copied all the snmp files from lwip in my project and included them in my CMakeLists.txt. Now I am able to build the project. However when I run the code I get the following error:
Code: Select all
C:/SysGCC/esp32/esp-idf/master/components/freertos/queue.c:1448 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x400851f5 on core 0
- static void initialize_snmp(void)
- {
- snmp_mib2_set_syscontact(SNMP_SYSCONTACT, &SNMP_SYSCONTACT_LEN, snmp_buffer);
- snmp_mib2_set_syslocation(SNMP_SYSLOCATION, &SNMP_SYSLOCATION_LEN, snmp_buffer);
- snmp_set_auth_traps_enabled(ENABLE);
- snmp_mib2_set_sysdescr(SNMP_SYSDESCR, &SNMP_SYSDESCR_LEN);
- snmp_mib2_set_sysname(SNMP_SYSNAME, &SNMP_SYSNAME_LEN, snmp_buffer);
- ip_addr_t gw = {};
- ipaddr_aton(SNMP_SERVER_IP,&gw);
- snmp_trap_dst_ip_set(TRAP_DESTINATION_INDEX, &gw);
- snmp_trap_dst_enable(TRAP_DESTINATION_INDEX, ENABLE);
- snmp_set_mibs(my_snmp_mibs, LWIP_ARRAYSIZE(my_snmp_mibs));
- snmp_init();
- ESP_LOGI(TAG, "initialize_snmp() finished.");
- }