Skip to content

Linux cross build: cmake variable setting #7098

@hseok-oh

Description

@hseok-oh

Many CMake variables are set in <projectDir>/CMakeLists.txt.
Windows and Linux have different result.

For example, when host is x86 and target is ARM,

In Windows, CMakeList.txt set as
CLR_CMAKE_PLATFORM_ARCH_I386: 1
CLR_CMAKE_HOST_ARCH: x86
CLR_CMAKE_TARGET_ARCH: arm
CLR_CMAKE_TARGET_ARCH_ARM: 1

But in Linux,
CLR_CMAKE_PLATFORM_ARCH_ARM: 1
CLR_CMAKE_HOST_ARCH: arm
CLR_CMAKE_TARGET_ARCH: arm
CLR_CMAKE_TARGET_ARCH_ARM: 1

In linux, CLR_CMAKE_HOST_ARCH and CLR_CMAKE_PLATFORM_ARCH_<ARCH> are defined by CLR_CMAKE_PLATFORM_<OS>_<ARCH>, and CLR_CMAKE_PLATFORM__is defined byCMAKE_SYSTEM_PROCESSOR`.

CMAKE_SYSTEM_PROCESSOR have target architecture. If host and target is same, the result is uname -p. But in cross build environment, it have target architecture.
https://cmake.org/cmake/help/v3.7/variable/CMAKE_SYSTEM_PROCESSOR.html
https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html

This effects

  1. Not build for cross build environment
    ex. directory bin/Linux.arm.Release/x64/ and crossgen for x64-host/arm-target is not generated
    (it is not confirm correctness of crossgen if we fix to generate this directory and execution file)
  2. Different CMake files
    ex. src/pal/CMakeLists.txt: not build libcoreclrtraceptprovider.so (Several Interop tests failing in Helix on ARM #8421)

Need to fix for cross build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions