undefined reference to `swap_byte_32'

redengin
Posts: 4
Joined: Wed Mar 13, 2019 7:11 am

undefined reference to `swap_byte_32'

Postby redengin » Wed Aug 14, 2019 6:18 am

linking is failing with the following output. Its odd, since swap_byte_32 is declared as inline in bt_defs.h. Let me know if there is a more I can do to investigate this further.

Code: Select all

/home/redengin/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/bt/libbt.a(bta_jv_act.c.obj):(.literal.bta_jv_start_discovery_cback+0x10): undefined reference to `swap_byte_32'
/home/redengin/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/bt/libbt.a(bta_jv_act.c.obj): in function `bta_jv_start_discovery_cback':
/home/redengin/opt/esp-idf/components/bt/host/bluedroid/bta/jv/bta_jv_act.c:868: undefined reference to `swap_byte_32'
/home/redengin/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/bt/libbt.a(btc_util.c.obj):(.literal.uuid_to_string_legacy+0x4): undefined reference to `swap_byte_32'
/home/redengin/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/bt/libbt.a(btc_util.c.obj): in function `ntohl':
/home/redengin/opt/esp-idf/components/bt/host/bluedroid/common/include/common/bt_defs.h:112: undefined reference to `swap_byte_32'
/home/redengin/opt/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld: /home/redengin/opt/esp-idf/components/bt/host/bluedroid/common/include/common/bt_defs.h:112: undefined reference to `swap_byte_32'
collect2: error: ld returned 1 exit status

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

Re: undefined reference to `swap_byte_32'

Postby ESP_Angus » Wed Aug 14, 2019 6:46 am

Hi redengin,

This should probably be declared "inline static", will fix that.

However I'm not sure this explains the error you're seeing. Can you please give some details about your IDF version, configuration, and your app project that can help us reproduce the actual linking error?

Thanks,

Angus

redengin
Posts: 4
Joined: Wed Mar 13, 2019 7:11 am

Re: undefined reference to `swap_byte_32'

Postby redengin » Thu Aug 15, 2019 8:24 am

IDF: * master 39f090a Merge branch 'deprecate/spi_common_claim_macros' into 'master'
toolchain: (crosstool-NG esp32-2019r1)

I tried decorating swap_byte_32 as static but that conflicts will all the non-static inline usages.

I can't provide my project, but I can look into creating an example that has the same issue.

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

Re: undefined reference to `swap_byte_32'

Postby ESP_Angus » Mon Aug 19, 2019 12:20 am

Thanks redengin.

A member of our BT team was able to reproduce this as well, and a fix should be merged to master shortly.

As a workaround the error may go away if you switch Compiler Optimisation from Release back to Debug, temporarily.

redengin
Posts: 4
Joined: Wed Mar 13, 2019 7:11 am

Re: undefined reference to `swap_byte_32'

Postby redengin » Thu Aug 22, 2019 2:02 am

Using `debug` compiler optimization level does the trick for now. Let me know when it'll work with `release` level.

blueMoodBHD
Posts: 7
Joined: Wed Nov 07, 2018 3:47 am

Re: undefined reference to `swap_byte_32'

Postby blueMoodBHD » Mon Sep 16, 2019 3:01 am

Hi all, This bug have been fixed, refer to https://github.com/espressif/esp-idf/co ... 9fa387a766

redengin
Posts: 4
Joined: Wed Mar 13, 2019 7:11 am

Re: undefined reference to `swap_byte_32'

Postby redengin » Wed Sep 18, 2019 3:31 am

I can confirm that the latest updates have fixed this.

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 100 guests