Duplicate symbol building app on OS4.0/Device/Release

316 views
Skip to first unread message

Julien R.

unread,
May 11, 2010, 4:34:18 PM5/11/10
to Three20
Hello there,

I'm having trouble building app with the last three 20 build with the
following configuration :
- iPhone OS 4.0 beta3
- Device
- Release
- armv6

I'm getting this error :
ld: duplicate symbol _TTSwapMethods in /Users/Ezor/Projets/Cocoa/
Three20/Build/Products/Release-iphoneos/libThree20.a(TTGlobalCore.o)
and /Users/Ezor/Projets/Cocoa/Three20/Build/Products/Release-iphoneos/
libThree20.a(TTGlobalCore.o)

No problem when i build the app on simulator or on device with the
Debug Configuration. I get this only with the Release Configuration on
Device.

Any Idea ?

--
You received this message because you are subscribed to the Google Groups "Three20" group.
To post to this group, send email to thr...@googlegroups.com.
To unsubscribe from this group, send email to three20+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/three20?hl=en.

Emil

unread,
May 11, 2010, 4:50:21 PM5/11/10
to thr...@googlegroups.com
You might have included the headerfile for TTGlobalCore twice.

Once through three20.h and then through TTGlobalCore.h or similar stuff.

I would advise you to go through your imports surrounding your class that is failing and see you can locate it.

Thats my $0.02

Cheers

Julien R.

unread,
May 11, 2010, 5:13:30 PM5/11/10
to Three20
I don't think it's a problem with my imports. Why should i get this
problem only with the Release/Device Configuration and not the other
Configuration such as Debug/Device.

Anyway here is my imports :

MockPhotoSource.h :

#import "Three20Core/Three20Core.h"
#import "Three20UI/TTPhoto.h"
#import "Three20UI/TTPhotoSource.h"
#import "Three20Network/TTURLRequestModel.h"

And PhotoTest2Controller.h :

#import "Three20UI/TTPhotoViewController.h"
> > For more options, visit this group athttp://groups.google.com/group/three20?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Three20" group.
> To post to this group, send email to thr...@googlegroups.com.
> To unsubscribe from this group, send email to three20+u...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/three20?hl=en.

Emil

unread,
May 11, 2010, 5:18:19 PM5/11/10
to thr...@googlegroups.com
I guess you have done a make clean and cleaned all dependencies ?

Julien R.

unread,
May 12, 2010, 1:08:36 PM5/12/10
to Three20
Yes i have done a clean all dependencies. I also have deleted the
content of the build directories of my project and three20. But i'm
getting always this message. I get this on two distinct project. No
problem with and old version of Three20 on 3.2 SDK.

Julien R.

unread,
May 12, 2010, 4:20:38 PM5/12/10
to Three20
I have just build my project using 3.2 SDK, lastest three20 build and
Device/Release Configuration and it works fine.

So i think it's a linking problem caused by the buggy iPhone 4.0
SDK...

Julien R.

unread,
May 20, 2010, 3:18:07 PM5/20/10
to Three20
Ok i just fixed my problem compiling an armv7 architecture only
version of my app. The problem comes from the double compilation of
SDK 4.0 while using armv6/v7 architecture.

coneybeare

unread,
May 30, 2010, 3:42:29 PM5/30/10
to Three20
What are the benefits/consequences of compiling an armv7 only
architecture? I ran into the same problem.

coneybeare

unread,
May 30, 2010, 5:44:05 PM5/30/10
to Three20
After looking into it, setting armv7 only will affect many many users
of my app. Only the 3gs and iPod v3 and greater will run it. This is
not an option it seems. Does anybody have an idea to fix this without
changing the architecture?

uprise78

unread,
May 30, 2010, 7:55:17 PM5/30/10
to Three20
Why not wait for the final OS4 compiler and OS? It's not like you can
submit an app using it anyway...

coneybeare

unread,
May 30, 2010, 8:19:19 PM5/30/10
to Three20
I need to be ready on day 1 and would rather figure this out now than
when I am uber stressed. Without any solid knowledge, I have to assume
that 4.0 will be out on June 7th (wwdc).

Romain

