2

I am attempting to follow the documentation for building pyarrow locally. Specifically, using the conda instructions:

conda create -y -n pyarrow-dev -c conda-forge \
    --file arrow/ci/conda_env_unix.yml \
    --file arrow/ci/conda_env_cpp.yml \
    --file arrow/ci/conda_env_python.yml \
    compilers \
    python=3.7
conda activate pyarrow-dev
export ARROW_HOME=$CONDA_PREFIX
git clone https://github.com/apache/arrow.git
mkdir arrow/cpp/build
pushd arrow/cpp/build
cmake -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
      -DCMAKE_INSTALL_LIBDIR=lib \
      -DARROW_FLIGHT=ON \
      -DARROW_GANDIVA=ON \
      -DARROW_ORC=ON \
      -DARROW_PARQUET=ON \
      -DARROW_PYTHON=ON \
      -DARROW_PLASMA=ON \
      -DARROW_BUILD_TESTS=ON \
      ..

The cmake instruction is failing with the following error message:

-- Building using CMake version: 3.12.3
-- The C compiler identification is Clang 4.0.1
-- The CXX compiler identification is Clang 4.0.1
-- Check for working C compiler: /Users/alex/miniconda3/envs/pyarrow-dev/bin/x86_64-apple-darwin13.4.0-clang
-- Check for working C compiler: /Users/alex/miniconda3/envs/pyarrow-dev/bin/x86_64-apple-darwin13.4.0-clang -- broken
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/Users/alex/miniconda3/envs/pyarrow-dev/bin/x86_64-apple-darwin13.4.0-clang"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/alex/Desktop/arrow/cpp/build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_63f1f/fast"
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_63f1f.dir/build.make CMakeFiles/cmTC_63f1f.dir/build
    Building C object CMakeFiles/cmTC_63f1f.dir/testCCompiler.c.o
    /Users/alex/miniconda3/envs/pyarrow-dev/bin/x86_64-apple-darwin13.4.0-clang   -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk   -o CMakeFiles/cmTC_63f1f.dir/testCCompiler.c.o   -c /Users/alex/Desktop/arrow/cpp/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_63f1f
    /usr/local/Cellar/cmake/3.12.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_63f1f.dir/link.txt --verbose=1
    /Users/alex/miniconda3/envs/pyarrow-dev/bin/x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs  CMakeFiles/cmTC_63f1f.dir/testCCompiler.c.o  -o cmTC_63f1f 
    ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
    ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
    clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_63f1f] Error 1
    make: *** [cmTC_63f1f/fast] Error 2




  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:25 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/alex/Desktop/arrow/cpp/build/CMakeFiles/CMakeOutput.log".
See also "/Users/alex/Desktop/arrow/cpp/build/CMakeFiles/CMakeError.log".

In particular, the offending line seems to be:

ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd

I am on macOS Mojave 10.14.4, and have installed Xcode 10.2.1 (via the Apple Developer download list). When I run xcode-select -p I get out /Applications/Xcode.app/Contents/Developer.

Searching this error message brought me to this GH comment, which pointe to this SO answer. I followed the instructions in that answer, specifically running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer, but it did not solve the issue.

The contents of libSystem.tbd are:

