#214 FreeImage 3.5.3 can't save/load TIFF on armv7 (iphone)

open
None
5
2012-10-31
2012-05-31
Xenux
No

FreeImage 3.5.3 doesn't work to save/load TIFF files on iphone with ios 5.1 and armv7. It segfaults with an assertion message:

Assertion failed: (sizeof(uint64)==8), function TIFFClientOpen, file Source/LibTIFF4/./tif_open.c, line 99

I don't know how to fix it. The problem is the same with the iphone simulator. I've built the library with this makefile:
https://sourceforge.net/projects/freeimage/forums/forum/36110/topic/5177533?message=11359751

I've added only one hack to resolve the conflict between objective-c and libray BOOL. (replace typedef by define).

Discussion

  • Hervé Drolon

    Hervé Drolon - 2012-06-10

    Hi,

    The problem is related to "tiffconf.h" located inside FreeImage/Source/LibTIFF4/
    The folowing defines :

    / Signed 64-bit type /

    ifdef _MSC_VER

    define TIFF_INT64_T signed __int64

    else

    define TIFF_INT64_T signed long

    endif // _MSC_VER

    / Unsigned 64-bit type /

    ifdef _MSC_VER

    define TIFF_UINT64_T unsigned __int64

    else

    define TIFF_UINT64_T unsigned long

    endif // _MSC_VER

    should be adapted for your OS, but I don't know what is the right definition to use.

    Hervé

     
  • Christian Heimes

    I run into the same issue when I tried to use FreeImage on 32bit Linux yesterday. The current code doesn't work properly on all 32bit platforms except for Windows. This modification fixes the issue. It's not C89 conform as it requires "long long" which isn't definied in C89. FreeImage requires a ANSI C++89 compiler anyway so this should work on most common platforms.

    / Signed 64-bit type /

    ifdef _MSC_VER

    define TIFF_INT64_T signed __int64

    elif defined(LONG_MAX) && LONG_MAX == +9223372036854775807

    define TIFF_INT64_T long

    elif defined(LLONG_MAX) && LLONG_MAX == +9223372036854775807

    define TIFF_INT64_T long long

    else

    error no suitable int64_t

    endif // _MSC_VER

    / Unsigned 64-bit type /

    ifdef _MSC_VER

    define TIFF_UINT64_T unsigned __int64a

    elif defined(ULONG_MAX) && ULONG_MAX == 18446744073709551615U

    define TIFF_UINT64_T unsigned long

    elif defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U

    define TIFF_UINT64_T unsigned long long

    else

    error no suitable uint64_t

    endif // _MSC_VER

    / Signed 64-bit type /

    if defined(_WIN64)

    define TIFF_SSIZE_T signed __int64

    else

    define TIFF_SSIZE_T ssize_t

    endif

     
  • Christian Heimes

    I'm not sure if ssize_t is available on Windows.

    if defined(_WIN64)

    define TIFF_SSIZE_T signed __int64

    elif defined(_MSC_VER)

    define TIFF_SSIZE_T signed long

    else

    define TIFF_SSIZE_T ssize_t

    endif

     

Log in to post a comment.