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

Making arduino-lmic competible with arduino-esp32-2.0 #714

Closed
chansheunglong opened this issue Apr 18, 2021 · 10 comments
Closed

Making arduino-lmic competible with arduino-esp32-2.0 #714

chansheunglong opened this issue Apr 18, 2021 · 10 comments
Assignees

Comments

@chansheunglong
Copy link

I recently updated the arduino-esp32 to version 2.0 and when compiling the program

...\esp32\hardware\esp32\2.0.0-alpha1/tools/sdk/esp32/lib\libpp.a(hal_mac.o): in function hal_init': (.text.hal_init+0x100): multiple definition of hal_init';
...\MCCI_LoRaWAN_LMIC_library\src\hal/hal.cpp:416: first defined here
collect2.exe: error: ld returned 1 exit status

Seems like the new version of arduino-esp32 (2.0) will not be compatible with arduino-lmic because of the same definition of a function.

Since ESP32 is quite a popular platform and making LMIC and ESP32 not able to work together is sad news, will it be possible for arduino-lmic to add an option, e.g. #DEFINE_USE_ESP32, to alter the naming of the function so there will be no multiple definition?

The old version of arduino-esp32 (1.6) works with arduino-lmic

@terrillmoore
Copy link
Member

Very sorry about this. Not going to happen without a major rename pass. I suggest you add #define hal_init LMICHAL_init in your LMIC project config or on the PlatformIO command line where you define other LMIC options. Don't know when we'll have time to fix it here. Seems like a mistake for both libraries (ESP32 and LMIC) to use unqualified names that are not reserved names in the C standard.

@marcobrianza
Copy link

the #define fixed my project, If it does not harm, It could be a default in project config

@terrillmoore
Copy link
Member

I have put this on the list to investigate in the next release.

@1Ghasthunter1
Copy link

Very sorry about this. Not going to happen without a major rename pass. I suggest you add #define hal_init LMICHAL_init in your LMIC project config or on the PlatformIO command line where you define other LMIC options. Don't know when we'll have time to fix it here. Seems like a mistake for both libraries (ESP32 and LMIC) to use unqualified names that are not reserved names in the C standard.

Thanks, this seemed to work for me!

@kallisti5
Copy link

kallisti5 commented Jan 31, 2023

Are there any plans to fix this? Seems weird to "just rename hal_init" moving forward forever.

4004 added a commit to 4004/hzgl-lora-communicator that referenced this issue Sep 15, 2023
The bug is tracked here: mcci-catena/arduino-lmic#714

This pull request fixes the following linker failure when building using vscode, platformio on Linux.
///.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libpp.a(hal_mac.o): in function `hal_init':
(.text.hal_init+0xb4): multiple definition of `hal_init'; .pio/build/working-in-progress/libdad/libMCCI LoRaWAN LMIC library.a(hal.cpp.o):///git/g/hzgl-lora-communicator/.pio/libdeps/working-in-progress/MCCI LoRaWAN LMIC library/src/hal/hal.cpp:416: first defined here
collect2: error: ld returned 1 exit status
*** [.pio/build/working-in-progress/firmware.elf] Error 1
@arslan437
Copy link

#define hal_init LMICHAL_init 

worked for me

@gillet51430
Copy link

#define hal_init LMICHAL_init
worked for me too

@gunawanw9
Copy link

gunawanw9 commented Nov 15, 2024

on lmic_project_config.h put #define hal_init LMICHAL_init

@terrillmoore
Copy link
Member

Are there any plans to fix this? Seems weird to "just rename hal_init" moving forward forever.

I was reluctant to change this piecemeal. There are dozens of other hal_ symbols that might conflict. However, I will do a quick pass now, as it is true that ESP32 is an important platform.

@terrillmoore
Copy link
Member

This is a breaking change -- an export used by one of the examples needed to change name. So updated the version to 5.0.0-pre1. Will merge to head after regression tests complete.

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

No branches or pull requests

8 participants