Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1825] CLI: OTHER_CFLAGS from module.xcconfig only present in Release configurations of app build

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2013-04-04T20:04:43.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator CLI
Labelsn/a
ReporterPaul Mietz Egli
AssigneePedro Enrique
Created2013-02-22T18:27:32.000+0000
Updated2016-03-08T07:40:43.000+0000

Description

I have a module that extends the standard Ti.UI.TabGroup and Ti.UI.ImageView classes (https://github.com/pegli/TiUIEx). The module won't compile without the TiUITabViewProxy and TiUIImageView classes from the SDK, so I added the following to the module's module.xcconfig:
OTHER_CFLAGS=$(inherited) -DUSE_TI_UITAB -DUSE_TI_UIIMAGEVIEW
When I package the module and add it to an empty app project, the app builds and runs fine using the CLI and Studio when targeted against the simulator. When I build for the device, however, I get undefined symbols. The CLI call is:
ti build -T device -V 'Paul Mietz Egli' -P 86666302-83C6-42FC-97EF-3EFEA6B3048F -p iphone
which outputs an ld error. If I open the generated project in Xcode and build for device, I get a little more info:
Undefined symbols for architecture armv7:
  "_OBJC_METACLASS_$_TiUITabGroupProxy", referenced from:
      _OBJC_METACLASS_$_TiUITabGroupProxyEx in libcom.obscure.tiuiex.a(TiUITabGroupProxyEx.o)
     (maybe you meant: _OBJC_METACLASS_$_TiUITabGroupProxyEx)
  "_OBJC_CLASS_$_TiUITabGroupProxy", referenced from:
      _OBJC_CLASS_$_TiUITabGroupProxyEx in libcom.obscure.tiuiex.a(TiUITabGroupProxyEx.o)
     (maybe you meant: _OBJC_CLASS_$_TiUITabGroupProxyEx)
  "_OBJC_METACLASS_$_TiUIImageViewProxy", referenced from:
      _OBJC_METACLASS_$_ComObscureTiUIExImageViewProxy in libcom.obscure.tiuiex.a(ComObscureTiUIExImageViewProxy.o)
  "_OBJC_CLASS_$_TiUIImageViewProxy", referenced from:
      _OBJC_CLASS_$_ComObscureTiUIExImageViewProxy in libcom.obscure.tiuiex.a(ComObscureTiUIExImageViewProxy.o)
  "_OBJC_METACLASS_$_TiUIImageView", referenced from:
      _OBJC_METACLASS_$_ComObscureTiUIExImageView in libcom.obscure.tiuiex.a(ComObscureTiUIExImageView.o)
  "_OBJC_CLASS_$_TiUIImageView", referenced from:
      _OBJC_CLASS_$_ComObscureTiUIExImageView in libcom.obscure.tiuiex.a(ComObscureTiUIExImageView.o)
In build/iphone, I see the generated module.xcconfig file with my OTHER_CFLAGS, but when I dig into the generated .xccodeproj/project.pbxproj, I see that those CFLAGS are only applied to Release builds. The OTHER_CFLAGS settings for Debug and Developer targets are overridden and therefore do not inherit from the project setting. This issue makes it very hard to test my module in an app, and users of my module are confused as to why they are getting linker errors.

Comments

  1. Pedro Enrique 2013-04-04

    You must use the Ti.UI.ImageView and Ti.UI.TabGruop in your JS in order for those classes to be included in the final build. The build scripts will remove the native classes that are not needed according to your JS
  2. Paul Mietz Egli 2013-04-04

    I'm familiar with how the build process searches through the app JavaScript and adds compiler flags to include the native proxy classes in the compiled application executable. My issue is that the OTHER_CFLAGS directive in module.xcconfig is being respected only when the build target is Release and not when it is set to Developer or Debug.

JSON Source