I am having issues installing the gem motion-cocoapods on mavericks. I am using ruby 1.9.3-p484, OS X Mavericks, Xcode 5.1.
我在mavericks上安装了gem moo -cocoapods。我使用的是ruby 1.9.3-p484, OS X Mavericks, Xcode 5.1。
I found lots of solutions but none of them work.
我找到了很多解决办法,但没有一个管用。
Here is my error logs when trying to install
这是我尝试安装时的错误日志。
checking for -std=c99 option to compiler... yes
checking for CoreFoundation... no
checking for main() in -lCoreFoundation... no
CoreFoundation is needed to build the Xcodeproj C extension.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
xcode/mkmf.log file
xcode / mkmf。日志文件
checking for -std=c99 option to compiler... -------------------- yes
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-darwin13.1.0 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe conftest.c -L. -L/Users/**/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"/usr/local/opt/gcc46/bin/gcc-4.6 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-darwin13.1.0 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -std=c99 -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
/* end */
--------------------
have_framework: checking for CoreFoundation... -------------------- no
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-darwin13.1.0 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -std=c99 conftest.c -L. -L/Users/**/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -ObjC -framework CoreFoundation -lpthread -ldl -lobjc "
cc1: error: argument to '-O' should be a non-negative integer
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <CoreFoundation/CoreFoundation.h>
4:
5: int main(void){return 0;}
/* end */
--------------------
have_library: checking for main() in -lCoreFoundation... -------------------- no
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-darwin13.1.0 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -std=c99 conftest.c -L. -L/Users/**/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lCoreFoundation -lpthread -ldl -lobjc "
conftest.c: In function 't':
conftest.c:4:53: error: 'main' undeclared (first use in this function)
conftest.c:4:53: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
/* end */
"/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/x86_64-darwin13.1.0 -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1/ruby/backward -I/Users/**/.rvm/rubies/ruby-1.9.3-p484/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -std=c99 conftest.c -L. -L/Users/**/.rvm/rubies/ruby-1.9.3-p484/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lCoreFoundation -lpthread -ldl -lobjc "
conftest.c: In function 't':
conftest.c:4:1: warning: implicit declaration of function 'main' [-Wimplicit-function-declaration]
ld: library not found for -lCoreFoundation
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: int t() { main(); return 0; }
5: int main(int argc, char **argv)
6: {
7: if (argc > 1000000) {
8: printf("%p", &t);
9: }
10:
11: return 0;
12: }
/* end */
--------------------
Here is some solutions I have tried
这里有一些我尝试过的解决方案。
Reinstall Xcode & point to it
重新安装Xcode并指向它。
xcode-select -p
/Applications/Xcode.app/Contents/Developer
Ran the following command (command line tools for new 10.9 OSX for ruby gems?)
运行以下命令(为ruby gems提供新的10.9 OSX的命令行工具?)
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Ran this command (https://github.com/CocoaPods/CocoaPods/issues/192)
运行这个命令(https://github.com/CocoaPods/CocoaPods/issues/192)
CFLAGS="-F /System/Library/Frameworks" gem install motion-cocoapods -- --with-ldflags="-F/System/Library/Frameworks"
1 个解决方案
#1
1
I had the same symptoms on Mac OS 10.9, rvm 1.25.22, ruby-1.9.3-p484, while trying to run gem install cocoapods
; the issue was that I had both gcc-4.6 and gcc-4.2 installed.
我在Mac OS 10.9上有相同的症状,rvm 1.25.22, ruby-1.9.3-p484,同时尝试运行gem安装cocoapods;问题是我安装了gcc-4.6和gcc-4.2。
RVM apparently decided to run brew install gcc46
for me automatically when I installed a ruby:
显然,RVM决定在我安装ruby时,自动运行brew安装gcc46。
$ rvm install 1.9.3-p484
Checking requirements for osx.
Error: No available formula for gcc46
Installing requirements for osx.
Updating system....
Installing required custom packages: homebrew/versions.
Installing required packages: gcc46...
My mkmf.log (like yours) showed that compilation was using gcc-4.6 and failing. The fix for me was to brew uninstall gcc46
, rvm uninstall 1.9.3-p484
, then brew install apple-gcc42
and rvm install 1.9.3-p484
again.
我的mkmf。日志(像您的一样)显示编译使用了gcc-4.6和失败。我的解决方案是:brew uninstall gcc46, rvm uninstall 1.9.3-p484,然后brew安装apple-gcc42, rvm再安装1.9.3-p484。
With a fresh ruby built from apple-gcc42, and no trace of gcc46 left on my system, gem install cocoapods
worked. No other uninstallation or reinstallation was necessary.
用苹果gcc42制造的新鲜红宝石,在我的系统上没有gcc46的痕迹,gem安装了cocoapods。没有其他的卸载或重新安装是必要的。
#1
1
I had the same symptoms on Mac OS 10.9, rvm 1.25.22, ruby-1.9.3-p484, while trying to run gem install cocoapods
; the issue was that I had both gcc-4.6 and gcc-4.2 installed.
我在Mac OS 10.9上有相同的症状,rvm 1.25.22, ruby-1.9.3-p484,同时尝试运行gem安装cocoapods;问题是我安装了gcc-4.6和gcc-4.2。
RVM apparently decided to run brew install gcc46
for me automatically when I installed a ruby:
显然,RVM决定在我安装ruby时,自动运行brew安装gcc46。
$ rvm install 1.9.3-p484
Checking requirements for osx.
Error: No available formula for gcc46
Installing requirements for osx.
Updating system....
Installing required custom packages: homebrew/versions.
Installing required packages: gcc46...
My mkmf.log (like yours) showed that compilation was using gcc-4.6 and failing. The fix for me was to brew uninstall gcc46
, rvm uninstall 1.9.3-p484
, then brew install apple-gcc42
and rvm install 1.9.3-p484
again.
我的mkmf。日志(像您的一样)显示编译使用了gcc-4.6和失败。我的解决方案是:brew uninstall gcc46, rvm uninstall 1.9.3-p484,然后brew安装apple-gcc42, rvm再安装1.9.3-p484。
With a fresh ruby built from apple-gcc42, and no trace of gcc46 left on my system, gem install cocoapods
worked. No other uninstallation or reinstallation was necessary.
用苹果gcc42制造的新鲜红宝石,在我的系统上没有gcc46的痕迹,gem安装了cocoapods。没有其他的卸载或重新安装是必要的。