Cordova命令行构建失败在/ tmp在Mac上 [英] Cordova command-line build fails in /tmp on Mac
问题描述
我从命令行创建一个全新的PhoneGap应用程序时出现链接器错误。它创建了一堆文件,如果我在Xcode中打开创建的 .xcodeproj
,它构建得很好。那么我的命令行环境有什么问题?
I get a linker error building a brand-new PhoneGap app from the command line. It creates a bunch of files, and if I open the created .xcodeproj
in Xcode, it builds just fine. So what's wrong with my command-line environment?
$ phonegap create /tmp/buildtest-ios
$ cd /tmp/buildtest-ios
$ phonegap -V build ios
[phonegap] detecting iOS SDK environment...
[phonegap] Checking iOS requirements...
[phonegap] using the local environment
[phonegap] compiling iOS...
[phonegap] Generating config.xml from defaults for platform "ios"
[phonegap] Compiling app on platform "ios" via command "/private/tmp/buildtest-ios/platforms/ios/cordova/build"
[error] An error occurred while building the ios project.** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
** BUILD FAILED **
The following build commands failed:
Ld /private/tmp/buildtest-ios/platforms/ios/build/emulator/HelloWorld.app/HelloWorld normal i386
(1 failure)
如果我从命令行运行命令 Ld
命令,我得到文件未找到。这是否意味着编译器失败,链接器错误只是一个鲱鱼?
If I run the offending Ld
command myself from the command line, I get "file not found". Does that mean the compiler failed and the linker error is just a red herring?
这是PhoneGap 3.3.0-0.18.0在Mac OS X 10.9。我可以创建和构建一个Android应用程序与这个安装,没有麻烦。如果我直接使用 cordova
,我得到完全相同的行为。
This is PhoneGap 3.3.0-0.18.0 on Mac OS X 10.9. I can create and build an Android app with this installation, no trouble. I get the exact same behavior if I use cordova
directly. I've tried it on two Macs with the same symptom.
推荐答案
我终于找到了答案使用 cordova
命令行工具。 Cordova有一个 -d
标志,比PhoneGap的 -V
标志更冗长。链接器失败,出现一大堆错误
I finally discovered the answer using the cordova
command-line tools. Cordova has a -d
flag which is way more verbose than PhoneGap's -V
flag. The linker was failing with a bunch of errors like
duplicate symbol _OBJC_METACLASS_$_CDVTimer in:
/private/tmp/buildtest-ios/platforms/ios/build/emulator/libCordova.a(CDVTimer.o)
/tmp/buildtest-ios/platforms/ios/build/emulator/libCordova.a(CDVTimer.o)
$ b / private / tmp
,因此这些指向同一个文件。难怪他们是重复的符号!
Note that /tmp
on Mac is a symlink to /private/tmp
, so these are pointing to the same file. No wonder they're duplicate symbols! So why is it trying to include the same file twice?
我尝试在一个空文件夹中创建一个新的测试项目 / private / my-new -tmp2 / buildtest-ios
。构建它失败与相同的错误。显然,在Mac OS X 10.9的 / private
目录中,Cordova的iOS项目和 Ld
我是唯一一个曾经试过这个的人。 (正如我所说,为Android构建正常。)
I tried creating a new test project in an empty folder /private/my-new-tmp2/buildtest-ios
. Building it failed with the same error. So apparently something is weird with Cordova's iOS projects and the Ld
linker in the /private
directory on Mac OS X 10.9, and I'm the only person who's ever tried this. (As I said, building for Android works fine.)
如果有人遇到同样的问题,解决方案是在<$ c $而不是 / tmp
或 / private $ c $>中的任何位置使用 / Users / me / some / directory
c>。问题解决。
In case someone else ever runs into the same problem, the solution is to build the project in /Users/me/some/directory
rather than anywhere in /tmp
or /private
. Problem solved.
这篇关于Cordova命令行构建失败在/ tmp在Mac上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!