unread,
May 31, 2010, 5:05:46 AM5/31/10
to Three20
And also think of the individual developers that are stuck with OS 4.0
on their device, and absolutely need to test their app on their device
for some functionnalities (like camera), and don't have 6 devices with
all OS/device possibilities.

coneybeare

unread,
May 31, 2010, 5:36:01 PM5/31/10
to Three20
I posted a bug to github. http://github.com/facebook/three20/issues/issue/210/#comment_258601

Maybe if enough of us post a comment there, it may gain momentum. I
looked into it but couldn't figure it out. We need a rockstar like
Jeff to take a look.

Jeff Verkoeyen

unread,
May 31, 2010, 6:46:51 PM5/31/10
to thr...@googlegroups.com
This smells like a local problem, but I'm downloading the new SDK right now to test it.

Is it possible that you've linked libThree20.a along with libThree20Core.a? libThree20.a contains all of the sub Three20 libraries linked into one library, so it's possible that if you were to link both that you would get these duplications (though I would imagine there to be many more).

Will continue to sleuth...

Cheers,
- Jeff

Romain

unread,
Jun 1, 2010, 5:58:11 AM6/1/10
to Three20
In my case it is just something that builds for Os 3.x and does not
for 4.0 so not sure there is a double link
> > three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> > .

Jim Heising

unread,
Jun 1, 2010, 3:13:20 PM6/1/10
to Three20
Anyone ever figure this out? I'm having the same problem with 3.2 SDK.

coneybeare

unread,
Jun 1, 2010, 4:53:28 PM6/1/10
to Three20
I checked and do not have these sub libraries linked. Only the main
libThree20.a
> > three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> > .

Jim Heising

unread,
Jun 1, 2010, 5:29:49 PM6/1/10
to Three20
I was able to get it finally build by setting the build to ARMV7 like
someone mentioned earlier. But seems like a hack. Although I was able
to run it on my iPod touch (which I'm assuming is not a V7 device) so
it appears to work.

uprise78

unread,
Jun 1, 2010, 6:14:25 PM6/1/10
to Three20
I believe iPod Touch 2G and 3G are both ARM7 but I could be mistaken.

Buju

unread,
Jun 2, 2010, 4:54:26 AM6/2/10
to Three20
Hi,

I'm also getting the same error, except I'm using a second Debug
Setting. (iPhone OS 4.0 beta3)

I have:
Debug (works)
Debug Pro (its a duplicate from Debug --> not working)
Release (not working)
Release Pro (not working - duplicate from Release)

Like someone mentioned earlier I also tried setting the Architecture
"Optimized (armv7)" (this is the only armv7 I have), enabled "Build
Active Architecture only" and changed "Valid Architectures" to only
contain "armv7" but that doesn't work for me. I still get the error.

There is also something that I quite don't understand. Is is normal
that on a "Debug Pro" build that xcode tries to use a Release build of
the three20 lib instead of a Debug build? --> from xcode linker log:
three20/Build/Products/Release-iphoneos/libThree20.a

Maybe that might help you Jeff.

Andrew Ng

unread,
Jun 2, 2010, 5:53:13 PM6/2/10
to thr...@googlegroups.com
I'm seeing the same problem with 3.2 SDK, I'm linking with libThree20.a as well as extThree20JSON+SBJSON.a (which pulls in Core and Network). The duplicate symbol errors only happens when I build for device (arm6 and arm7, Device 3.2, Deployment Target of 3.1.2, Universal app). It builds fine for Debug/Simulator.

/ayn

Jeff Verkoeyen

unread,
Jun 3, 2010, 9:50:20 AM6/3/10
to thr...@googlegroups.com
I think I've got it!

Quick post, will verify in a couple hours as I have to run right now.

Apparently the new Three20 composite project can't be used when building for multiple architectures because of how all of the libs are composited into one (libThree20.a). Instead, you will need to add each part of Three20 individually to your project and directly link them to your app.

Rationale will come later along with testing....

Cheers,
- Jeff

Jeff Verkoeyen

unread,
Jun 3, 2010, 9:51:29 AM6/3/10
to thr...@googlegroups.com
W00t! Just tested it and the theory holds true :) Will post a detailed write-up later.

- Jeff

