Menu

Using DevIL with Xcode/MacOS

Help
2010-04-21
2013-05-02
  • Miguel Andrade

    Miguel Andrade - 2010-04-21

    Hello everyone! I'm trying to use DevIL with Xcode but I can't get it to work.

    I tried using the "standard" method by doing "configure make make install" and using #import <IL/il> but it doesn't work. It identifies the library but I still get some compiling errors:

    Ld build/Release/cg.app/Contents/MacOS/cg normal i386 cd "/Users/simaorfreitas/Documents/LESI/3º ano/CG/CGaula1" /Developer/usr/bin/g++-4.2 -arch i386 "-L/Users/simaorfreitas/Documents/LESI/3º ano/CG/CGaula1/build/Release" "-F/Users/simaorfreitas/Documents/LESI/3º ano/CG/CGaula1/build/Release" -filelist "/Users/simaorfreitas/Documents/LESI/3º ano/CG/CGaula1/build/CGaula1.build/Release/cg.build/Objects-normal/i386/cg.LinkFileList" -framework Foundation -framework AppKit -framework GLUT -framework OpenGL -framework Cocoa -framework AppKit -o "/Users/simaorfreitas/Documents/LESI/3º ano/CG/CGaula1/build/Release/cg.app/Contents/MacOS/cg"

    Undefined symbols: "_ilConvertImage", referenced from: terreno() in main.o "_ilGetInteger", referenced from: terreno() in main.o terreno() in main.o terreno() in main.o "_ilLoadImage", referenced from: terreno() in main.o "_ilBindImage", referenced from: terreno() in main.o "_ilGetData", referenced from: terreno() in main.o "_ilInit", referenced from: terreno() in main.o "_ilGenImages", referenced from: terreno() in main.o ld: symbol(s) not found collect2: ld returned 1 exit status`

    So I tried do it by using the macports libdevil install. It installed correctly but nothing seems to work. Do I need to change my #import declarations?

    Any suggestion to install DevIL on the Mac correctly and use it in a Xcode Project?

    I've tried almost everything!
    That includes: building from source, installing from macports, building older versions, googling the whole internet, …

    There's so little information on this subject… And I really need this for a school project.

    Please help.
    Thanks a lot!
    Miguel.

     
  • Matěj Týč

    Matěj Týč - 2010-04-21

    Hello,
    thank you for your feedback.
    Could you try to use the latest tarball (= the prerelease)?
    Try to run 'make check' after configure and if something goes wrong (either test fails or the lib doesn't work), attach the config.log file (it is created by the configure script)
    Regards,
    Matej

     
  • Miguel Andrade

    Miguel Andrade - 2010-04-21

    Well, tried

    ./configure --enable-ILU --enable-ILUT
    

    And then

    make check
    

    , here's the output (from the first line that gives error to the last one) :

    ./../src-IL/src/il_icon.c:18:18: error: png.h: No such file or directory
    ./../src-IL/src/il_icon.c:392: error: expected =, ,, ;, asm or __attribute__ before ico_png_ptr
    ./../src-IL/src/il_icon.c:393: error: expected =, ,, ;, asm or __attribute__ before ico_info_ptr
    ./../src-IL/src/il_icon.c:425: error: expected ) before png_ptr
    ./../src-IL/src/il_icon.c:433: error: expected ) before png_ptr
    ./../src-IL/src/il_icon.c:449: error: expected ) before png_ptr
    ./../src-IL/src/il_icon.c: In function ico_readpng_init:
    ./../src-IL/src/il_icon.c:458: error: ico_png_ptr undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:458: error: (Each undeclared identifier is reported only once
    ./../src-IL/src/il_icon.c:458: error: for each function it appears in.)
    ./../src-IL/src/il_icon.c:458: error: PNG_LIBPNG_VER_STRING undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:458: error: ico_png_error_func undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:458: error: ico_png_warn_func undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:462: error: ico_info_ptr undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:483: error: ico_png_read undeclared (first use in this function)
    ./../src-IL/src/il_icon.c: In function ico_readpng_get_image:
    ./../src-IL/src/il_icon.c:502: error: png_bytepp undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:502: error: expected ; before row_pointers
    ./../src-IL/src/il_icon.c:503: error: png_uint_32 undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:503: error: expected ; before width
    ./../src-IL/src/il_icon.c:507: error: png_colorp undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:507: error: expected ; before palette
    ./../src-IL/src/il_icon.c:518: error: ico_png_ptr undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:519: error: ico_info_ptr undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:523: error: expected expression before ) token
    ./../src-IL/src/il_icon.c:527: error: PNG_COLOR_TYPE_GRAY undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:534: error: PNG_INFO_tRNS undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:534: error: PNG_INFO_PLTE undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:538: error: expected expression before ) token
    ./../src-IL/src/il_icon.c:572: error: PNG_COLOR_TYPE_PALETTE undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:576: error: PNG_COLOR_TYPE_RGB undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:580: error: PNG_COLOR_TYPE_RGB_ALPHA undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:590: error: PNG_COLOR_MASK_COLOR undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:593: error: width undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:594: error: height undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:606: error: png_bytep undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:606: error: expected ; before trans
    ./../src-IL/src/il_icon.c:608: error: palette undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:617: error: trans undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:639: error: row_pointers undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:639: error: expected ) before ialloc
    ./../src-IL/src/il_icon.c: In function ico_readpng_cleanup:
    ./../src-IL/src/il_icon.c:666: error: ico_png_ptr undeclared (first use in this function)
    ./../src-IL/src/il_icon.c:666: error: ico_info_ptr undeclared (first use in this function)
    make[1]: *** [il_base_la-il_icon.lo] Error 1
    make: *** [check-recursive] Error 1
    

    And here's the config.log: http://dl.dropbox.com/u/2847878/DevIL/config_with_ILU_ILUT.log

    If i run

    ./configure
    

    , the output is exactly the same as the above, and here's the config.log i got: http://dl.dropbox.com/u/2847878/DevIL/config.log

    Thanks for trying to help!
    I hope I made myself clear in the above explanation.
    Oh, and I could not find how to attach files, so I uploaded them. It's safe.

    Regards,
    Miguel.

     
  • Miguel Andrade

    Miguel Andrade - 2010-04-23

    I've red in the changlog that you once provided an Xcode pre compiled framework, but then it was discontinued.

    Can you provide us that old framework for Xcode?

    An old version it's better than no version. :\

    I would love to have this brilliant library on my mac. Thanks!

     
  • Matěj Týč

    Matěj Týč - 2010-04-25

    Very good, you have just exposed a glitch within the build system.
    Although I don't really understand the Mac frameworks stuff, the reason of the failiure is different.
    Possible solutions:
    - Wait for the bugfix release
    - Pass the '-disable-icon' option to the configure script.
    - Pass the 'CPPFLAGS=-I/opt/local/include/libpng12 LDFLAGS=-L/opt/local/lib'  to the configure script

    The problem is that the ICON component of DevIL uses LIBPNG, but the LIBPNG flags are not passed to it at the moment.
    So you either disable that format (it is not a very important one), or you tell the whole DevIL where your LIBPNG library is.
    Regards,
    Matej

     
  • Miguel Andrade

    Miguel Andrade - 2010-04-25

    Great! We're making progress.

    Now, when I run "./configure -enable-ILU -enable-ILUT CPPFLAGS=-I/opt/local/include/libpng12 LDFLAGS=-L/opt/local/lib", I get the following log:
    http://dl.dropbox.com/u/2847878/DevIL/new_config.log

    The output of configure was normal.
    But the make check went like this:

    Running saving and loading consistency test...
    Error loading file 'test.PSD'
    Reason: no error
    Format test: FAIL (.PSD)
    Errors were encountered during the test :-(
    Formats that were OK: BMP DDS HDR JPEG JP2 PCX PNG SGI TGA TIFF
    Failed formats: PSD
    Problematic (untested) formats: RAW VTF WBMP XPM
    FAIL: format_test/format_checks.sh
    Running ILU manipulation test...
    All examined manipulations were OK: Alienify BlurAvg BlurGaussian Contrast Contrast Emboss Equalize GammaCorrect GammaCorrect Mirror Negative Pixelize Saturate1f Sharpen Sharpen Wave
    Problematic (untested) manipulations: Noisify
    PASS: format_test/ilu_checks.sh
    ============================================
    1 of 2 tests failed
    Please report to bubla@users.sourceforge.net
    ============================================
    make[2]: *** [check-TESTS] Error 1
    make[1]: *** [check-am] Error 2
    make: *** [check-recursive] Error 1
    

    Ok. Nothing to worry about, I think. PSD files aren't supported, but the library seems to be compiled successfully.

    Now, when I try to use DevIL on my Xcode, i get this whenever I use a DevIL function:

    I've configured Xcode to look up for includes on "/usr/local/include" and to compile the project with "-lil -lilu -lilut" flags.

    If you need the code I'm trying to compile, please tell me, but it came directly from a windows machine on wich it worked. Or at least didn't give any errors, though…

    Thank you for your help, and it is a pleasure to contribute.
    Miguel.

     
  • Matěj Týč

    Matěj Týč - 2010-04-26

    The trouble the PSD format makes is hard to understand for me.
    Anyway, good news is that all other tests went fine, congratulations!

    Anyway, try to pass `pkg-config -libs ILU` to your program.
    OR try to link with -lIL -lILU (the upper case matters).
    I don't have a very good feeling about ILUT, it is quite outdated…

     
  • Miguel Andrade

    Miguel Andrade - 2010-04-26

    It's not working.

    Let me try with g++, without Xcode.

    What would be a normal command for g++ to compile a simple program using DevIL?

     
  • Matěj Týč

    Matěj Týč - 2010-04-27

    Take a look what command is used to compile programs during "make check" run (when you compile DevIL)
    All compile commands are visible there.
    Anyway, try running "pkg-config -libs ILU" in your shell.
    And you should have some libIL.* files in your library path, check up on that, too.

     
  • Miguel Andrade

    Miguel Andrade - 2010-04-27

    I got this:

    -L/opt/local/lib -lILU -lIL -ltiff -lpng12 -lmng -llcms -ljasper -ljpeg

    I don't really understand what this means. :\

    And shouldn't the library be in /usr/local/lib ?

     
  • Matěj Týč

    Matěj Týč - 2010-04-27

    OK, these are flags that you have to pass to the linker.
    The default location of library installation depends on your system configuration, so I would leave like it is.
    Anyway, try to google how to use pkg-config with Xcode, it is a quite useful thing.

     

Log in to post a comment.