diff options
Diffstat (limited to 'Documentation/cross-building.md')
-rw-r--r-- | Documentation/cross-building.md | 100 |
1 files changed, 75 insertions, 25 deletions
diff --git a/Documentation/cross-building.md b/Documentation/cross-building.md index c95fd15dd..291a92df7 100644 --- a/Documentation/cross-building.md +++ b/Documentation/cross-building.md @@ -52,54 +52,104 @@ As usual the resulting binaries will be found in `bin/Product/BuildOS.BuildArch. Using CoreRT for cross compiling under arm on x86 host ----------------------- -It is possible to use CoreRT for compiling under arm/armel on x86 host (or on x64 machine using roots). +It's possible to use CoreRT for compiling under arm/armel on x86 host (or on x64 machine using rootfs). +You can build Debug or Release version. +For example Release means: release CoreRT/CoreCLR/CoreFX builds + CoreRT(ILC) release enabled optimizations. +For better components compatibility, if you want to build Debug version, you must compile ALL projects as Debug version. +Otherwise, ALL as Release version. -1. Build CoreCLR for x86 (`checked` version) +1. Build CoreCLR for x86 ``` sudo ./cross/build-rootfs.sh x86 xenial -./build.sh clang3.9 x86 checked verbose cross skiptests +./build.sh x86 debug verbose cross ``` - -2. Build CoreFX (`Debug` version) -3. Build CoreRT for armel, x64, x86 +2. Build CoreFX +``` +sudo ./cross/build-rootfs.sh x86 xenial +./build-native.sh -debug -buildArch=x86 -- verbose cross +./build-managed.sh -debug -verbose +``` +3. Build CoreRT for x86 and armel ``` -sudo ./cross/build-rootfs.sh armel tizen cross -./build.sh clang3.9 armel debug verbose cross -./build.sh debug verbose skiptests -./build.sh clang3.9 x86 debug verbose cross skiptests +sudo ./cross/build-rootfs.sh armel tizen +sudo ./cross/build-rootfs.sh x86 xenial +./build.sh armel debug verbose cross +./build.sh x86 debug verbose cross crosstarget skiptests ``` -4. Copy necessary binaries to working directory (in x86 rootfs) +4. Copy necessary binaries to working directory in x86 rootfs. +Or in any host directory, if you have 32-bit multiarch-support on your x64 host. ``` -cp ${CORECLR}/bin/Product/Linux.x86.Checked ${WORKING_DIR} -cp ${CORERT}/bin/Linux.x86.Debug/tools/ilc.dll ${WORKING_DIR} -cp ${CORERT}/bin/Linux.x86.Debug/tools/ILCompiler.* ${WORKING_DIR} -cp ${CORERT}/bin/Linux.x86.Debug/tools/System.CommandLine.dll ${WORKING_DIR} -cp ${CORERT}/bin/Linux.x86.Debug/tools/Microsoft.DiaSymReader.dll ${WORKING_DIR} -cp ${CORERT}/bin/Linux.x86.Debug/tools/jitinterface.so ${WORKING_DIR} -cp -r ${CORERT}/bin/Linux.x86.Debug/framework ${WORKING_DIR} - -# Copy CoreRT sdk binaries from target (armel) output folder +# 1) Copy CoreCLR(with CoreRun) part +cp ${CORECLR}/bin/Product/Linux.x86.Debug/* ${WORKING_DIR} + +# 2) Copy CoreRT part +cp ${CORERT}/bin/Linux.armel.Debug/tools/ilc.dll ${WORKING_DIR} +cp ${CORERT}/bin/Linux.armel.Debug/tools/ILCompiler.* ${WORKING_DIR} +cp ${CORERT}/bin/Linux.armel.Debug/tools/System.CommandLine.dll ${WORKING_DIR} +cp ${CORERT}/bin/Linux.armel.Debug/tools/Microsoft.DiaSymReader.dll ${WORKING_DIR} +cp -r ${CORERT}/bin/Linux.armel.Debug/framework ${WORKING_DIR} cp -r ${CORERT}/bin/Linux.armel.Debug/sdk ${WORKING_DIR} + +# 3) Copy CoreRT x86 jitinterface with target armel version +cp ${CORERT}/bin/Linux.x86.Debug/tools/armeljitinterface.so ${WORKING_DIR}/jitinterface.so + +# 4) Copy CoreFX part +# Copy native architecture dependence libs +cp ${COREFX}/bin/Linux.x86.Debug/native/* ${WORKING_DIR} +# Copy arch independence libs +# This part varies depending on the application, these dependencies for HelloWorld only +NETCORE_PATH=netcoreapp-Linux-Debug-x64 +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.Extensions.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Collections.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Reflection.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Reflection.Metadata.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Collections.Immutable.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Console.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.IO.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.InteropServices.RuntimeInformation.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.InteropServices.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Threading.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Diagnostics.Debug.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Linq.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.IO.FileSystem.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.IO.MemoryMappedFiles.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.IO.UnmanagedMemoryStream.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.IO.FileSystem.Primitives.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.Handles.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Text.Encoding.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Text.Encoding.Extensions.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Reflection.Primitives.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Collections.Concurrent.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Security.Cryptography.Algorithms.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Security.Cryptography.Primitives.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Runtime.CompilerServices.Unsafe.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Globalization.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Private.Xml.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Diagnostics.Tracing.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Buffers.dll ${WORKING_DIR} +cp ${COREFX}/bin/runtime/${NETCORE_PATH}/System.Memory.dll ${WORKING_DIR} ``` 5. Rename RyuJIT compiler library ``` # Use cross-compiler library as default for ILC +# libclrjit.so is used by the CoreCLR that compiler runs on, +# and libclrjitilc.so is used for the actual compilation. cp ${WORKING_DIR}/libarmelnonjit.so ${WORKING_DIR}/libclrjitilc.so - -# ... or ARM version instead if it's needed -# cp ${WORKING_DIR}/libprotojit.so ${WORKING_DIR}/libclrjitilc.so ``` 6. [Build ObjectWriter library](how-to-build-ObjectWriter.md). You have to compile it on x86 chroot. 7. And to execute use: ``` +# Hello.ilc.rsp is in CoreRT armel build. It's necessary to edit the paths on the relatively our working directory. ./corerun ilc.dll --codegenopt "AltJitNgen=*" --verbose @Hello.ilc.rsp + # Any other options to RyuJIT could be passed via --codegenopt argument, e.g.: -#./corerun ilc.dll --codegenopt "AltJitNgen=*" --codegenopt "NgenDisasm=*" --verbose @Hello.ilc.rsp +# ./corerun ilc.dll --codegenopt "AltJitNgen=*" --codegenopt "NgenDisasm=*" --verbose @Hello.ilc.rsp # For linking -clang-3.9 -target arm-linux-gnueabi --sysroot=corert/cross/rootfs/armel -Bcorert/cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 -Lcorert/cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 Hello.o -o Hello corert/bin/Linux.armel.Debug/sdk/libbootstrapper.a corert/bin/Linux.armel.Debug/sdk/libRuntime.a corert/bin/Linux.armel.Debug/sdk/libSystem.Private.CoreLib.Native.a corert/bin/Linux.armel.Debug/framework/System.Native.a corert/bin/Linux.armel.Debug/framework/libSystem.Globalization.Native.a -g -Wl,-rpath,'$ORIGIN' -pthread -lstdc++ -ldl -lm -luuid -lrt -fPIC +clang -target arm-linux-gnueabi --sysroot=corert/cross/rootfs/armel -Bcorert/cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 -Lcorert/cross/rootfs/armel/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1 Hello.o -o Hello corert/bin/Linux.armel.Debug/sdk/libbootstrapper.a corert/bin/Linux.armel.Debug/sdk/libRuntime.a corert/bin/Linux.armel.Debug/sdk/libSystem.Private.CoreLib.Native.a corert/bin/Linux.armel.Debug/framework/System.Native.a corert/bin/Linux.armel.Debug/framework/System.Globalization.Native.a -g -Wl,-rpath,'$ORIGIN' -pthread -lstdc++ -ldl -lm -luuid -lrt -fPIC ``` |