让 C 编译器在 OS X 上工作?
Making the C compiler work on OS X?
我无法在 Mac OS X 10.11 和 XCode 8.2.1 到 运行 上正确获取 C 编译器。我安装了最新的 XCode 并删除了所有现有的 gcc 二进制文件,但仍然收到以下错误:
-- PCRE: Removing 'configure' log files
-- PCRE: PCRE_WORKING_DIR: /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build
-- PCRE: sh;/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/configure;--prefix=/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE;--disable-shared
-- PCRE: Errors detected - See below.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... /Library/Developer/CommandLineTools/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build':
configure: error: C compiler cannot create executables
CMake Error at /Users/abc/Documents/Slicer/Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:76 (message):
PCRE: Error in configure step. See
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_output.txt
and
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_error.txt
Call Stack (most recent call first):
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step.cmake:3 (ExternalProject_Execute)
make[2]: *** [PCRE-prefix/src/PCRE-stamp/PCRE-configure] Error 1
make[1]: *** [CMakeFiles/PCRE.dir/all] Error 2
make: *** [all] Error 2
如何在我的配置中正确使用 C 编译器?
听起来您想从命令行 运行 C 编译器(而不是 Xcode)。
转到 Apple 的开发者网站 download section 并下载 Command Line Tools (macOS 10.12) for Xcode 8.2
。这可能需要一个有效的开发者帐户。
直接link目前是:Command Line Tools.
我无法在 Mac OS X 10.11 和 XCode 8.2.1 到 运行 上正确获取 C 编译器。我安装了最新的 XCode 并删除了所有现有的 gcc 二进制文件,但仍然收到以下错误:
-- PCRE: Removing 'configure' log files
-- PCRE: PCRE_WORKING_DIR: /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build
-- PCRE: sh;/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/configure;--prefix=/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE;--disable-shared
-- PCRE: Errors detected - See below.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... /Library/Developer/CommandLineTools/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE-prefix/src/PCRE-build':
configure: error: C compiler cannot create executables
CMake Error at /Users/abc/Documents/Slicer/Slicer/CMake/ExternalProjectForNonCMakeProject.cmake:76 (message):
PCRE: Error in configure step. See
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_output.txt
and
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step_error.txt
Call Stack (most recent call first):
/Users/abc/Documents/Slicer/Slicer-SuperBuild-Debug/PCRE_configure_step.cmake:3 (ExternalProject_Execute)
make[2]: *** [PCRE-prefix/src/PCRE-stamp/PCRE-configure] Error 1
make[1]: *** [CMakeFiles/PCRE.dir/all] Error 2
make: *** [all] Error 2
如何在我的配置中正确使用 C 编译器?
听起来您想从命令行 运行 C 编译器(而不是 Xcode)。
转到 Apple 的开发者网站 download section 并下载 Command Line Tools (macOS 10.12) for Xcode 8.2
。这可能需要一个有效的开发者帐户。
直接link目前是:Command Line Tools.