you will need to pass LDFLAGS, CPPFLAGS and CXXFLAGS the same -arch you are trying to compile for. After passing -arch i386 to all three in configure i was able to successfully build the following
[jfarrell@dev trunk]$ file compiler/cpp/thrift thrift: Mach-O executable i386 -Jake On Dec 30, 2011, at 11:24 AM, Peace wrote: > Jake, > > That would be terrific if you would consider adding an option to build > universal > binaries. I'll create a ticket in JIRA. > > Thanks for the tip on setting the architecture. It's reporting link error > mismatches between i386 and x86_64. I ran cleanup.sh and started from > scratch to rule out stale object files. Is there another argument to inform > the linker of the architecture? > > The 'make' output follows (preceding were dozens of similar ld warnings for > other .o files) > ------------------------------------------------------------------------------------------------------------------------ > .... > ld: warning: ignoring file thrift-t_delphi_generator.o, file was built for > i386 which is not the architecture being linked (x86_64) > ld: warning: ignoring file thrift-t_go_generator.o, file was built for i386 > which is not the architecture being linked (x86_64) > Undefined symbols for architecture x86_64: > "_yylex", referenced from: > _main in libfl.a(libmain.o) > "failure(char const*, ...)", referenced from: > t_generator_registry::register_generator(t_generator_factory*) > in thrift-t_generator.o > ld: symbol(s) not found for architecture x86_64 > collect2: ld returned 1 exit status > make[3]: *** [thrift] Error 1 > .... > ------------------------------------------------------------------------------------------------------------------------ > > > -Peace > > ------------------------------ > *From:* Jake Farrell <[email protected]> > *To:* "[email protected]" <[email protected]> > *Sent:* Thursday, December 29, 2011 5:01 PM > *Subject:* Re: OSX - building universal library binaries > > The thrift build is not setup to create a universal binary currently. if > you would like to create a ticket for this we can take a look at making > this a global configure option. To set the arch you can pass > CPPFLAGS='-arch i386' to configure. You should be able to use this for > each arch you want to create and then use lipo to combine them into a > universal binary. > > -Jake > > > On Dec 29, 2011, at 2:43 PM, Peace wrote: > >> What is the procedure for creating a universal binary on OSX? That is, a >> libthrift binary that supports i386, x86_64 and ppc. I built it on an OSX >> 10.7.1 system which produces x86_64 binaries by default and configure.sh >> doesn't accept -arch arguments. >> >> Hope I didn't miss an existing thread on this. Searched online and scanned >> the list but haven't found a good way to search it. >> >> Thanks, >> Peace
