-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
clang linker on MacOS doesn't support -warn_commons
for target linux. (IDFGH-12129)
#13185
Comments
-warn_commons
for target linux.-warn_commons
for target linux. (IDFGH-12129)
@morgana2313 Could you please mention the version of macOS and the version of |
macOS Sonoma 14.1.1 (23B81) on a Apple M1 Pro
|
I have a similar problem when compiling
Fix: @@ -598,13 +601,23 @@ macro(project project_name)
endif()
if(test_components)
- target_link_libraries(${project_elf} PRIVATE "-Wl,--whole-archive")
+ if(CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ set(whole_archive "-Wl,-force_load")
+ set(no_whole_archive "")
+ else()
+ set(whole_archive "-Wl,--whole-archive")
+ set(no_whole_archive "-Wl,--no-whole-archive")
+ endif()
+
+ target_link_libraries(${project_elf} PRIVATE ${whole_archive})
foreach(test_component ${test_components})
if(TARGET ${test_component})
target_link_libraries(${project_elf} PRIVATE ${test_component})
endif()
endforeach()
- target_link_libraries(${project_elf} PRIVATE "-Wl,--no-whole-archive")
+ target_link_libraries(${project_elf} PRIVATE ${no_whole_archive})
endif()
idf_build_get_property(build_components BUILD_COMPONENT_ALIASES) |
I can confirm the issue occurs with recent enough /usr/bin/ld. Interestingly, |
Is there a workaround for this that doesn't require changing the ESP-IDF source code? |
The newer version of ld now works with the
|
…t on MacOS This commit updates the ld linker flags to conditionally include the -warn_commons flag when the linux target is built on MacOS. This is because, not all versions of ld support the -warn_commons option. Closes #13185
…t on MacOS This commit updates the ld linker flags to conditionally include the -warn_commons flag when the linux target is built on MacOS. This is because, not all versions of ld support the -warn_commons option. Closes #13185
…t on MacOS This commit updates the ld linker flags to conditionally include the -warn_commons flag when the linux target is built on MacOS. This is because, not all versions of ld support the -warn_commons option. Closes #13185
…t on MacOS This commit updates the ld linker flags to conditionally include the -warn_commons flag when the linux target is built on MacOS. This is because, not all versions of ld support the -warn_commons option. Closes #13185
The
clang
linker on MacOs (target=linux) doesn't support the-warn_commons
option:If I remove this option it builds without a hitch:
esp-idf/CMakeLists.txt
Line 219 in 4d90eed
Details
I've minimalised
main/hello_world_main.c
to:With the above patch it builds and executes ok:
The text was updated successfully, but these errors were encountered: