2

我正在尝试按照文档进行本地构建pyarrow。具体来说,使用conda说明:

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 \
      ..

cmake指令失败并显示以下错误消息:

-- 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".

特别是,违规行似乎是:

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

我在 macOS Mojave 10.14.4 上,并且已经安装了 Xcode 10.2.1(通过Apple Developer 下载列表)。我跑的时候xcode-select -p就出来了/Applications/Xcode.app/Contents/Developer

搜索此错误消息将我带到此 GH 评论,它指向此 SO 答案。我按照该答案中的说明进行操作,特别是运行sudo xcode-select -s /Applications/Xcode.app/Contents/Developer,但它没有解决问题。

的内容libSystem.tbd是:

--- !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 ]
...

我做错了什么,如何修复我的环境以便我可以正确构建 CMake?

4

1 回答 1

7

这里的问题是您缺少使用 conda-forge 提供的编译器构建的正确 OSX SDK。

您需要从例如https://github.com/phracker/MacOSX-SDKs/releases下载 10.9 OSX SDK并将其解压缩到您的硬盘上,例如 /opt/MacOSX10.9.sdk。激活 conda 环境后,使用export CONDA_BUILD_SYSROOT=/opt/MacOSX10.9.sdk.

于 2019-04-22T18:08:18.027 回答