9 years, 7 months ago.

linking nsdl lib failed with unsolved symbol

Hi, I try to link nsdl lib in my offline development environment. It fails with errors like:

error

nanoservice_client_1_12\sn_grs.c:(.text+0x46c): undefined reference to `__aeabi_memclr4'

here is my building command (unrelated object file removed):

building command

C:/smeshstudio/smeshcore/tools/gcc_arm/bin/arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wl,--gc-sections --specs=nano.specs -u _printf_float -u _scanf_float -Wl,--wrap,main -Wl,-Map=NSDL_HelloWorld.map,--cref -T./mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/LPC1768.ld -L./mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM -L./nsdl_lib -o NSDL_HelloWorld.elf mbed-rtos/rtx/TARGET_M3/TOOLCHAIN_GCC/SVC_Table.o mbed-rtos/rtx/TARGET_M3/TOOLCHAIN_GCC/HAL_CM3.o ... mbed-rtos/rtos/Semaphore.o mbed-rtos/rtos/Mutex.o mbed-rtos/rtos/RtosTimer.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/retarget.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/system_LPC17xx.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/board.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/cmsis_nvic.o mbed/TARGET_LPC1768/TOOLCHAIN_GCC_ARM/startup_LPC17xx.o -lmbed  -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -lnsdl -lmbed  -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -lnsdl

Here are errors with more details from linker:

errors with details

arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_coap_builder.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_coap_header_check.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_coap_parser.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_nsdl.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_coap_protocol.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_grs.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
arm-none-eabi/bin/ld.exe: warning: ./nsdl_lib\libnsdl.a(sn_linked_list.o) uses 2-byte wchar_t yet the output is to use 4-byte wchar_t; use of wchar_t values across objects may fail
./nsdl_lib\libnsdl.a(sn_coap_builder.o): In function `sn_coap_build_response':
nanoservice_client_1_12\sn_coap_builder.c:(.text+0x2a): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_coap_builder.c:(.text+0x7c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_builder.o): In function `sn_coap_builder_payload_build':
nanoservice_client_1_12\sn_coap_builder.c:(.text+0xa2): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_builder.o): In function `sn_coap_builder_options_build_add_one_option':
nanoservice_client_1_12\sn_coap_builder.c:(.text+0x1aa): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_builder.o): In function `sn_coap_builder_options_build':
nanoservice_client_1_12\sn_coap_builder.c:(.text+0x366): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_builder.o): In function `sn_coap_builder':
nanoservice_client_1_12\sn_coap_builder.c:(.text+0xaba): undefined reference to `__aeabi_memclr'
./nsdl_lib\libnsdl.a(sn_coap_parser.o): In function `sn_coap_parser_options_parse_multiple_options':
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x2a0): undefined reference to `__aeabi_memset'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x2b4): undefined reference to `__aeabi_memset'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x2e6): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_parser.o): In function `sn_coap_parser_options_parse':
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x3a8): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x4e0): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x558): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x5a4): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x5fc): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x686): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x716): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_parser.o):nanoservice_client_1_12\sn_coap_parser.c:(.text+0x7e2): more undefined references to `__aeabi_memcpy' follow
./nsdl_lib\libnsdl.a(sn_coap_parser.o): In function `sn_coap_parser':
nanoservice_client_1_12\sn_coap_parser.c:(.text+0x9b2): undefined reference to `__aeabi_memclr4'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_resolve_ep_information':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x234): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x2a8): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x2fc): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_init':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x4fa): undefined reference to `__aeabi_memclr4'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_GET_with_QUERY':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x55a): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x588): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x5d2): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_GET':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x630): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x65e): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x6a4): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_build_registration_body':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x942): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x964): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x978): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x99c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o):nanoservice_client_1_12\sn_nsdl.c:(.text+0x9b0): more undefined references to `__aeabi_memcpy' follow
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_register_endpoint':
nanoservice_client_1_12\sn_nsdl.c:(.text+0xb88): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xbb6): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xcb2): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xd4e): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_unregister_endpoint':
nanoservice_client_1_12\sn_nsdl.c:(.text+0xd88): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xde4): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xe04): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_update_registration':
nanoservice_client_1_12\sn_nsdl.c:(.text+0xe38): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xe72): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xe96): undefined reference to `__aeabi_memclr4'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_send_eventing_message':
nanoservice_client_1_12\sn_nsdl.c:(.text+0xeee): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xf20): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xf2c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `sn_nsdl_send_observation_notification':
nanoservice_client_1_12\sn_nsdl.c:(.text+0xf7e): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_nsdl.c:(.text+0xfa2): undefined reference to `__aeabi_memclr4'
./nsdl_lib\libnsdl.a(sn_nsdl.o): In function `set_NSP_address':
nanoservice_client_1_12\sn_nsdl.c:(.text+0x1132): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_nsdl.c:(.text+0x118e): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o): In function `sn_coap_register':
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0x44): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0x70): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xc8): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xdc): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xe8): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o): In function `sn_coap_protocol_allocate_mem_for_msg':
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0x4de): undefined reference to `__aeabi_memclr'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o): In function `sn_coap_protocol_linked_list_send_msg_store':
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0x5ae): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0x5cc): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o): In function `sn_coap_protocol_linked_list_ack_info_store':
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xa1c): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xa2c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o): In function `sn_coap_protocol_build_msg':
nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xc1c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_coap_protocol.o):nanoservice_client_1_12\sn_coap_protocol.c:(.text+0xc62): more undefined references to `__aeabi_memcpy' follow
./nsdl_lib\libnsdl.a(sn_grs.o): In function `sn_grs_list_resource':
nanoservice_client_1_12\sn_grs.c:(.text+0x1e6): undefined reference to `__aeabi_memmove'
./nsdl_lib\libnsdl.a(sn_grs.o): In function `sn_grs_update_resource':
nanoservice_client_1_12\sn_grs.c:(.text+0x42c): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_grs.o): In function `sn_grs_add_resource_to_list':
nanoservice_client_1_12\sn_grs.c:(.text+0x46c): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_grs.c:(.text+0x4b8): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0x4e4): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0x50e): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_grs.c:(.text+0x566): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0x59e): undefined reference to `__aeabi_memcpy'
./nsdl_lib\libnsdl.a(sn_grs.o): In function `sn_grs_process_coap':
nanoservice_client_1_12\sn_grs.c:(.text+0x78c): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_grs.c:(.text+0x92c): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0x986): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0x9f0): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_grs.c:(.text+0xa24): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0xa5c): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0xaf2): undefined reference to `__aeabi_memclr4'
nanoservice_client_1_12\sn_grs.c:(.text+0xb6e): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0xbd0): undefined reference to `__aeabi_memcpy'
nanoservice_client_1_12\sn_grs.c:(.text+0xc26): undefined reference to `__aeabi_memcpy'
arm-none-eabi/bin/ld.exe: NSDL_HelloWorld.elf: hidden symbol `__aeabi_memset' isn't defined
arm-none-eabi/bin/ld.exe: final link failed: Bad value
collect2.exe: error: ld returned 1 exit status

Could you help me find what is wrong here?

Thanks!

Question relating to:

NSDL C library nsdl

moved to answer.

posted by zhongwei yao 26 Feb 2015

1 Answer

9 years, 7 months ago.

It turns out that the online IDE probably use armcc toolchain, which has optimized version for memcpy, memmove and memclr etcs.(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3934.html) But they are not available in arm-gcc 4.8. It can be solved by updating to latest newlib (https://sourceware.org/newlib/), which contains such symbols (aeabi_memcpy, aeabi_memmove etc.) or implementing these functions by ourselves.

Accepted Answer

Or update to 4.9. I recall there was a bug reported for 4.8 regarding memcpy for example. I updated and it was resolved for me

posted by Martin Kojtal 04 Mar 2015

Assigned to zhongwei yao 9 years, 7 months ago.

This means that the question has been accepted and is being worked on.