Integer lib.a in my ios module titanium

You must Login before you can answer or comment on any questions.

Hi all,

I created my first module titanium for ios. I created my Proxy.h/.m and i can call it in my app.js in my example folder. Everything works :) But now, i wanted to add my lib, with extension mylib.a and my header myheader.h In my xcodeproj, i drag n drop my lib and i selected "Copy Item...". And i import in my Proxy.h my header like (#import "myheader.h")

When i build on my xcodeproj, i have successfull result.

When i do "titanium run" on my module, i have this error :

clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR]
[ERROR] Error: Traceback (most recent call last):
[DEBUG] File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/builder.py", line 1333, in main
[DEBUG] execute_xcode("iphonesimulator%s" % link_version,["GCC_PREPROCESSOR_DEFINITIONS=__LOG__ID__=%s DEPLOYTYPE=development TI_DEVELOPMENT=1 DEBUG=1 TI_VERSION=%s %s %s" % (log_id,sdk_version,debugstr,kroll_coverage)],False)
[DEBUG] File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/builder.py", line 1239, in execute_xcode
[DEBUG] output = run.run(args,False,False,o)
[DEBUG] File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/run.py", line 41, in run
[DEBUG] sys.exit(rc)
[DEBUG] SystemExit: 65
[ERROR] Build Failed. See: /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mMdhP38ti/misterbelladvertsdk/build/iphone/build/build.log
Any ideas ? pls :)

Thx.

Thomas

— asked 10 months ago by Thomas Philippini
2 Comments
  • In your module root, try removing the build folder, and re-running.

    — commented 10 months ago by Paul Nelson

  • Hi Paul, Thx for you answer. I already do that, and its the same. I'm new on Xcode, you know how to integer a lib.a and header.h correctly in xcode project ? i think it's my problem maybe. :)

    — commented 10 months ago by Thomas Philippini

3 Answers

Accepted Answer

HI Thomas, thats good you pasted here, now here is the exact cause of this error.

ld: duplicate symbol _kReachabilityChangedNotification
and that symbol is coming from
/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/modules/iphone/misterbell.advert/0.1/libmisterbell.advert.a(mbAdReachability.o)
which is your Reachability.h/.m file shown here
/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/misterbelladvertsdk.build/Debug-iphonesimulator/misterbelladvertsdk.build/Objects-normal/i386/Reachability.o
so the conclusion is your library named:: -lmisterbell.advert is using Reachability.h/.m which is being duplicated because titanium already provide that. So use the files provided by titanium.

and as you remove this duplicate symbols, try checking for other files/classes as well, for being duplicated.

— answered 10 months ago by Ashish Nigam
answer permalink
3 Comments
  • Hi Ashish, Thks for your answer. I don't understand, the lib named libmisterbell.advert.a is the result in my build folder. My real named required in my xcode proj named differently. I don't have file named Reachability.h/.m :(

    — commented 10 months ago by Thomas Philippini

  • Then may be the external library, which you are using internally using this and thats why conflict is there.

    — commented 10 months ago by Ashish Nigam

  • Hi Ashish, I have the same name of variable and it was the reason of my problem. I will fix the bug. Thx :)

    — commented 10 months ago by Thomas Philippini

Hi Ashish, This my build.log

Ld build/Debug-iphonesimulator/misterbelladvertsdk.app/misterbelladvertsdk normal i386
    cd /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/Debug-iphonesimulator -L/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/lib -L/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/modules/iphone/misterbell.advert/0.1 -L/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/modules/iphone/misterbell.advert/0.1 -F/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/Debug-iphonesimulator -filelist /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/misterbelladvertsdk.build/Debug-iphonesimulator/misterbelladvertsdk.build/Objects-normal/i386/misterbelladvertsdk.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -weak_framework iAd -weak_framework iAd -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40000 -licucore -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework CFNetwork -framework CoreLocation -framework MapKit -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -lsqlite3 -lz -framework AudioToolbox -weak_framework MediaPlayer -framework AVFoundation -lxml2 -framework StoreKit -lTiCore -lmisterbell.advert -lmisterbell.advert -framework ExternalAccessory -ltiverify -lti_ios_debugger -o /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/Debug-iphonesimulator/misterbelladvertsdk.app/misterbelladvertsdk
ld: duplicate symbol _kReachabilityChangedNotification in /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/modules/iphone/misterbell.advert/0.1/libmisterbell.advert.a(mbAdReachability.o) and /var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mEelMUQti/misterbelladvertsdk/build/iphone/build/misterbelladvertsdk.build/Debug-iphonesimulator/misterbelladvertsdk.build/Objects-normal/i386/Reachability.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
 
** BUILD FAILED **
 
 
The following build commands failed:
    Ld build/Debug-iphonesimulator/misterbelladvertsdk.app/misterbelladvertsdk normal i386
(1 failure)
EXIT CODE WAS: 65
 
Exception detected in script:
Traceback (most recent call last):
  File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/builder.py", line 1333, in main
    execute_xcode("iphonesimulator%s" % link_version,["GCC_PREPROCESSOR_DEFINITIONS=__LOG__ID__=%s DEPLOYTYPE=development TI_DEVELOPMENT=1 DEBUG=1 TI_VERSION=%s %s %s" % (log_id,sdk_version,debugstr,kroll_coverage)],False)
  File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/builder.py", line 1239, in execute_xcode
    output = run.run(args,False,False,o)
  File "/Library/Application Support/Titanium/mobilesdk/osx/2.1.1.GA/iphone/run.py", line 41, in run
    sys.exit(rc)
SystemExit: 65

Hi Thomas, open this file

/var/folders/wv/3q4vkj7j10x_t449zf188nhr0000gs/T/mMdhP38ti/misterbelladvertsdk/build/iphone/build/build.log
and check at the end, whats the exact cause for this error.

at the end error will be mentioned just above your message, which you pasted here.

check that and reply with your error message.

Temporary solution could be you are missing some framework or library which your static library is using.

Your Answer

Think you can help? Login to answer this question!