"undefined reference to" symbol not in source file

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

"undefined reference to" symbol not in source file

Postby Gfast2 » Thu Dec 07, 2017 4:02 pm

Hi ESP-IDF,

I'm still fighting for porting open62541 (a opensourced good IIoT connection protocol library)

For the version 0.3 I'm nearly there (library get compiled by cmake, AMALGAMATION works...)

But int the last step I got error:

Code: Select all

[100%] Built target open62541
LD build/open62541_port.elf
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.op_timestampsToReturn2 lma 0x40150b98 adjusted to 0x40150b9c
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.op_sub lma 0x40150b98 adjusted to 0x40150ba0
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.op_publishingEnabled lma 0x40150b98 adjusted to 0x40150ba4
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.op_timestampsToReturn lma 0x40150b98 adjusted to 0x40150ba5
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.op_releaseContinuationPoint lma 0x40150b98 adjusted to 0x40150ba9
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_exchangeBufferCallbackHandle lma 0x40150b98 adjusted to 0x40150baa
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_exchangeBufferCallback lma 0x40150b98 adjusted to 0x40150bae
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_end lma 0x40150b98 adjusted to 0x40150bb2
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_pos lma 0x40150b98 adjusted to 0x40150bb6
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_customTypesArray lma 0x40150b98 adjusted to 0x40150bba
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tbss.g_customTypesArraySize lma 0x40150b98 adjusted to 0x40150bbe
/home/gfast2/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/gfast2/workspace/open62541_port03/build/open62541_port.elf: section .tdata.UA_rng lma 0x40150b98 adjusted to 0x40150bc2
/home/gfast2/workspace/open62541_port03/build/main/libmain.a(open62541.o):(.literal.UA_Discovery_cleanupTimedOut+0xc): undefined reference to `access'
/home/gfast2/workspace/open62541_port03/build/main/libmain.a(open62541.o): In function `UA_Discovery_cleanupTimedOut':
/home/gfast2/workspace/open62541_port03/main/./open62541.c:35233: undefined reference to `access'
/home/gfast2/workspace/open62541_port03/build/main/libmain.a(open62541.o): In function `process_RegisterServer':
/home/gfast2/workspace/open62541_port03/main/./open62541.c:35233: undefined reference to `access'
collect2: error: ld returned 1 exit status
/home/gfast2/esp/esp-idf/make/project.mk:373: recipe for target '/home/gfast2/workspace/open62541_port03/build/open62541_port.elf' failed
make: *** [/home/gfast2/workspace/open62541_port03/build/open62541_port.elf] Error 1

I've searched, there is nothing in "UA_Discovery_cleanupTimedOut" called "access". So I'm encounting the scenario: Debugging something I can't find.

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: "undefined reference to" symbol not in source file

Postby ESP_Angus » Thu Dec 07, 2017 10:20 pm

I renamed the title of the post because this isn't really to do with memory addresses, it's to do with symbols in the object file.

Is it possible that there's macro at this line which expands to reference "access"?

We don't have support for the libc access() function in esp-idf's VFS layer, I guess because we don't support file access modes. But we could probably add one to check the file exists, please feel free to raise a feature request on github.

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: "undefined reference to" symbol not in source file

Postby Gfast2 » Fri Dec 08, 2017 8:56 am

ESP_Angus wrote:I renamed the title of the post because this isn't really to do with memory addresses, it's to do with symbols in the object file.

Is it possible that there's macro at this line which expands to reference "access"?

We don't have support for the libc access() function in esp-idf's VFS layer, I guess because we don't support file access modes. But we could probably add one to check the file exists, please feel free to raise a feature request on github.
Hi Angus,

BIG BIG thanks again. I believe for this I will try to make some work around first.

Cheers

Su

User avatar
Gfast2
Posts: 182
Joined: Fri Aug 11, 2017 1:52 am

Re: "undefined reference to" symbol not in source file

Postby Gfast2 » Sat Dec 09, 2017 9:10 pm

Hi ESP-IDF,

Yes, finally I have some time to spend on this issue. I figured out as Angust said, I did found three places in the source code which are using libc access() for some "file permission checking".

As I've said, I put some dummy results to replace the results that are returned by these "access()" for my job first. but now I have experienced some other problem related to this question.

The separated question for the following question is here

Cheers

Gfast2

Who is online

Users browsing this forum: Majestic-12 [Bot] and 121 guests