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

Fix crossbuild on CentOS #43189

Merged
merged 2 commits into from
Oct 9, 2020
Merged

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Oct 8, 2020

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.

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.
@ghost
Copy link

ghost commented Oct 8, 2020

Tagging subscribers to this area: @ViktorHofer
See info in area-owners.md if you want to be subscribed.

@@ -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")
Copy link
Member Author

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.

if(CMAKE_C_COMPILER_ID MATCHES "GNU")
locate_toolchain_exec(ranlib CMAKE_RANLIB)
else()
if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU")
Copy link
Member

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

Suggested change
if(NOT CMAKE_C_COMPILER_ID MATCHES "GNU")
if(CMAKE_C_COMPILER_ID STREQUAL Clang)

Copy link
Member Author

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.

@janvorli janvorli merged commit faae224 into dotnet:master Oct 9, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants