Page 1 of 1

undefined reference to `swap_byte_32'

Posted: Wed Aug 14, 2019 6:18 am
by redengin
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

Re: undefined reference to `swap_byte_32'

Posted: Wed Aug 14, 2019 6:46 am
by ESP_Angus
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

Re: undefined reference to `swap_byte_32'

Posted: Thu Aug 15, 2019 8:24 am
by redengin
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.

Re: undefined reference to `swap_byte_32'

Posted: Mon Aug 19, 2019 12:20 am
by ESP_Angus
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.

Re: undefined reference to `swap_byte_32'

Posted: Thu Aug 22, 2019 2:02 am
by redengin
Using `debug` compiler optimization level does the trick for now. Let me know when it'll work with `release` level.

Re: undefined reference to `swap_byte_32'

Posted: Mon Sep 16, 2019 3:01 am
by blueMoodBHD
Hi all, This bug have been fixed, refer to https://github.com/espressif/esp-idf/co ... 9fa387a766

Re: undefined reference to `swap_byte_32'

Posted: Wed Sep 18, 2019 3:31 am
by redengin
I can confirm that the latest updates have fixed this.