How do I build DevIL?

Member
Posts: 104
Joined: 2007.01
Post: #1
I downloaded the DevIL 1.6.8RC2 source onto my PowerBook G4, but I have two problems with it. First, the README says to look at README.macosx, but there is no such file. Second, I try to open the XCode project and it gives me an error:

"Unable to Open Project
Project /Users/troy/Projects/DevIL-1.6.8/projects/xcode/DevIL.xcode cannot be opened because the project file cannot be parsed."

I would guess someone here must have figured this out already. How do I build DevIL as a universal binary?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Quote this message in a reply
Member
Posts: 104
Joined: 2007.01
Post: #3
Okay, I've got FreeImage working fine and dandy on Linux.

Mac, however, is another story. I updated the Search paths in XCode to find the FreeImage headers and dylib, and it builds and links ok. But it doesn't run. It says it can't find the dylib. I looked, but couldn't find the dylib anywhere in the application bundle.

How do you add the dylib to XCode so it gets put in the application bundle so my program can find it?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
Use a Copy Files build phase. The dylib needs to be built with the correct install_name, however, which it may not be by default.
Quote this message in a reply
Member
Posts: 104
Joined: 2007.01
Post: #5
For the record (for those like me who peruse the forums looking for answers and sometimes find only questions), here are the steps I took to build FreeImage as a universal binary. (The instructions that came with FreeImage didn't work for me)

1) Edit Makefile.osx, and change these lines:
- COMPILERFLAGS_PPC = -arch ppc -arch i386
- COMPILERFLAGS_I386 = -arch ppc -arch i386
- INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
- INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.4u.sdk
- LIBRARIES_PPC = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk
- LIBRARIES_I386 = -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk

The COMPILERFLAGS options tell it to build a universal binary, no matter which hardware platform I happen to be running on.

The INCLUDE and LIBRARIES for PPC pointed to an older version of the SDK, and would not build for me (probably because I updated my PowerBook G4 to run Mac OS X 10.4 instead of 10.3.9). So I made it build against the same version for both intel and PPC.

2) Modify the link lines for $(SHAREDLIB)-ppc and $(SHAREDLIB)-i386 to add:
"-install_name @executable_path/../Frameworks/$(SHAREDLIB)"

That fixes the install_name so that I can include it in my application bundle.

3) make -f Makefile.osx

Hope that saves others some confusion and/or frustration.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Displaying image with OpenGL and DevIL in C? leRiCl 13 9,523 Jan 23, 2007 01:25 PM
Last Post: djork
  DevIL - saving images to file!!!! alert 2 2,844 Jun 2, 2005 03:43 AM
Last Post: alert
  DevIL OneSadCookie 2 2,815 Dec 7, 2003 02:46 PM
Last Post: Entropy