Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 20 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

usage()
{
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [verbose] [clangx.y] [platform]"
echo "Usage: $0 [managed] [native] [BuildArch] [BuildType] [clean] [cross] [verbose] [clangx.y] [platform]"
echo "managed - optional argument to build the managed code"
echo "native - optional argument to build the native code"
echo "The following arguments affect native builds only:"
Expand All @@ -12,6 +12,8 @@ usage()
echo "verbose - optional argument to enable verbose build output."
echo "clangx.y - optional argument to build using clang version x.y."
echo "platform can be: FreeBSD, Linux, NetBSD, OSX, Windows"
echo "cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."

exit 1
}
Expand Down Expand Up @@ -99,7 +101,7 @@ prepare_native_build()
build_managed_corefx()
{
__buildproj=$__scriptpath/build.proj
__buildlog=$__scriptpath/msbuild.log
__buildlog=$__scriptpath/msbuild.$__BuildArch.log
__binclashlog=$__scriptpath/binclash.log
__binclashloggerdll=$__scriptpath/Tools/Microsoft.DotNet.Build.Tasks.dll

Expand All @@ -121,8 +123,8 @@ build_native_corefx()
cd "$__IntermediatesDir"

# Regenerate the CMake solution
echo "Invoking cmake with arguments: \"$__nativeroot\" $__CMakeArgs"
"$__nativeroot/gen-buildsys-clang.sh" "$__nativeroot" $__ClangMajorVersion $__ClangMinorVersion $__CMakeArgs
echo "Invoking cmake with arguments: \"$__ProjectRoot\" $__BuildType"
"$__ProjectRoot/src/Native/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__BuildType

# Check that the makefiles were created.

Expand Down Expand Up @@ -157,7 +159,7 @@ build_native_corefx()
}

__scriptpath=$(cd "$(dirname "$0")"; pwd -P)
__nativeroot=$__scriptpath/src/Native
__ProjectRoot=$__scriptpath
__packageroot=$__scriptpath/packages
__sourceroot=$__scriptpath/src
__nugetpath=$__packageroot/NuGet.exe
Expand Down Expand Up @@ -245,7 +247,6 @@ case $OSName in
esac
__BuildOS=$__HostOS
__BuildType=Debug
__CMakeArgs=DEBUG

case $__HostOS in
FreeBSD)
Expand All @@ -268,6 +269,7 @@ __CleanBuild=false
__VerboseBuild=false
__ClangMajorVersion=3
__ClangMinorVersion=5
__CrossBuild=0

for i in "$@"
do
Expand Down Expand Up @@ -304,7 +306,6 @@ for i in "$@"
;;
release)
__BuildType=Release
__CMakeArgs=RELEASE
;;
clean)
__CleanBuild=1
Expand Down Expand Up @@ -348,6 +349,9 @@ for i in "$@"
__BuildOS=Windows_NT
__TestNugetRuntimeId=win7-x64
;;
cross)
__CrossBuild=1
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
esac
Expand All @@ -362,11 +366,19 @@ fi

# Disable the native build when targeting Windows.

if [ "$__BuildOS" != "$__HostOS" ]; then
if [ "$__BuildOS" != "$__HostOS" ] && [ $__CrossBuild == 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this part. We warn that cross-compilation isn't yet supported if CrossBuild isn't set, but if it is set, we don't warn?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rereading it again, I think that I should have left things as they are for the condition, but changed the warning message to be more explicit. It should say something along the lines of:
echo "Warning: compiling native components for a different OS is not yet supported"

Would you agree?

echo "Warning: cross compiling native components is not yet supported"
__buildnative=false
fi

# Configure environment if we are doing a cross compile.
if [ $__CrossBuild == 1 ]; then
export CROSSCOMPILE=1
if ! [[ -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__ProjectRoot/cross/rootfs/$__BuildArch"
fi
fi

# Set the remaining variables based upon the determined build configuration
__IntermediatesDir="$__rootbinpath/obj/$__BuildOS.$__BuildArch.$__BuildType/Native"
__BinDir="$__rootbinpath/$__BuildOS.$__BuildArch.$__BuildType/Native"
Expand Down
11 changes: 11 additions & 0 deletions cross/arm/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these references to Ubuntu and trusty... so is this support only valid on Ubuntu 14.*?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (this file is identical to the same file in CoreCLR/RT).

28 changes: 28 additions & 0 deletions cross/arm/toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})

set(CMAKE_SYSTEM_NAME Linux)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you request a cross build, should we display a warning and disable it if you're not on a supported system? e.g. what happens if someone tries to specify cross on OS X?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the same problem with CoreCLR and CoreRT.

set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR armv7l)

add_compile_options(-target armv7-linux-gnueabihf)
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
add_compile_options(--sysroot=${CROSS_ROOTFS})

set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -target arm-linux-gnueabihf")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/arm-linux-gnueabihf")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/arm-linux-gnueabihf")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)

set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/arm-linux-gnueabihf" CACHE STRING "")
set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "")
108 changes: 108 additions & 0 deletions cross/arm/tryrun.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
SET( REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( SSCANF_SUPPORT_ll_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_SCHED_GET_PRIORITY_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_WORKING_GETTIMEOFDAY_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_WORKING_CLOCK_GETTIME_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_CLOCK_MONOTONIC_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_MMAP_DEV_ZERO_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( MMAP_IGNORES_HINT_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( MMAP_DOESNOT_ALLOW_REMAP_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( SEM_INIT_MODIFIES_ERRNO_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_ACOS_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_ASIN_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_POW_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_VALID_NEGATIVE_INF_POW_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_VALID_POSITIVE_INF_POW_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_ATAN2_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_LOG_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_COMPATIBLE_LOG10_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( UNGETC_NOT_RETURN_EOF_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAS_POSIX_SEMAPHORES_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( GETPWUID_R_SETS_ERRNO_EXITCODE
0
CACHE STRING "Result from TRY_RUN" FORCE)

SET( FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

SET( HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE
1
CACHE STRING "Result from TRY_RUN" FORCE)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of these aren't used in this repo, right? Can we remove them and only include the ones that are?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do a cleanup when I'm back.

11 changes: 11 additions & 0 deletions cross/arm64/sources.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted universe

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-backports main restricted

deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports/ trusty-security main restricted universe multiverse
23 changes: 23 additions & 0 deletions cross/arm64/toolchain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

add_compile_options(-target aarch64-linux-gnu)
add_compile_options(--sysroot=${CROSS_ROOTFS})

set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -target aarch64-linux-gnu")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-linux-gnu")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/aarch64-linux-gnu")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)

set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Loading