Affects Version/s: cordova-ios 4.5.0
Fix Version/s: firstname.lastname@example.org
Cordova --version: 8.0.0
Cordova ios platform: 4.5.4
Node version: v9.4.0
NPM version: 5.6.0
I created a custom plugin linked from local path to the cordova project. This plugin integrates a ".framework" which has some parts of the code with c++ references. (I don't know more than that because is an external library and code is not public).
After I have integrated the plugin in the cordova project and started to build, everything started to fail.
After some research & testing, using "Other Linking flags" for xCode build ("-ObjC -lc++ -lstdc++ -lresolv") fixes the issue.
Currently, I am building the iOS application with different build config files as the documentation recommends. What I added in the build.json file is:
"OTHER_LDFLAGS=-ObjC -lc++ -lstdc++ -lresolv"
And in terminal I get ("hidden" text hides the private stuff):
Reading build config file:
Building project: hidden/platforms/ios/hidden.xcworkspace
Adding xcodebuildArg: OTHER_LDFLAGS=-ObjC -lc++ -lstdc++ -lresolv
User defaults from command line:
IDEArchivePathOverride = hidden/platforms/ios/hidden.xcarchive
Build settings from command line:
CONFIGURATION_BUILD_DIR = hidden/platforms/ios/build/device
OTHER_LDFLAGS = -ObjC -lc++ -lstdc++ -lresolv
SHARED_PRECOMPS_DIR = hidden/platforms/ios/build/sharedpch
Build settings from configuration file 'hidden/platforms/ios/cordova/build-release.xcconfig':
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
CODE_SIGN_IDENTITY = hidden
DEVELOPMENT_TEAM = hidden
ENABLE_BITCODE = NO
HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
OTHER_LDFLAGS = -ObjC
PROVISIONING_PROFILE = hidden
SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h
The "OTHER_LDFLAGS" does not work & the build fails with errors related to missing different usages from c++.
As a fix, I installed the Cordova Custom Config plugin and I used the following preference for iOS:
<preference buildType="debug" name="ios-XCBuildConfiguration-OTHER_LDFLAGS" value="-ObjC -lc++ -lstdc++ -lresolv" xcconfigEnforce="true" />
Using the OTHER_LDFLAGS should work since there is support for that. Or am I wrong?