You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Daniel Gavril (JIRA)" <ji...@apache.org> on 2018/01/29 11:28:00 UTC

[jira] [Updated] (CB-13844) Using "buildFlag" for "OTHER_LDFLAGS" does not work as expected

     [ https://issues.apache.org/jira/browse/CB-13844?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Gavril updated CB-13844:
-------------------------------
    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?

  was:
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):
{quote}{{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}}
{quote}
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?


> Using "buildFlag" for "OTHER_LDFLAGS" does not work as expected
> ---------------------------------------------------------------
>
>                 Key: CB-13844
>                 URL: https://issues.apache.org/jira/browse/CB-13844
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>    Affects Versions: cordova-ios 4.5.0
>         Environment: Cordova --version: 8.0.0
> Cordova ios platform: 4.5.4
> Node version: v9.4.0
> NPM version: 5.6.0
>            Reporter: Daniel Gavril
>            Assignee: Suraj Pindoria
>            Priority: Major
>              Labels: build, cordova, flags, ios, xcode
>             Fix For: cordova-ios@4.5.4
>
>
> 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?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org