Duplicate symbol in relationship tp freetype.a

I’m trying to add the soundcloud API to an iOS app and it requires the linker flag -all_load. From reading, this linker flag seems to be pretty common.

However, if I add the flag, I get the follow error of duplicate symbols.

  
ld: warning: in ../../../libs/FreeImage/lib/iphone/freeimage.a, missing required architecture i386 in file  
ld: warning: in ../../../libs/glu/lib/iphone/glu-iphone.a, missing required architecture i386 in file  
ld: duplicate symbol _FT_Get_Advances in ../../../libs/freetype/lib/iphone/freetype.a(ftbase.o) and ../../../libs/freetype/lib/iphone/freetype.a(ftadvanc.o)  
collect2: ld returned 1 exit status  
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1  

Is there a way to avoid this duplicate symbol issue with freetype?

[UPDATE FIX]

For anyone curious on the “fix”, don’t use -all_load and instead use -force_load . This way it just effects the lib you’re trying to load (in my case SoundCloudAPI.a)

It appears all the libs cause duplicate symbols when using the -all_load.

For anyone curious on the “fix”, don’t use -all_load and instead use -force_load . This way it just effects the lib you’re trying to load (in my case SoundCloudAPI.a)

Thanks for this - never liked running into the “use -all_load” solutions that are very common. I suspect -force_load would have saved me quite a few headaches in the past (and will in the future)

No problem. I’m glad it ended up being only a couple hours wasted (looking for the answer) rather than a few days. It seems like the -all_load is common on iOS so I hope the alternative proves useful. :slight_smile:

I’m just at this point now :slight_smile:
after some headache trying to put all together.
Considering that when I add -force_load <SoundCloudAPI.a> in Xcode 4 it doesn’t work and because I read that:
http://stackoverflow.com/questions/6461502/xcode-force-load-not-working-for-simulator-build
I put that :
-Wl,-force_load,<SoundCloudAPI.a>

SoundCloudAPI.a seems not found
of course, I supposed the code has to compiled it…

any tips, Seth ?

In ‘other linker flags’ in the build settings you need:

-force_load $(OF_PATH)/addons/ofxCocoaSoundCloudAPI/SoundCloudAPI/build/UninstalledProducts/libSoundCloudAPI.a

or whatever the plath is to libSoundCloudAPI.a.

You first need to build the SoundCloudAPI so that the lib will be there.

OMG
I did’t even know there was a soundcloud addon…
trying it right now :slight_smile:

many thanks for this tip!

ok so I still have errors.

to be sure, I’m describing my process here:

1/ I have my project, clean, nice, working.
I’m going to the project folder.

2/ git submoduling!

git submodule add git://github.com/nxtbgthng/OAuth2Client.git
git submodule add git://github.com/soundcloud/CocoaSoundCloudAPI.git
git submodule add git://github.com/nxtbgthng/JSONKit.git
git submodule add git://github.com/nxtbgthng/OHAttributedLabel.git
git submodule add git://github.com/soundcloud/CocoaSoundCloudUI.git

After this step, I’m drag’n’dropping each *.xcodeproj file over my Xcode project in order to include them as submodules/subprojects.

3/ Header Search Paths
I add …/** to search path

4/ Libraries
I add the following lib in Link Binary with Libraries section of the Build Phases of my Target.

* libSoundCloudAPI.a
* libOAuth2Client.a
* libJSONKit.a
* libOHAttributedLabel.a
* libSoundCloudUI.a
* QuartzCore.framework
* AddressBook.framework
* AddressBookUI.framework
* CoreLocation.framework
* Security.framework
* CoreGraphics.framework
* CoreText.framework

5/ Other Linker Flags
Because -ObjC is already added, and -all_load gives errors, I’m using as adviced:
-Wl,-force_load,<path_to_my_lib>/libSoundCloudAPI.a
as given in http://stackoverflow.com/questions/6461502/xcode-force-load-not-working-for-simulator-build

6/ SoundCloud.bundle
I’m drag’n’dropping this from CocoaSoundCloudUI to my own resources group in Xcode

7/ Then, the implementation
I followed the example of usage here

I have many errors.

Does my process fit with … reality and is it the way you made it working ?

Many thanks, Seth (and the others :slight_smile:

I answered but as it is sorted as SPAM, here is my answer on my own blog:
http://julienbayle.net/2012/05/04/some-hard-work-with-openframeworks-soundcloud