Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Can't compile FreeImage 3.16.0 under OSX 10.8.5

Help
dragon9
2014-06-10
2015-02-02
  • dragon9
    dragon9
    2014-06-10

    I'm trying to build Freeimage 3.16.0 under OSX 10.8.5. I'm using the updated 8.5 makefile posted at sourceforge.net/p/freeimage/bugs/228/ and I've applied the fix for Source/OpenEXR/IlmImf/ImfAutoArray.h.

    My problem is with LibJXR. The compiler reports many errors like this:
    Source/FreeImage/../LibJXR/jxrgluelib/JXRGlue.h:99: error: expected initializer before ‘GUID_PKPixelFormatDontCare’

    This looks like a problem with the includes? I have been able to build successfully under Windows7 and Ubuntu.

    I tried removing LibJXR by removing all code references on disk and in Makefile.srcs but just get the following error:
    make[1]: *** No rule to make target Source/FreeImage/PluginJXR.o-x86_64', needed bylibfreeimage.a-x86_64'.

    This is strange because I can't find any reference to PluginJXR in the build path. I've removed Source/LibJXR, Source/FreeImage/PluginJXR.cpp and everything related to it in makefile.srcs. Why does the makefile still expect PluginJXR.o-x86_64 to exist?

    Anyhow, I'd be happy with either a clean compile on LibJXR or a modified build that excludes JXR.

    Please help! :)

     
  • L. Spiro
    L. Spiro
    2014-06-10

    Add ANSI to the list of predefined macros in the project settings (Xcode) or makefile.

    L. Spiro

     
  • L. Spiro
    L. Spiro
    2014-06-10

    That’s [underscore]ANSI[underscore].

    L. Spiro

     
    • dragon9
      dragon9
      2014-06-11

      Thanks, that did the trick!

       
  • Matthew
    Matthew
    2014-06-25

    Hey I wonder in which line of Makefile.osx should I add [underscore]ANSI[underscore] and what is the exact syntax? (It might be lame question but I really dont have any experience in makefiles)

    Thanks in advance

     
  • Jimmy
    Jimmy
    2014-06-26

    I added it to COMPILERFLAGS prefixed with "-D". You may also want to add DISABLE_PERF_MEASUREMENT. For instance:

    COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS -D__ANSI__ -DDISABLE_PERF_MEASUREMENT
    
     
  • Matthew
    Matthew
    2014-06-26

    Thank you Jimmy! :)

     
  • Extro
    Extro
    2014-12-22

    Hi guys.
    Trying to compile in OS X 10.10 / xCode 6.1 - get the many of such errors:

    In file included from Source/FreeImage/PluginJXR.cpp:26:
    Source/FreeImage/../LibJXR/jxrgluelib/JXRGlue.h:99:13: error: expected ';' after
    top level declarator
    DEFINE_GUID(GUID_PKPixelFormatDontCare, 0x6fddc324, 0x4e03, 0x4bfe, 0xb1...

    For what reason it can be?
    PS. And get the same errors while trying to compile for iOS.

     
    Last edit: Extro 2014-12-22
  • John Perry
    John Perry
    2015-02-02

    Getting this to compile & link under OS X 10.10 was a chore. I finally succeeded, but I may have done something wrong. Either way, here's the process, in case someone can help (or needs it).

    • Both L. Spiro's suggestion and Jimmy's were essential. libJXR won't compile unless __ANSI__ is selected (whether this is a compiler error, a change in the language, or poor construction of a #define, I don't know, but I've never seen a #define used the way they do it on DEFINE_GUID. FreeImage won't link with other programs unless performance measurement is disabled.
    • The Makefile tries to compile for PPC and i386, even though they are not supported (as far as I can tell). I either had to remove those compiler possibilities, or I specifically had to invoke make libfreeimage.a-x86_64 instead of make. This builds the static library, but not the dynamic one. (I may have removed that, because it simply failed to build even here. Not sure.)
    • Of course, that breaks make install, because it looks specifically for libfreeimage.a, and the make command I used made libfreeimage.a-x86_64 (sensibly enough). That's easy to fix, but it also looks for the dynlib, which I wasn't able to build, so I had to remove that from make install, as well. Fine by me; I linked statically, anyway.
    • The initial linker and ranlib commands give errors of this sort (ranlib when applied to libfreeimage.a):
      /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/SMSandboxTools-tmp/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /usr/local/lib/libfreeimage.a(FreeImageC.o-x86_64) has no symbols
      /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/SMSandboxTools-tmp/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /usr/local/lib/libfreeimage.a(tif_lzma.o-x86_64) has no symbols
      /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/SMSandboxTools-tmp/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /usr/local/lib/libfreeimage.a(ImathBox.o-x86_64) has no symbols
      /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/Cleanup At Startup/SMSandboxTools-tmp/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: /usr/local/lib/libfreeimage.a(ImathShear.o-x86_64) has no symbols

    However, my client program I have builds, links, and executes just fine with the result, so I don't get it.

    Hope this is helpful to someone.