Order of library search path entries

253 Views Asked by At

I have created a Cordova project.

For iOS Cordova generates two XCode projects: an application project, and inside the application project a CordovaLib project is created.

To use maven I am trying to substitute the CordovaLib project with a static library.

Deleted the CordovaLib project, and added four versions of libCordovaLib.a as linked libraries: 1. debug iphoneOS 2. debug iphoneSimulator 3. release iphoneOS 4. release iphoneSimulator

Extended the header search path as needed, and extended the library search path also:

$(inherited)
target/libs/Debug-iphoneos/...path.../CordovaLib 
target/libs/Debug-iphonesimulator/...path.../CordovaLib
. (Note that first is iphoneos, than comes iphonesimulator).

XCode now builds the application successfully for real test device, but fails to build for emulator (linker errors). There is a warning before the errors:

ld: warning: ignoring file target/libs/Debug-iphoneos/...path.../CordovaLib/libCordovaLib.a, missing required architecture i386 in file target/libs/Debug-iphoneos/...path.../CordovaLib/libCordovaLib.a (3 slices)

Now comes the interesting part:

If I switch the order of library search path entries, XCode builds successfully for emulator, but fails to build for real test device, producing a similar warning:

ld: warning: ignoring file target/libs/Debug-iphonesimulator/...path.../CordovaLib/libCordovaLib.a, missing required architecture arm64 in file target/libs/Debug-iphonesimulator/...path.../CordovaLib/libCordovaLib.a (2 slices)

Does anybody have an idea how to fix this? Is there any build variable I should use in library search path to match always the needed one device/emulator? I googled but found no similar things.

Thanks

1

There are 1 best solutions below

0
On

Somebody enlightened me:

The solution is : Include BUILD_STYLE and PLATFORM_NAME build setting variables.