[TIMOB-3802] Problem with multiple modules and OTHER_LDFLAGS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-26T18:23:08.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | Release 1.7.0, Sprint 2011-21 |
Components | iOS |
Labels | build, ios |
Reporter | Jeff English |
Assignee | Jeff English |
Created | 2011-04-28T07:04:20.000+0000 |
Updated | 2013-03-27T12:52:09.000+0000 |
Description
When building an app that includes multiple modules and each module has OTHER_LDFLAGS defined in their module.xcconfig file, only the flags for the last module are used in the build. This causes the build to fail because the flags for the first module are not included during the link step. This issue was referenced in the developer center (http://developer.appcelerator.com/question/103551/problem-with-multiple-modules-and-otherldflags) but has recently come up with a customer using a calendar module and the barcode module. Both of these modules require the use of OTHER_LDFLAGS:
Barcode:
OTHER_LDFLAGS=$(inherited) -liconv
Calendar:
OTHER_LDFLAGS=$(inherited) -framework EventKit
The module.xcconfig file that is generated for the app by the build process (compiler.py) contains two #include statements that include each module's xcconfig file. However, due to a known limitation in XCode, $(inherited) does not work as expected for included xcconfig files. Only the last setting of the symbol is used as each symbol assignment replaces the previous one.
One end-user workaround is to edit the module.xcconfig file for the last included module so that it contains all of the combined OTHER_LDFLAGS from all of the included modules. For example, if Calendar is the last listed module in tiapp.xml, then its module.xcconfig file could be changed to
OTHER_LDFLAGS=$(inherited) -framework EventKit -liconv
But this requires additional updates by the user if additional modules are added to the app or flags change for any of the modules.
THis is pretty high priority. I would like to have at least a scope on this.
Pushing back to Sprint 19 so that debugger can take priority.
This needs to be revisited as the following items are not currently handled: 1. Must handle local variable references such as: MY_FLAGS=-liconv OTHER_LDFLAGS=$(MY_FLAGS) 2. Must handle use of platform specific settings such as: OTHER_LDFLAGS[sdk=iphoneos4*]=-liconv OTHER_LDFLAGS[sdk=iphonesimulator*]=-liconv -framework EventKit in one file and OTHER_LDFLAGS=-framework GameKit in another file. This one is a little more complicated as the final OTHER_LDFLAGS needs to take into consideration the platform specific settings in the combined result.
COMPLEX TEST CASE This test demonstrates all of the new features of the compiler, handling shared variable names, platform specific modifiers, and local variable references. 1. Modify the tiapp.xml to include multiple modules (UrbanAirship, Barcode, MagTek). Can be any modules so long as you each has a module.xcconfig file with common flag names (e.g. OTHER_LDFLAGS)
2. Modify the module.xcconfig files so that they use local variable names AND also make use of platform specific modifiers.
3. Build/run the project. Project should build and run successfully 4. Examine the module.xcconfig file that is generated during the build process. This module.xcconfig file is located in the build/iphone folder of the project. It should contain something like the following:
https://github.com/appcelerator/titanium_mobile/commit/f908030b67ee5231926b6c57635d0f9b034f9eeb
Tested with Jun 2 2011 11:39 rc9515533