Skip to content

Cross compiling corehost for Linux ARM32 #2547

@hqueue

Description

@hqueue

This is a part of Enabling Linux ARM32 core-setup dotnet/core-setup#725.

New Plan (Dec. 7, 2016~)

Prerequisite

We need rootfs (issue dotnet/core-setup#729) for cross-compilation.

Proposed approach

After rootfs for ARM32 is setup, we can build corehost for ARM using following command.

cd ./src/corehost
ROOTFS_DIR=<core-setup>/cross/rootfs/arm <core-setup>/src/corehost/build.sh "--arch" "arm" "--hostver" "1.1.0" "--fxrver" "1.1.0" "--policyver" "1.1.0" "--rid" "ubuntu.14.04-arm" "--commithash" "f46c58c1404fa8aaac8aed931b0862267a98c3a5" --cross

Old Plan (Before Dec. 7, 2016) (Dropped)

Steps to reproduce

You have to installed arm cross toolchain on host machine., e.g. g++-arm-linux-gnueabihf

cd ./src/corehost
./build.sh -xcompiler=`which arm-linux-gnueabihf-g++`

Expected behavior

Successful building corehost for Linux/ARM.

Actual behavior

[  2%] Building CXX object cli/exe/CMakeFiles/dotnet.dir/__/fxr/fx_ver.cpp.o
arm-linux-gnueabihf-g++: error: unrecognized command line option ‘-fstack-protector-strong’
make[2]: *** [cli/exe/CMakeFiles/dotnet.dir/__/fxr/fx_ver.cpp.o] Error 1
make[1]: *** [cli/exe/CMakeFiles/dotnet.dir/all] Error 2
make: *** [all] Error 2

Environment data

Host PC: Ubuntu 14.04 x64
Installed arm cross toolchain:

$ arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (Ubuntu/Linaro 4.8.2-16ubuntu4) 4.8.2

Proposed solution

Usually ARM cross compiler version is gcc 4.7 or 4.8 on Ubuntu 14.04 when installing
cross compiler using apt-get install.
Let's use "-fstack-protector" instead of "-fstack-protector-strong" when compiling for Linux/ARM using GNU compilers.

I will post PR soon.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions