Linking errors with BFD assertion fail

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Linking errors with BFD assertion fail

Postby iamblwb » Sat Mar 04, 2017 10:35 am

I tried porting some codes to ESP32, but I encountered a lot of BFD assertions during code linking.
This is the only link error, no other error message appears.
I also downloaded and checked the source code for binutils-2.25.1, but I can’t see any assertion at line 8316 in elf32-xtensa.c
What is the meaning of this link error?
How to fix this error?
Please kindly give me advice.
Thanks

Code: Select all

LD my-esp32.elf
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
.
.
.
.
/esp/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: BFD (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 2.25.1 assertion fail /Users/ivan/e/ESPTools/crosstool-NG/.build/src/binutils-2.25.1/bfd/elf32-xtensa.c:8316
collect2: error: ld returned 1 exit status

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Linking errors with BFD assertion fail

Postby ESP_igrr » Sat Mar 04, 2017 11:02 am

Could you please provide some code to help us reproduce this issue?

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Linking errors with BFD assertion fail

Postby iamblwb » Mon Mar 06, 2017 6:27 am

Please check the attachment below.
Actually, the purpose is to simply test jerryscript.

Here are the steps to build the code:
1. Extract the attached file to the template application
2. Get jerryscript from github and replace it to components/jerryscript
https://github.com/jerryscript-project/jerryscript
3. make app and you will see that link error
my-esp32.zip
(18.56 KiB) Downloaded 607 times

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Linking errors with BFD assertion fail

Postby ESP_igrr » Mon Mar 06, 2017 6:44 am

For the project you have attached, compilation fails with the following message:

Code: Select all

/private/tmp/my-esp32/main/./main.c:4:25: fatal error: jerryscript.h: No such file or directory
I couldn't reproduce the BFD assertion error.

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Linking errors with BFD assertion fail

Postby iamblwb » Mon Mar 06, 2017 7:22 am

Sorry, I updated the attachment again and slightly modified the following steps.
Please ignore the previous one and use the new attachment and steps to build the code.

1. Extract the attachment to the template application
2. Get jerryscript from github and copy all files/directories to components/jerryscript
https://github.com/jerryscript-project/jerryscript
e.g.
/cmake will be copied to /my-esp32/components/jerryscript/cmake
/jerry-core will be copied to /my-esp32/components/jerryscript/jerry-core
and so on

3. make the application and you will see the link error
my-esp32_v1.zip
(8.04 KiB) Downloaded 588 times

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Linking errors with BFD assertion fail

Postby ESP_igrr » Mon Mar 06, 2017 8:16 am

Thanks, I can now reproduce the issue. Unfortunately I don't have a slightest idea what it may be caused by.
Until we figure out the cause, you may try this jerryscript port by Neil Kolban: https://github.com/nkolban/jerryscript-esp32

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Linking errors with BFD assertion fail

Postby iamblwb » Mon Mar 06, 2017 9:22 am

Thank you for the information.
In fact, before post this issue, I have tried to build kolban’s jerryscript, but unfortunately still get the same error.
Kolban’s code seems to be used for private use, so he did not release the jerryscript parts for public.
https://github.com/nkolban/jerryscript-esp32/issues/1

As you can see jerryscript in his github is empty, does not include the corresponding build script, so I still have to implement this part by myself.
https://github.com/nkolban/jerryscript- ... components

Also I have tried to modify the script in jerryscript official release for target esp8266 to fit esp32 build environment, but magically I still get the same error...

In addition, for you reference, I can reproduce this issue in all these conditions.
OSX/Linux, esp-idf 1.0/esp-idf 2.0, jerrryscript 1.0 or the current main trunk.

xu.zengx
Posts: 1
Joined: Tue Mar 14, 2017 5:18 am

Re: Linking errors with BFD assertion fail

Postby xu.zengx » Tue Mar 14, 2017 5:19 am

replace -Og -ggdb for -Os

iamblwb
Posts: 13
Joined: Wed Dec 28, 2016 3:26 pm

Re: Linking errors with BFD assertion fail

Postby iamblwb » Tue Mar 14, 2017 12:14 pm

Thanks for your advice.
In this case it seems esp32 linker has issue with debug build.
Sometimes we still need debug build for further debugging...

Who is online

Users browsing this forum: ccrause and 187 guests