Creating static library for iPhone SDK 4.1

Official forum for the Chipmunk2D Physics Library.
Post Reply
ayushv
Posts: 14
Joined: Thu Oct 21, 2010 1:52 pm
Contact:

Creating static library for iPhone SDK 4.1

Post by ayushv »

I was using Chipmunk with iPhone SDK 4.0 with no problems. I upgraded to SDK 4.1 today (XCode 3.2.4) and tried to run the iphone-static.sh shell script in the macosx directory of the Chipmunk folder. I'm getting the following error in the Terminal window:


Build settings from command line:
PLATFORM_NAME = iphoneos
SDKROOT = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk

xcodebuild: Error: the project Chipmunk.xcodeproj does not exist in this directory.
Build settings from command line:
PLATFORM_NAME = iphonesimulator
SDKROOT = /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk

xcodebuild: Error: the project Chipmunk.xcodeproj does not exist in this directory.
lipo: can't open input file: build/Debug-iphonesimulator/libChipmunk-iPhone.a (No such file or directory)
rsync: link_stat "/Users/ayush/../include/chipmunk/." failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-40/rsync/main.c(992) [sender=2.6.9]
Copy Chipmunk-iPhone into your project and enjoy.
logout




I've checked the SDK version in the script and it matches with the installed SDK (i.e. 4.1) on my machine. The installed SDKs are at the default location i.e. /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/

Running the script gives the above errors and the static library has not been created and nor has the Chipmunk-iphone folder. I had faced no such issues when I ran the shell script for SDK 4.0 a few weeks back.

Please help. Is there any other way to create the static library?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Creating static library for iPhone SDK 4.1

Post by slembcke »

I really need to fix the script so it doesn't say it was successful when the build fails. :-\

How are you running the script? It needs to be run from the macosx directory, running the script from the Finder should do this automatically. I'm assuming that's why it can't find the project file.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
ayushv
Posts: 14
Joined: Thu Oct 21, 2010 1:52 pm
Contact:

Re: Creating static library for iPhone SDK 4.1

Post by ayushv »

Yes - I was indeed running it directly from finder but it wasnt working.

Just to update:

I opened the project in Xcode and used the Build button to create the static library for Release and Debug versions separately. Then I ran the following command extracted from your script -

lipo build/Debug-iphonesimulator/libChipmunk-iPhone.a build/Release-iphoneos/libChipmunk-iPhone.a -create -output libChipmunk-iPhone.a

This created the static library in the macosx directory. I copied the static library in the /include folder with all the headers and then dropped that folder in my XCode project. That worked fine and Chipmunk was up and running in my app.

The weird thing is (and I feel sheepish telling you this) that after I did the above, the next time I ran the script from Finder, it worked perfectly and created the complete Chipmunk-iPhone folder. So I'm using that now.
ceggert
Posts: 4
Joined: Wed Jan 20, 2010 11:13 am
Contact:

Re: Creating static library for iPhone SDK 4.1

Post by ceggert »

I have used the script to create the static library and it in deed created the libChipmunk-iPhone.a file.

I then added the folder "Chipmunk-iPhone" to my project.

When I build I get the msg:

ld: library not found for -lChipmunk-iPhone
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

Now what do I do? what have i missed? Does it matter where the folder is added?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Creating static library for iPhone SDK 4.1

Post by slembcke »

Check that the library search paths for you target (search for it under the build tab) includes the directory where the lib actually is. Xcode has a habit of breaking search paths.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
ceggert
Posts: 4
Joined: Wed Jan 20, 2010 11:13 am
Contact:

Re: Creating static library for iPhone SDK 4.1

Post by ceggert »

ok, thanks. There was a missing "/" in the path. doh!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests