Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

davbeck

macrumors regular
Original poster
May 16, 2008
104
0
Reno, NV
I am trying to use a dylib (libgeotiff) with a c program in Xcode. When I compile it with build configuration debug, it compiles fine and runs without error. But when I switch to Release, I get a linking error for every function in the dylib.

My first thought was that the library was not compiled with universal support, which it wasn't. So using Porticus, I reinstalled it with universal. The utilities that come with it were compiled correctly with universal, I am not sure how to check the dylib.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
You can check a dylib by opening the Terminal and typing:

lipo -info /path/to/dylib

That will tell you if its a "Fat" binary or not.
 

bobrik

macrumors member
Apr 13, 2007
70
0
Prague, Czech Republic
with build configuration debug, it compiles fine and runs without error. But when I switch to Release, I get a linking error for every function in the dylib.

I am shooting a bit blind here since I am used to Visual Studio and not XCode, but I have seen same thing with Visual Studio and it's always that you tell your project to link to the library, but when you are in debug configuration. What you forget (don't realize) is that you need also to switch configuration to release and there to specify to link to that library as well. Maybe that's it?
 

davbeck

macrumors regular
Original poster
May 16, 2008
104
0
Reno, NV
sorta fixed it

I was able to bring in all the source files and what not from the library and build it there. It took me a while to recreate all the make settings, but I eventually got it to compile correctly. For whatever reason, no matter what variables got set, the library would not compile for universal.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.