Linking to dylib fails on release build setting

Discussion in 'Mac Programming' started by davbeck, Oct 6, 2008.

  1. davbeck macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
    #1
    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.
     
  2. Sayer macrumors 6502a

    Sayer

    Joined:
    Jan 4, 2002
    Location:
    Austin, TX
    #2
    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.
     
  3. bobrik macrumors member

    Joined:
    Apr 13, 2007
    Location:
    Prague, Czech Republic
    #3
    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?
     
  4. davbeck thread starter macrumors regular

    Joined:
    May 16, 2008
    Location:
    Reno, NV
    #4
    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.
     

Share This Page