Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-13844

Using "buildFlag" for "OTHER_LDFLAGS" does not work as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • cordova-ios 4.5.0
    • cordova-ios@4.5.4
    • cordova-ios
    • Cordova --version: 8.0.0
      Cordova ios platform: 4.5.4
      Node version: v9.4.0
      NPM version: 5.6.0

    • Important

    Description

      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:

      "buildFlag": [
      "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
      Configuration: Release
      Platform: device
      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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            dgavril Daniel Gavril
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: