Skip to content

"undefined reference to 'na_ble_sm_alg_encrypt'" linker error when using CONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED and CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED #1045

@Bascy

Description

@Bascy

When compiling our project using NimBLE 2.3.6. I get the wollowing linker error when using multiple compiler options:

platformio.ini

;PlatformIO Project Configuration File

[platformio]
default_envs = debug

[env]
platform = espressif32
board = esp32dev
framework = arduino

board_upload.flash_size = 16MB
board_build.partitions = default_16MB.csv
board_upload.maximum_size = 16777216
board_build.filesystem = spiffs

;======================================================
[env:debug]
build_type = debug
build_flags = 
	${env.build_flags}
	-DDEBUG_SENSE  
  -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
  -DDEBUG_NODEIDS=""

  -D CONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED  #not using NimBLE Server functions (uses approx. 16kB flash.)
  -D CONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED #not using NimBLE Client functions (uses approx. 7kB flash.)

C:/Users/bas/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: .pio/build/debug/lib439/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_resolv.c.o:(.literal.ble_hs_resolv_gen_priv_addr+0x4): undefined reference to na_ble_sm_alg_encrypt' C:/Users/bas/.platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld.exe: .pio/build/debug/lib439/NimBLE-Arduino/nimble/nimble/host/src/ble_hs_resolv.c.o: in function ble_hs_resolv_gen_priv_addr':
D:\Projects\Libraries\Sense_EnOcean/.pio/libdeps/debug/NimBLE-Arduino/src/nimble/nimble/host/src/ble_hs_resolv.c:410:(.text.ble_hs_resolv_gen_priv_addr+0x73): undefined reference to `na_ble_sm_alg_encrypt'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\debug\firmware.elf] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions