【发布时间】:2014-03-31 23:03:19
【问题描述】:
我在 Mavericks 上安装 gem motion-cocoapods 时遇到问题。我正在使用 ruby 1.9.3-p484、OS X Mavericks、Xcode 5.1。
我找到了很多解决方案,但没有一个有效。
这是我尝试安装时的错误日志
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 文件
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 */
--------------------
这是我尝试过的一些解决方案
重新安装 Xcode 并指向它
xcode-select -p
/Applications/Xcode.app/Contents/Developer
运行以下命令 (command line tools for new 10.9 OSX for ruby gems?)
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
运行此命令 (https://github.com/CocoaPods/CocoaPods/issues/192)
CFLAGS="-F /System/Library/Frameworks" gem install motion-cocoapods -- --with-ldflags="-F/System/Library/Frameworks"
【问题讨论】:
-
把
mkmf.log文件的相关内容贴出来怎么样? -
你试过
xcode-select --install吗? -
我已经尝试过了,但我收到了以下错误
can't install the software because it is not currently available from the software update server.。我找到了解决这个问题的方法,并从苹果开发者网站developer.apple.com/downloads/index.action?name=for%20Xcode%20- 单独下载了 xcode 命令行工具。我仍然遇到同样的错误 -
我认为以下错误:
cc1: error: argument to '-O' should be a non-negative integer指的是-ObjC标志。我不是 gcc 极客,所以我无法做出任何详细的推测。但是,我确实相信(直觉)这是命令行工具在某种程度上是错误的。抱歉,我不能更具体。
标签: ruby xcode cocoapods rubymotion