0

I am trying to build iOS projects from the command line as part of a CI system. I intend to use the xcodebuild command to get an app file, then the app file will be provided to the xcrun command to get a signed ipa file for distribution.

My projects use Cordova, which is located in the folder <project-folder>/CordovaLib.

In the project folder, I executed the following command from within an Ant script:

xcodebuild -target "<project-name>" -configuration Release clean build

The CordovaLib target was built succesfully, and it was produced the file:

<project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a

This is visible by the following snippet of log:

[exec] CreateUniversalBinary build/Release-iphoneos/libCordova.a normal armv7\ armv7s\ arm64 [exec] cd <project-folder>/CordovaLib [exec] export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/quake/bin:Applications/tools/apache-ant-1.8.4/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin"

[exec]/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static <project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7/libCordova.a <project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/armv7s/libCordova.a <project-folder>/CordovaLib/build/CordovaLib.build/Release-iphoneos/CordovaLib.build/Objects-normal/arm64/libCordova.a -o <project-folder>/CordovaLib/build/Release-iphoneos/libCordova.a

During the build of the target <project-name> I got the following error for three times:

ld: file not found: /build/Release-iphoneos/libCordova.a clang: error: linker command failed with exit code 1 (use -v to see invocation)

And finally:

The following build commands failed: Ld build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7/HelloWorld normal armv7 Ld build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/armv7s/HelloWorld normal armv7s Ld build/HelloWorldProjectHelloWorldIpad.build/Release-iphoneos/HelloWorldProjectHelloWorldIpad.build/Objects-normal/arm64/HelloWorld normal arm64 (3 failures)

So the file libCordova.a was produced in the folder:

<project-folder>/CordovaLib/build/Release-iphoneos

and it was searched instead in:

<project-folder>/build/Release-iphoneos

I'm using Xcode Version 7.1 (7B91b) with iOS 9.1.

Should I set something on Xcode in addition to the parameters I have used in the xcodebuild command from the command line?

Thanks in advance, Simone.

Quake
  • 83
  • 1
  • 9

1 Answers1

0

My project comes from a MEAP IDE. I discovered that the auto-generated project file project.pbxproj had this setting for the linker:

OTHER_LDFLAGS=-force_load "$(BUILT_PRODUCTS_DIR)/libCordova.a" -Obj-C

Hence I modified this way the xcodebuild command invocation:

xcodebuild -target "<project-name>" -configuration Release clean build 'OTHER_LDFLAGS=-force_load "$SRCROOT/CordovaLib/build/Release-iphoneos/libCordova.a" -Obj-C'

That resolved my problem.

Quake
  • 83
  • 1
  • 9
  • 1
    Whats about this error : Ld /Users/confiz/Library/Developer/Xcode/DerivedData/CloudMessage-afevkkqtjcnmoddycvosdhbgoraa/Build/Intermediates/ArchiveIntermediates/LTDMessaging/IntermediateBuildFilesPath/CloudMessage.build/Release-iphoneos/LTDMessaging.build/Objects-normal/arm64/LTD\ Messaging normal arm64 – aqsa arshad Dec 16 '16 at 12:38