Andy Dunn

unread,
Jun 4, 2010, 11:50:47 AM6/4/10
to Three20
Thats great news Jeff. Any further information on how we can get it
working again following your new found wisdom ?

Andy
> >>> three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/three20?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Three20" group.
> >> To post to this group, send email to thr...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> three20+u...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/three20?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Three20" group.
> >> To post to this group, send email to thr...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> >> .

Jeff Verkoeyen

unread,
Jun 4, 2010, 7:39:15 PM6/4/10
to thr...@googlegroups.com
I've pushed changes to the template and sample projects that will remove the build problems people have been experiencing.

As part of this series of commits, I've also removed the legacy Three20 project now that it has been a month since the new Three20 was launched. Anyone who is still using the legacy project will now need to migrate to the new Three20.

The first commit in the series:
http://github.com/facebook/three20/commit/72af2909f11fbe36d0d91fb6bc298a874535302a

I've also updated the readme:

And Three20.info's setup guide:

The basic idea: we can't composite .a files into one .a file due to build problems when creating universal binaries. This is what the Three20.xcodeproj project did before today.

The fix is relatively simple, thankfully, but it does make adding Three20 to an app a slightly more complicated process. Instead of just adding one project (Three20.xcodeproj) and linking the project's one resulting .a file, you will now need to add each project individually and link to each one individually.

Please let me know if you have any questions.

Cheers,
- Jeff

cloudguy

unread,
Jun 10, 2010, 11:06:31 PM6/10/10
to Three20
The problem then is that Three20/Three20.h is not copied into the
Build folder so you have to change that too.

On Jun 4, 4:39 pm, Jeff Verkoeyen <jverk...@gmail.com> wrote:
> I've pushed changes to the template and sample projects that will remove the
> build problems people have been experiencing.
>
> As part of this series of commits, I've also removed the legacy Three20
> project now that it has been a month since the new Three20 was launched.
> Anyone who is still using the legacy project will now need to migrate to the
> new Three20.
>
> The first commit in the series:http://github.com/facebook/three20/commit/72af2909f11fbe36d0d91fb6bc2...
> > <three20%2Bunsu...@googlegroups.com<three20%252Bunsubscribe@googlegroup s.com>>
> > > >>> .
> > > >>> For more options, visit this group at
> > > >>>http://groups.google.com/group/three20?hl=en.
>
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> > Groups
> > > >> "Three20" group.
> > > >> To post to this group, send email to thr...@googlegroups.com.
> > > >> To unsubscribe from this group, send email to
> > > >> three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> > .
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/three20?hl=en.
>
> > > >>  --
> > > >> You received this message because you are subscribed to the Google
> > Groups
> > > >> "Three20" group.
> > > >> To post to this group, send email to thr...@googlegroups.com.
> > > >> To unsubscribe from this group, send email to
> > > >> three20+u...@googlegroups.com<three20%2Bunsu...@googlegroups.com >
> > <three20%2Bunsu...@googlegroups.com<three20%252Bunsubscribe@googlegroup s.com>>

cloudguy

unread,
Jun 11, 2010, 2:51:03 AM6/11/10
to Three20
Ok, this is a bug in libtool -arch_only. The arch_only flag doesn't
work. See my post http://blog.binaryfinery.com/?p=225

I've got a fork of three20 and here is the changelist for the hack:
http://github.com/jamiebriant/three20/commit/57812051ac83df5d84c1f35804bbc01c6adad68c

Brute force hack: I rebuild the split-put libraries properly using
lipo -extract and then recombine them as normal.

Jamie

On May 11, 1:34 pm, "Julien R." <julien.r...@gmail.com> wrote:
> Hello there,
>
> I'm having trouble building app with the last three 20 build with the
> following configuration :
> - iPhone OS 4.0 beta3
> - Device
> - Release
> - armv6
>
> I'm getting this error :
> ld: duplicate symbol _TTSwapMethods in /Users/Ezor/Projets/Cocoa/
> Three20/Build/Products/Release-iphoneos/libThree20.a(TTGlobalCore.o)
> and /Users/Ezor/Projets/Cocoa/Three20/Build/Products/Release-iphoneos/
> libThree20.a(TTGlobalCore.o)
>
> No problem when i build the app on simulator or on device with the
> Debug Configuration. I get this only with the Release Configuration on
> Device.
>
> Any Idea ?
>
> --
> You received this message because you are subscribed to the Google Groups "Three20" group.
> To post to this group, send email to thr...@googlegroups.com.
> To unsubscribe from this group, send email to three20+u...@googlegroups.com.

