Building a library using as universal for 10.3.9 ppc from an Intel build box
Building a library using as universal for 10.3.9 ppc from an Intel build box
- Subject: Building a library using as universal for 10.3.9 ppc from an Intel build box
- From: "Brant Sears" <email@hidden>
- Date: Wed, 19 Jul 2006 17:10:50 -0400
- Thread-topic: Building a library using as universal for 10.3.9 ppc from an Intel build box
Hi. I have a situation where I have some libraries that are being built using make. These in turn get used by my application which is built with xcodebuild.
My xcode project is setup to use GCC 3.3 and the 10.3.9 SDK when building on PowerPC and GCC 4 and 10.4u sdk for the i386 architecture.
Right now I have a build script that creates the library as follows. First, I build the library as Universal using GCC 4. The, I build it PowerPC only using GCC 3.3, then I use lipo to replace the powerPC segment of the universal library with the PowerPC/GCC 3.3 segment from the other library. Then, I use the "hybrid" library.
This was working fine until 2 days ago when a new developer started and his development machine is Intel based. Up until now, I have not built using an Intel machine (my dev box is a G5 and my clean build box is a G4 Mac Mini.)
When he tries to build on the Intel box, he was getting link errors. The reason for that was quickly found - in step 2 I was not explicitly calling out the PPC architecture when building with GCC 3.3 which on his comuter caused only x86 to get built. So, I made a change to explictly add flags for the ppc architecture I also specify the 10.3.9 SDK - however this is probably irrelevant because the libraries in question are not using Mac specific APIs and are compiled on Mac and also on Linux. The library uses pretty standard unix calls. I had previously not been specifying this and I was building on 10.4 and then deploying on 10.3.9 and things were OK.
So, I made two changes. First, as I said above, I added the CFLAGS CXXFLAGS for ppc and 10.3.9. Then I noticed that the library that was being produced in the "build ppc" section was actually a Universal library with one architecture present which was causing the "final" library to be a universal library containing x86 and a second universal library containing ppc. So, then I looked up the man page for lipo and found out about the -thin switch which allows step 2 to build a ppc library that is not "universal" which is what step 3 was getting on my old (ppc) build boxen.
The example below is the code that I have now. As you can see, I have a folder called "temp" that contains 3 sub folders called "ppc3", "u4", and "final". The result is then copied to ~/src/macplayer. This is my attempt to make things straight forward :-)
It *seems like* it *should* work. However, it does NOT. I do end up wtih a universal library and it does contain one ppc part and one i386 part. However, when I try to use this in XCode, I get link errors on the PPC link attempt that refer to symbols from the C/C++ std libs. This leads me to believe that somehow the library contains a GCC 4 PPC segment instead of GCC3.3. I have tried the code below on the PPC box and the changes that I made did not cause it to stop working on PPC. So, somehow the problem is still that the Intel box is behaving differently in some way.
Has someone else ran into this issue?
[pertinent portion of shell script follows...]
cd ~/src/libvmx
# build universal
sudo gcc_select 4.0
make -C ~/src/libvmx/ clean
env CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" CXXFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc" ~/src/libvmxnet/configure --disable-shared --disable-dependency-tracking
make -C ~/src/libvmx/
sudo make -C ~/src/libvmx/ install
cp -f /usr/local/lib/libvmx.a ~/temp/u4
# build ppc
sudo gcc_select 3.3
make clean
env CFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -arch ppc" CXXFLAGS="-O -g -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -arch ppc" ~/src/libvmx/configure --disable-shared
make -C ~/src/libvmx/
sudo make -C ~/src/libvmx/ install
lipo -thin ppc /usr/local/lib/libvmx.a -output ~/temp/ppc3/libvmx.a
#merge the two
lipo -replace ppc ~/temp/ppc3/libvmx.a -output ~/temp/final/libvmx.a ~/temp/u4/libvmx.a
cp -f ~/temp/final/libvmx.a ~/src/macplayer/
<<winmail.dat>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden