You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2020/01/12 22:15:23 UTC
[arrow] branch master updated: ARROW-7554: [C++] Add support for
building on FreeBSD
This is an automated email from the ASF dual-hosted git repository.
kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 5f6b552 ARROW-7554: [C++] Add support for building on FreeBSD
5f6b552 is described below
commit 5f6b552f27bba6d432406ccac0d11f6e689eaa07
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Mon Jan 13 07:15:04 2020 +0900
ARROW-7554: [C++] Add support for building on FreeBSD
I just confirmed that we can build without any CMake options.
I didn't confirm that our test suite is passed.
We can't build jemalloc with --without-libdl because jemalloc requires
lazy-lock feature on FreeBSD and lazy-lock feature requires libdl.
FreeBSD has /usr/include/machine/endian.h instead of
/usr/include/endian.h.
FreeBSD doesn't have MREMAP_MAYMOVE.
Closes #6168 from kou/cpp-make-buildabile-on-freebsd and squashes the following commits:
8e821bc49 <Sutou Kouhei> Disable jemalloc explicitly on Windows
7571d2f21 <Sutou Kouhei> ARROW-7554: Add support for building on FreeBSD
Authored-by: Sutou Kouhei <ko...@clear-code.com>
Signed-off-by: Sutou Kouhei <ko...@clear-code.com>
---
.github/workflows/cpp.yml | 1 +
cpp/cmake_modules/DefineOptions.cmake | 12 +++++++++++-
cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 -----
cpp/src/arrow/util/bit_util.h | 2 +-
cpp/src/arrow/util/io_util.cc | 2 +-
5 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index c8cebb4..1e6b5e0 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -145,6 +145,7 @@ jobs:
CMAKE_INSTALL_LIBDIR: bin
CMAKE_INSTALL_PREFIX: /usr
ARROW_HOME: /usr
+ ARROW_JEMALLOC: OFF
ARROW_FLIGHT: OFF
ARROW_HDFS: ON
ARROW_PARQUET: OFF
diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake
index 9aa1e75..8d4f757 100644
--- a/cpp/cmake_modules/DefineOptions.cmake
+++ b/cpp/cmake_modules/DefineOptions.cmake
@@ -181,7 +181,17 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
define_option(ARROW_IPC "Build the Arrow IPC extensions" ON)
- define_option(ARROW_JEMALLOC "Build the Arrow jemalloc-based allocator" ON)
+ set(ARROW_JEMALLOC_DESCRIPTION "Build the Arrow jemalloc-based allocator")
+ if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
+ # jemalloc is not supported on Windows.
+ #
+ # jemalloc is the default malloc implementation on FreeBSD and can't
+ # be built with --disable-libdl on FreeBSD. Because lazy-lock feature
+ # is required on FreeBSD. Lazy-lock feature requires libdl.
+ define_option(ARROW_JEMALLOC ${ARROW_JEMALLOC_DESCRIPTION} OFF)
+ else()
+ define_option(ARROW_JEMALLOC ${ARROW_JEMALLOC_DESCRIPTION} ON)
+ endif()
define_option(ARROW_JNI "Build the Arrow JNI lib" OFF)
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 567fd0e..b0c6559 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -1295,11 +1295,6 @@ endif()
# ----------------------------------------------------------------------
# jemalloc - Unix-only high-performance allocator
-if(WIN32)
- # jemalloc is not supported on Windows
- set(ARROW_JEMALLOC off)
-endif()
-
if(ARROW_JEMALLOC)
message(STATUS "Building (vendored) jemalloc from source")
# We only use a vendored jemalloc as we want to control its version.
diff --git a/cpp/src/arrow/util/bit_util.h b/cpp/src/arrow/util/bit_util.h
index 4e1563a..fcac715 100644
--- a/cpp/src/arrow/util/bit_util.h
+++ b/cpp/src/arrow/util/bit_util.h
@@ -20,7 +20,7 @@
#ifdef _WIN32
#define ARROW_LITTLE_ENDIAN 1
#else
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
#include <machine/endian.h>
#else
#include <endian.h>
diff --git a/cpp/src/arrow/util/io_util.cc b/cpp/src/arrow/util/io_util.cc
index a1f5f7c..53c374e 100644
--- a/cpp/src/arrow/util/io_util.cc
+++ b/cpp/src/arrow/util/io_util.cc
@@ -993,7 +993,7 @@ Status MemoryMapRemap(void* addr, size_t old_size, size_t new_size, int fildes,
}
return Status::OK();
#else
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__)
// we have to close the mmap first, truncate the file to the new size
// and recreate the mmap
if (munmap(addr, old_size) == -1) {