Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Fix FreeBSD build and update build instructions (#15998)
Browse files Browse the repository at this point in the history
Move test code include in global CMakeLists before PAL runtime includes to
avoid conflicts between PAL and system headers.
(ForeignThreadExceptionsNative.cpp -> thread -> functional -> memory ->
cassert -> pal rt "assert.h".)  Drop no longer needed remove_definitions
lines -- they're only set by the clrdefinitions.cmake include later in
the file.

Update build instructions to include needed components (ninja,
lttng-ust, python27).

Add missing ElfW() definition when libunwind does not define it.

FreeBSD alloca() is defined in stdlib.h, so include that instead of
alloca.h on FreeBSD.
  • Loading branch information
cemeyer authored and janvorli committed Jan 26, 2018
1 parent d08b5fd commit c8fef83
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
19 changes: 7 additions & 12 deletions CMakeLists.txt
Expand Up @@ -588,6 +588,13 @@ if(WIN32)
add_compile_options(/Zl) # omit default library name in .OBJ
endif(WIN32)

#------------------------------
# Add Test Directory
#------------------------------
if(CLR_CMAKE_BUILD_TESTS)
add_subdirectory(tests)
endif(CLR_CMAKE_BUILD_TESTS)

#--------------------------------
# Definition directives
# - all clr specific compile definitions should be included in this file
Expand Down Expand Up @@ -622,16 +629,4 @@ set(BuildToolsDir "${CLR_CMAKE_PACKAGES_DIR}/Microsoft.DotNet.BuildTools.CoreCLR
#------------------------------
add_subdirectory(src)

#------------------------------
# Add Test Directory
#------------------------------
if(CLR_CMAKE_BUILD_TESTS)
# remove some definitions for test build
remove_definitions(-D_SECURE_SCL=0)
remove_definitions(-DUNICODE)
remove_definitions(-D_UNICODE)

add_subdirectory(tests)
endif(CLR_CMAKE_BUILD_TESTS)

include(definitionsconsistencycheck.cmake)
3 changes: 3 additions & 0 deletions Documentation/building/freebsd-instructions.md
Expand Up @@ -23,6 +23,9 @@ Install the following packages for the toolchain:
- libunwind
- gettext
- icu
- ninja (optional)
- lttng-ust
- python27

To install the packages you need:

Expand Down
3 changes: 3 additions & 0 deletions src/pal/src/exception/remote-unwind.cpp
Expand Up @@ -63,6 +63,9 @@ SET_DEFAULT_DEBUG_CHANNEL(EXCEPT);
#include <elf.h>
#include <link.h>

#ifndef ElfW
#define ElfW(foo) Elf_ ## foo
#endif
#define Ehdr ElfW(Ehdr)
#define Phdr ElfW(Phdr)
#define Shdr ElfW(Shdr)
Expand Down
4 changes: 4 additions & 0 deletions src/pal/src/numa/numa.cpp
Expand Up @@ -31,7 +31,11 @@ SET_DEFAULT_DEBUG_CHANNEL(NUMA);

#include <pthread.h>
#include <dlfcn.h>
#ifdef __FreeBSD__
#include <stdlib.h>
#else
#include <alloca.h>
#endif

#include <algorithm>

Expand Down

0 comments on commit c8fef83

Please sign in to comment.