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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix crossbuild on CentOS
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.
  • Loading branch information
janvorli committed Oct 8, 2020
commit d2fc62ba08932daaa8ce81100e8a39888734cd21
4 changes: 4 additions & 0 deletions eng/common/cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.

add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/lib/${TOOLCHAIN}")
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}")
endif()

if(TARGET_ARCH_NAME STREQUAL "armel")
if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only
Expand Down
5 changes: 2 additions & 3 deletions eng/native/configuretools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER)

locate_toolchain_exec(ar CMAKE_AR)
locate_toolchain_exec(nm CMAKE_NM)
locate_toolchain_exec(ranlib CMAKE_RANLIB)

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.

locate_toolchain_exec(link CMAKE_LINKER)
endif()

Expand Down