--- !tapi-tbd-v3
archs:           [ x86_64 ]
uuids:           [ 'x86_64: 72841192-B0C9-36A0-8E55-ED651EADEF08' ]
platform:        zippered
install-name:    /usr/lib/libSystem.B.dylib
current-version: 1252.250.1
objc-constraint: none
exports:         
  - archs:           [ x86_64 ]
    re-exports:      [ /usr/lib/system/libcache.dylib, /usr/lib/system/libcommonCrypto.dylib, 
                       /usr/lib/system/libcompiler_rt.dylib, /usr/lib/system/libcopyfile.dylib, 
                       /usr/lib/system/libcorecrypto.dylib, /usr/lib/system/libdispatch.dylib, 
                       /usr/lib/system/libdyld.dylib, /usr/lib/system/libkeymgr.dylib, 
                       /usr/lib/system/liblaunch.dylib, /usr/lib/system/libmacho.dylib, 
                       /usr/lib/system/libquarantine.dylib, /usr/lib/system/libremovefile.dylib, 
                       /usr/lib/system/libsystem_asl.dylib, /usr/lib/system/libsystem_blocks.dylib, 
                       /usr/lib/system/libsystem_c.dylib, /usr/lib/system/libsystem_configuration.dylib, 
                       /usr/lib/system/libsystem_coreservices.dylib, /usr/lib/system/libsystem_darwin.dylib, 
                       /usr/lib/system/libsystem_dnssd.dylib, /usr/lib/system/libsystem_info.dylib, 
                       /usr/lib/system/libsystem_kernel.dylib, /usr/lib/system/libsystem_m.dylib, 
                       /usr/lib/system/libsystem_malloc.dylib, /usr/lib/system/libsystem_networkextension.dylib, 
                       /usr/lib/system/libsystem_notify.dylib, /usr/lib/system/libsystem_platform.dylib, 
                       /usr/lib/system/libsystem_pthread.dylib, /usr/lib/system/libsystem_sandbox.dylib, 
                       /usr/lib/system/libsystem_secinit.dylib, /usr/lib/system/libsystem_symptoms.dylib, 
                       /usr/lib/system/libsystem_trace.dylib, /usr/lib/system/libunwind.dylib, 
                       /usr/lib/system/libxpc.dylib ]
    symbols:         [ 'R8289209$_close', 'R8289209$_fork', 'R8289209$_fsync', 'R8289209$_getattrlist', 
                       'R8289209$_getrlimit', 'R8289209$_getxattr', 'R8289209$_open', 
                       'R8289209$_pthread_attr_destroy', 'R8289209$_pthread_attr_init', 
                       'R8289209$_pthread_attr_setdetachstate', 'R8289209$_pthread_create', 
                       'R8289209$_pthread_mutex_lock', 'R8289209$_pthread_mutex_unlock', 
                       'R8289209$_pthread_self', 'R8289209$_ptrace', 'R8289209$_read', 
                       'R8289209$_setattrlist', 'R8289209$_setrlimit', 'R8289209$_sigaction', 
                       'R8289209$_stat', 'R8289209$_sysctl', 'R8289209$_time', 'R8289209$_unlink', 
                       'R8289209$_write', ___crashreporter_info__, _libSystem_atfork_child, 
                       _libSystem_atfork_parent, _libSystem_atfork_prepare, _mach_init_routine ]
...

What am I doing wrong, and how do I repair my environment so that I can get CMake building correct?

Aleksey Bilogur
  • 3,686
  • 3
  • 30
  • 57
  • 1
    Hi -- would you like to write to the Arrow developer mailing list dev@arrow.apache.org where we may be able to help you better? Though the issue you're having seems to be environmental and not Arrow-specific per se – Wes McKinney Apr 22 '19 at 17:41

1 Answers1

7

The problem here is that you are missing the correct OSX SDK to build with the conda-forge provided compilers.

You need to download the 10.9 OSX SDK from e.g. https://github.com/phracker/MacOSX-SDKs/releases and extract it onto your harddrive at e.g. /opt/MacOSX10.9.sdk. After you then have activated your conda environment set the path to this SDK using export CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk.

Uwe L. Korn
  • 8,080
  • 1
  • 30
  • 42
  • This solved this issue (I take it that Arrow does not build on MacOSX10.14.sdk, because it is newer and introduced breaking changes?). However, it caused a different issue: `Could not find a configuration file for package "LLVM" that is compatible with requested version "7.0".` The error message indicates that CMake found, but did not accept, `/Users/alex/miniconda3/envs/pyarrow-dev/lib/cmake/llvm/LLVMConfig.cmake, version: 4.0.1`. – Aleksey Bilogur Apr 22 '19 at 18:40
  • The ["XCode" article on Wikipedia](https://en.wikipedia.org/wiki/Xcode#Toolchain_versions) implies that the version of LLVM that is bundled with `pyarrow` is only compatible with `XCode` "9.2ish". What version of XCode is the `pyarrow` dev team using? – Aleksey Bilogur Apr 22 '19 at 18:45
  • 2
    Arrow builds with the newer SDK, just not the conda-forge compilers (i.e. you would need a fully different setup). For the latter error, this is due to package conflicts in conda-forge. At the moment, you cannot build the Gandiva feature on OSX; simply set `ARROW_GANDIVA` to `OFF`. – Uwe L. Korn Apr 22 '19 at 18:46
  • 1
    That solves it. Setting `ARROW_GANDIVA` to `OFF` induces a successful build. I would consider (1) documenting that there may be problems building `ARROW_GANDIVA` on macOS using the `conda` code path in the devdocs (unless this is a temporary problem?) and (2) state which versions of the XCode SDK are known to be good for this build path. – Aleksey Bilogur Apr 22 '19 at 18:51
  • you save my day dude – Tran Minh Oct 04 '19 at 07:07