Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing build: multiple definition of `hal_init' #41

Closed
gkaretka opened this issue Apr 25, 2022 · 3 comments
Closed

Failing build: multiple definition of `hal_init' #41

gkaretka opened this issue Apr 25, 2022 · 3 comments
Assignees
Labels
workaround Workaround needed

Comments

@gkaretka
Copy link

gkaretka commented Apr 25, 2022

Hello, I'm building this project with these libraries for heltec_wireless_stick board.

Dependency Graph

  • |-- <U8g2> 2.33.2
  • | |-- <SPI> 2.0.0
  • | |-- <Wire> 2.0.0
  • |-- <EasyLed> 1.1.0
  • |-- <MCCI LoRaWAN LMIC library> 4.0.0
  • | |-- <SPI> 2.0.0
  • |-- <Wire> 2.0.0
  • |-- <SPI> 2.0.0
    `
    Building in release mode

and I am getting this error message
Linking .pio\build\heltec_wireless_stick\firmware.elf c:/users/xxx/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\Users\xxx\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libpp.a(hal_mac.o): in functionhal_init':
(.text.hal_init+0xc8): multiple definition of hal_init'; .pio\build\heltec_wireless_stick\libc40\libMCCI LoRaWAN LMIC library.a(hal.cpp.o):C:\Users\xxx\Documents\GitHub\LMIC-node/.pio/libdeps/heltec_wireless_stick/MCCI LoRaWAN LMIC library/src/hal/hal.cpp:416: first defined here collect2.exe: error: ld returned 1 exit status *** [.pio\build\heltec_wireless_stick\firmware.elf] Error 1

@JohnMacrae
Copy link

You can solve this by using v3.5.0 of the espressif 32 platform. Although not a permanent fix, it will get you going. N.B. you will need to uninstall espressif 32 completely and then reinstall 3.5.0. HTH

@Manwil00
Copy link

Hello,

I had the same issue using a TTGO LoRa32 v2.1 board

It seems to be related to the MCCI LoRaWAN LMIC Library https://github.com/mcci-catena/arduino-lmic and ESP32 based boards.
The same github issue exists on their github page: mcci-catena/arduino-lmic#714
They suggests adding #define hal_init LMICHAL_init to the lmic_project_config.h or if using PlatformIO to the command line.
mcci-catena/arduino-lmic#714 (comment)

So I got it working by adding -D hal_init=LMICHAL_init to the mcci_lmic build_flags in the platformio.ini file

@lnlp lnlp added the workaround Workaround needed label Apr 30, 2022
@lnlp lnlp self-assigned this Apr 30, 2022
lnlp added a commit that referenced this issue Apr 30, 2022
This workaround fixes a naming conflict for function hal_init.
The conflict was introduced by newer versions (> 3.5.0) of
PlatformIO Espressif 32 platform (ESP32 Arduino core).
See LMIC-node issue #41.
@lnlp
Copy link
Owner

lnlp commented Apr 30, 2022

Thanks! @CaptnAwsome and @JohnMacrae

I have added the workaround to LMIC-node and will therefore close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround Workaround needed
Projects
None yet
Development

No branches or pull requests

4 participants