ja...@binaryfinery.com

unread,
Jun 11, 2010, 10:34:59 PM6/11/10
to Three20
I did some more investigating and updated my blog post. The problem is
caused by a bug in libttool, but it is triggered by the all_load flag.
Without the all_load flag, there is no bug. all_load affects the
application - not the static libraries themselves. The static
libraries don't need it as they are not actually linked - just stuffed
together.

So, my demunging solution will work but its a hack. A better solution
would be to avoid the all_load problem altogether. all_load is
required because of this bug: http://developer.apple.com/mac/library/qa/qa2006/qa1490.html:

IMPORTANT: For 64-bit and iPhone OS applications, there is a linker
bug that prevents -ObjC from loading objects files from static
libraries that contain only categories and no classes. The workaround
is to use the -all_load or -force_load flags.

Bugs that cause bugs. I would suggest that a better workaround that
works (I've just tried it) is to put dummy classes (@interface foo1
@end @implementation foo1 @end will work) into every file (there's
about 20) that implement category-only code. This causes them to be
loaded successfully by the -ObjC flag without using all_load. And this
allows us to have arm6 and arm7 binaries. Better yet, do it with a
#define so it can be turned off when Apple fix the bug (either one).

Jamie

On Jun 10, 11:51 pm, cloudguy <jamiebri...@gmail.com> wrote:
> Ok, this is a bug in libtool -arch_only. The arch_only flag doesn't
> work. See my posthttp://blog.binaryfinery.com/?p=225
>
> I've got a fork of three20 and here is the changelist for the hack:http://github.com/jamiebriant/three20/commit/57812051ac83df5d84c1f358...

ja...@binaryfinery.com

unread,
Jun 11, 2010, 10:53:37 PM6/11/10
to Three20
#define FIX_CATEGORY_BUG(name) @interface FIXCATEGORYBUG ## name @end
@implementation FIXCATEGORYBUG ## name @end

does the trick.

ja...@binaryfinery.com

unread,
Jun 12, 2010, 4:02:38 PM6/12/10
to Three20
Yosi kindly pointed out that my CategoryFix.h didn't get checked in. I
hadn't put it in the Header folder, so I fell foul of the
root .gitignore file. Its fixed now.
http://github.com/jamiebriant/three20/commit/cf560872834ef0cfc0a3c39ab6c57c8d6897b4df

Jamie

ukjeep4x4

unread,
Jun 15, 2010, 2:49:28 PM6/15/10
to Three20
hi,

i checked out the master, found the 4.0 prob, found ur fork(from this
thread), checked it out, and duplicated the steps from "adding to your
project" from the master, except removing the -all_load (was this
correct?), but i still get the duplicate symbol error. originally i
was getting a "symbols not found" error referencing ttentitieslibrary.

any help would be much appreciated...i can test in the simulator, but
i'd like to put it on my phone sometime soon!

thanks,
matt

On Jun 12, 4:02 pm, ja...@binaryfinery.com wrote:
> Yosi kindly pointed out that my CategoryFix.h didn't get checked in. I
> hadn't put it in the Header folder, so I fell foul of the
> root .gitignore file. Its fixed now.http://github.com/jamiebriant/three20/commit/cf560872834ef0cfc0a3c39a...

crazyguy

unread,
Jun 24, 2010, 8:11:59 PM6/24/10
to Three20
You need to remove the -all_load - its what causes the dup symbol
problem.

emailfornewzealand

unread,
Jun 24, 2010, 8:13:43 PM6/24/10
to Three20
Firstly, thanks very much for your investigation into this problem.

Would you be able to let me/us know which 20 or so files exactly need
to have your CategoryFix.h include in them? Or even better, a patch/
diff that would make everything work? :)

I, and I'm sure a lot of other people, really need to get three20
going without the -all_load flag!

