Appcelerator extension module project creates a library with duplicate symbols

Q:

We are trying to integrate PDFTron library with Appcelerator platform and are facing issues in compiling it for device. I have attached the XCode project WITHOUT the lib files - libPDFNet.a, libTools.a(due to size). Note that the attached code is not a standalone iOS application but an Appcelerator extension module. You can however compile this project by opening it directly in XCode. We are able to compile it on simulator and the functionality works perfectly but the same code throws the following linker error for device:

“ld: lto: could not merge in /Users/xx/Development/appname/modules/iphone/com.pdf.tron/0.1/libcom.pdf.tron.a(Action.o) because ‘Linking globals named ‘OBJC_IVAR_$_Action.swigCPtr’: symbol multiply defined!’, using libLTO version ‘LLVM version 3.2svn, from Apple Clang 4.2 (build 425.0.28)’ for architecture armv7

clang: error: linker command failed with exit code 1 (use -v to see invocation)”

Seems like there are global variables with same name defined in multiple object files without using extern. We tried to use “–multiply_defined suppress” as mentioned here but this does not solve the problem.

Please let us know how we can overcome this issue.

A:

XCode seems to have a problem when it uses a fat static library to produce another fat static library. This would also explain why building for simulator works, because it does not produce a fat library. Using the project to build solely for armv7, or armv7s, produced libraries without duplicate symbols. You can then use lipo to combine these libraries into a single fat library, that also doesn’t contain duplicate symbols. Producing the library in this manner will allow you to successfully use it in an Appcelerator app.

Hey,

would you be able to share the final module you managed to generate?

Regards.