Skip to content
Merged
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
5 changes: 4 additions & 1 deletion eng/common/cross/toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(TOOLCHAIN "i686-linux-gnu")
elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(triple "x86_64-unknown-freebsd11")
set(triple "x86_64-unknown-freebsd12")
elseif (ILLUMOS)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "x86_64-illumos")
Expand Down Expand Up @@ -90,6 +90,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_ASM_COMPILER_TARGET ${triple})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
elseif(ILLUMOS)
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
Expand Down
2 changes: 1 addition & 1 deletion eng/common/native/find-native-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if [ -z "$CLR_CC" ]; then
# Set default versions
if [ -z "$majorVersion" ]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
if [ "$compiler" = "clang" ]; then versions=( 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi

for version in "${versions[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion eng/native/init-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [[ -z "$CLR_CC" ]]; then
# Set default versions
if [[ -z "$majorVersion" ]]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [[ "$compiler" == "clang" ]]; then versions=( 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
if [[ "$compiler" == "clang" ]]; then versions=( 12 11 10 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [[ "$compiler" == "gcc" ]]; then versions=( 11 10 9 8 7 6 5 4.9 ); fi

for version in "${versions[@]}"; do
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ jobs:
targetRid: freebsd-x64
platform: FreeBSD_x64
container:
image: ubuntu-18.04-cross-freebsd-11-20200407092345-a84b0d2
image: ubuntu-18.04-cross-freebsd-12-20210813173449-f13d79e
registry: mcr
jobParameters:
runtimeFlavor: ${{ parameters.runtimeFlavor }}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Native/Unix/System.Native/extra_libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ macro(append_extra_system_libs NativeLibsExtra)
list(APPEND ${NativeLibsExtra} rt)
elseif (CLR_CMAKE_TARGET_FREEBSD)
list(APPEND ${NativeLibsExtra} pthread)
find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib)
find_library(INOTIFY_LIBRARY inotify HINTS ${CROSS_ROOTFS}/usr/local/lib)
list(APPEND ${NativeLibsExtra} ${INOTIFY_LIBRARY})
elseif (CLR_CMAKE_TARGET_SUNOS)
list(APPEND ${NativeLibsExtra} socket)
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/Native/Unix/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ set (CMAKE_REQUIRED_FLAGS ${PREVIOUS_CMAKE_REQUIRED_FLAGS})

set (PREVIOUS_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
if (HAVE_SYS_INOTIFY_H AND CLR_CMAKE_TARGET_FREEBSD)
set (CMAKE_REQUIRED_LIBRARIES "-linotify -L/usr/local/lib")
set (CMAKE_REQUIRED_LIBRARIES "-linotify -L${CROSS_ROOTFS}/usr/local/lib")
endif()

check_symbol_exists(
Expand Down
12 changes: 11 additions & 1 deletion src/mono/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(HOST_SOLARIS 1)
add_definitions(-DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DHOST_SOLARIS -D__EXTENSIONS__ -D_XPG4_2)
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
set(HOST_FREEBSD 1)
else()
message(FATAL_ERROR "Host '${CMAKE_SYSTEM_NAME}' not supported.")
endif()
Expand Down Expand Up @@ -292,6 +294,8 @@ elseif(TARGET_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_WIN32 1)
elseif(TARGET_SYSTEM_NAME STREQUAL "SunOS")
set(TARGET_SOLARIS 1)
elseif(TARGET_SYSTEM_NAME STREQUAL "FreeBSD")
set(TARGET_FREEBSD 1)
else()
message(FATAL_ERROR "Target '${TARGET_SYSTEM_NAME}' not supported.")
endif()
Expand Down Expand Up @@ -320,7 +324,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL
set(CMAKE_SYSTEM_PROCESSOR "x86")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
set(CMAKE_SYSTEM_PROCESSOR "arm64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x64")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
endif()

Expand Down Expand Up @@ -594,6 +598,12 @@ elseif(HOST_WIN32)
elseif(HOST_SOLARIS)
set(ICU_FLAGS "-DPALEXPORT=\"\" -DTARGET_UNIX -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option")
set(HAVE_SYS_ICU 1)
elseif(TARGET_FREEBSD)
set(ICU_FLAGS "-DTARGET_UNIX -Wno-deprecated-declarations")
set(HAVE_SYS_ICU 1)
set(ICU_LIBS icuuc icui18n)
set(ICU_INCLUDEDIR "${CROSS_ROOTFS}/usr/local/include")
set(ICU_LIBDIR "${CROSS_ROOTFS}/usr/local/lib")
else()
message(FATAL_ERROR "Unknown host")
endif()
Expand Down
6 changes: 6 additions & 0 deletions src/mono/cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,9 @@ if(HOST_SOLARIS)
set(HAVE_NETINET_TCP_H 1)
set(HAVE_GETADDRINFO 1)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD fails earlier ac_check_headers for these because <sys/types.h> is needed.
set(HAVE_SYS_SYSCTL_H 1)
set(HAVE_SYS_USER_H 1)
endif()
2 changes: 1 addition & 1 deletion src/mono/cmake/eglib-config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#else

#if @HAVE_ALLOCA_H@ == 1
#ifdef HAVE_ALLOCA_H
#define G_HAVE_ALLOCA_H
#endif

Expand Down
6 changes: 6 additions & 0 deletions src/mono/mono.proj
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@
<_MonoBuildEnv Include="PKG_CONFIG_PATH=$(MonoCrossDir)/usr/lib/s390x-linux-gnu/pkgconfig" />
</ItemGroup>

<!-- x64 FreeBSD cross build options -->
<ItemGroup Condition="'$(TargetsFreeBSD)' == 'true' and '$(MonoCrossDir)' != ''">
<_MonoCMakeArgs Include="-DCMAKE_TOOLCHAIN_FILE=$([MSBuild]::NormalizePath('$(RepositoryEngineeringDir)', 'common', 'cross', 'toolchain.cmake'))" />
<_MonoBuildEnv Include="TARGET_BUILD_ARCH=x64" />
</ItemGroup>

<!-- Windows specific options -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<_MonoCPPFLAGS Include="-DWIN32" />
Expand Down
4 changes: 3 additions & 1 deletion src/mono/mono/mini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ elseif(HOST_WIN32)
set(OS_LIBS bcrypt.lib Mswsock.lib ws2_32.lib psapi.lib version.lib advapi32.lib winmm.lib kernel32.lib)
elseif(HOST_SOLARIS)
set(OS_LIBS socket pthread m ${CMAKE_DL_LIBS})
elseif(HOST_FREEBSD)
set(OS_LIBS pthread m)
endif()

#
Expand Down Expand Up @@ -254,7 +256,7 @@ set(posix_sources

if(HOST_DARWIN)
set(os_sources "${darwin_sources};${posix_sources}")
elseif(HOST_LINUX OR HOST_SOLARIS)
elseif(HOST_LINUX OR HOST_SOLARIS OR HOST_FREEBSD)
set(os_sources "${posix_sources}")
elseif(HOST_WIN32)
set(os_sources "${windows_sources}")
Expand Down