-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix crossbuild on CentOS #43189
Fix crossbuild on CentOS #43189
Conversation
This change fixes the crossbuilding to work on CentOS. Clang frontend presets some of the compiler options based on the host OS and I guess that's causing the need to add the `--rpath-link`. The ranlib change to use llvm ranlib fixed a problem where cmake attempted to use ranlib from the rootfs for some reason.
Tagging subscribers to this area: @ViktorHofer |
@@ -139,6 +139,10 @@ function(add_toolchain_linker_flag Flag) | |||
set("CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}" "${CMAKE_SHARED_LINKER_FLAGS${CONFIG_SUFFIX}} ${Flag}" PARENT_SCOPE) | |||
endfunction() | |||
|
|||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a PR in arcade for the change in this file, but to not to have to wait for it to propagate, I am adding it here too.
eng/native/configuretools.cmake
Outdated
if(CMAKE_C_COMPILER_ID MATCHES "GNU") | ||
locate_toolchain_exec(ranlib CMAKE_RANLIB) | ||
else() | ||
if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we are not using NOT
pattern with CMAKE_C{XX}_COMPILER_ID
in other places
if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU") | |
if(CMAKE_C_COMPILER_ID STREQUAL Clang) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion, I've replaced it with if(CMAKE_C_COMPILER_ID MATCHES "Clang")
as we use the same in the code above.
This change fixes the crossbuilding to work on CentOS. Clang
frontend presets some of the compiler options based on the
host OS and I guess that's causing the need to add the
--rpath-link
.The ranlib change to use llvm ranlib fixed a problem where
cmake attempted to use ranlib from the rootfs for some
reason.
These changes have no effect on the cross build on Ubuntu.
The reason for fixing it is that we'd like to move our cross build to
CentOS 7 from Ubuntu so that the cross tools generated during
the build can run on the same distros as natively built tools.