configure: error: C compiler cannot create executables in mac os terminal

﹥>﹥吖頭↗ 提交于 2019-12-02 05:26:54
JZ.

If you are on Lion try installing with the tag: --with-gcc=clang

Running rvm requirements explains this in more detail:

Xcode 4.2:
 * is only supported by ruby 1.9.3+ using command line flag: --with-gcc=clang
 * it breaks gems with native extensions, especially DB drivers.

Xcode 4.2 users - please be warned - 
in case of any compilation issues 
 * downgrade to Xcode 4.1
 * or install osx-gcc-installer
and reinstall your rubies.

The problem is the spaces in the pathnames. What's more, there isn't an easy fix until you remove them.

The trouble is in the log file - it just appears near the middle of it...

configure:4112: checking for C compiler version
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 --version >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -v >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -V >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4121: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -qversion >&5
./configure: line 4123: /Developer: is a directory
configure:4132: $? = 126
configure:4151: checking whether the C compiler works
configure:4173: /Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1 -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk  -isysroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk -Wl,-syslibroot /Developer\ 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk conftest.c  >&5
./configure: line 4175: /Developer: is a directory
configure:4177: $? = 126
configure:4215: result: no

To get the paths with the spaces to work, you'd have to be able to ensure that whenever CC is used, the path is enclosed in double quotes. You'd also have to fettle your CFLAGS value so that the path is not split but the -isysroot is separate from the path leading to -isysroot.

If you want to get adventurous, you can try using:

export CC="\"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1\""
export CFLAGS="-isysroot \"/Developer 4.2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk\""

There's an outside chance it will work, but I'd not want to rely on it. Basically, it adds double quotes at judiciously selected points in the values of the environment variables, in the hope that the shell will manage to keep them in the right places. I don't think it will work, but it might be worth a try.

I recommend renaming the path where you have the software installed without the space, maybe as:

/Developer-4.2/Platforms/...

(I had a directory $HOME/External Source Repositories briefly, with areas for git and svn and hg (Mercurial) copies of external source repositories, including the VCS's mentioned. The VCS were OK with the spaces in the names, but the build processes for the downloaded repositories (including the VCS own build systems) were not (git included, IIRC). The directory is now called $HOME/External-Source-Repositories instead.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!