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
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)
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?
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.)
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.