crazyguy

unread,
Jun 24, 2010, 8:33:28 PM6/24/10
to Three20
git diff c293236b408c1ebb8702 c7b9dad19bcd2ec25a36 > universal.patch

http://gist.github.com/452213

This patch also includes the project mods, and the 3.2 conditional
comp too.

jamie

On Jun 24, 5:13 pm, emailfornewzealand

crazyguy

unread,
Jun 24, 2010, 8:35:16 PM6/24/10
to Three20
Otherwise these three commits are what you want:

8598c6719d40a1ad073d
cf560872834ef0cfc0a3
7b1dccd22e520fcc969b

jamie

Viraj

unread,
Jun 25, 2010, 7:09:59 AM6/25/10
to Three20
So is your fork supposed to work fine for 3.1.x and higher devices?
I tried downloading your sources but I can't get my project to build
right with it - I run into a ton of linker errors.
Stuff like:

"_OBJC_CLASS_$_TTTableGrayTextItem", referenced from:
objc-class-ref-to-TTTableGrayTextItem in LoginController.o
"_OBJC_METACLASS_$_TTSectionedDataSource", referenced from:
_OBJC_METACLASS_$_ArtistsDataSource in ArtistsModel.o

Any suggestions?

emailfornewzealand

unread,
Jun 25, 2010, 1:22:59 PM6/25/10
to Three20
Thanks 1000 times over for posting this!

My problem was with the thumbnail view crashing when I didn't have the
-all_load linking flag, and your patch fixed that. However, when I
was trying to actually view the pictures full screen
(TTPhotoViewController I think), it would still crash. After seeing
how you patched the files, I figured you just missed some so I grepped
through all the code for implementation with "(" on the same line
(grep -R implementation * | grep "("), and then added the hack to all
those files that didn't have it. It was pretty obvious that some of
them didn't need it, but frankly, I had had enough so I just added it
anyway, can't hurt. That has now solved the problem for me.

I can't tell you exactly what file it was, but it's there somewhere!

Thanks again for your help.

Perky

unread,
Jul 5, 2010, 2:16:36 PM7/5/10
to Three20
Hi EveryOne,

Please help me out with this thing.

I know many of you got things done thats great to hear. Can anyone
help me out by giving simple straight steps to get rid of this
duplicate error thing.

Please all help will be appreciated. PLease help me with your
expertise.

Regards,
Priyank Ranka

On Jun 25, 10:22 pm, emailfornewzealand

Perky

unread,
Jul 6, 2010, 4:43:30 AM7/6/10
to Three20
Hi emailfornewzealand,

Please help me out with this. I think you solved the problem which I
am facing. Will be great of you if you share your fix to me as it will
help me a lot.

i am not able to compile and run my app on device.

Regards,
Priyank Ranka

Perky

unread,
Jul 7, 2010, 2:06:54 AM7/7/10
to Three20
Hi emailfornewzealand,

Sorry I have adrress you with the email id and not with your name as i
did not find your name in the post.

Thanks Jamie for the patch. With new patch I am able to get my app
work well for both configuration. But I get crash when I tab on the
photo thumbnails to view big image.

Emailfornewzealand, you have fixed this issue it will be great if you
tell me how should I go about solving the issue. I do have limited
knowledge about the file in which you did modification. Please help me
out I am just stuck with this thing. Once I get this thing work it
will be all done.

Please reply to asap. Looking forward for you reply.

Regards,
Priyank Ranka

On Jun 25, 10:22 pm, emailfornewzealand
<emailfornewzeal...@yahoo.com.au> wrote:

ranka priyank

unread,
Jul 7, 2010, 2:53:51 AM7/7/10
to Three20
Hi,  

while deploying on the device lot of errors comes in but with deploying on simulator its working fine with Jamie's patch to get rid of -l all_load flag

Kindly help developers like us.

Regards,
Priyank Ranka
--
Priyank Ranka

Perky

unread,
Jul 7, 2010, 4:35:32 AM7/7/10
to Three20
Hey Viraj,

Did solve your issue. I also encounter same issue o=while compiling
for device.

Thanks,
Priyank Ranka
Reply all
Reply to author
Forward
0 new messages