compiling exiftran C code on macpro

Discussion in 'Mac Programming' started by den is, May 14, 2011.

  1. macrumors newbie

    Joined:
    May 14, 2011
    Messages:
    2
    #1
    Hi

    I have compiled the C source code for exiftran (installing all the missing libraries as I came across them). Then I tried to run it and get this:

    denis$ exiftran -ai RemDay\ DSC_7477r.JPG
    processing RemDay DSC_7477r.JPG
    Bus error

    I tried to run it with gdb and got this:

    (gdb) run -ai RemDay\ DSC_7477r.JPG
    Starting program: /usr/local/bin/exiftran -ai RemDay\ DSC_7477r.JPG
    Reading symbols for shared libraries ++++. done
    processing RemDay DSC_7477r.JPG

    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_PROTECTION_FAILURE at address: 0x00000080
    0x000045ae in ?? ()
    (gdb) bt
    #0 0x000045ae in ?? ()
    #1 0x0004c030 in jpeg_default_colorspace (cinfo=0x807e04) at jcparam.c:391
    #2 0x000047f1 in ?? ()
    #3 0x00003952 in ?? ()
    #4 0x00003b55 in ?? ()
    #5 0x00003ddd in ?? ()
    #6 0x000040bb in ?? ()
    #7 0x000028aa in ?? ()
    #8 0x000023e6 in ?? ()

    Can anyone suggest where to go from here?
     
  2. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Messages:
    1,448
    Location:
    Sydney
    #2
    Perhaps start by recompiling the jpeg library and exiftran with the cflags -g -O0. This should at least get you a better backtrace.
     
  3. macrumors newbie

    Joined:
    May 14, 2011
    Messages:
    2
    #3
    If I compile with -O0 I only get this with the bt:

    (gdb) run -ai RemDayDSC_7477r.JPG
    Starting program: /usr/local/bin/exiftran -ai RemDayDSC_7477r.JPG
    Reading symbols for shared libraries ++++. done
    processing RemDayDSC_7477r.JPG

    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_PROTECTION_FAILURE at address: 0x00000080
    0x000045ae in ?? ()
    (gdb) bt
    #0 0x000045ae in ?? ()
    #1 0x00000002 in ?? ()
    Cannot access memory at address 0x5
    (gdb)

    I tried compiling all the modules/libraries I installed for this (libexif, libjpeg and exiftran) with -g3 -O but it made no difference.

    Reading deeper into the Install texts there is a jmemmac.c module for libjpeg. But when I changed the configure to use this and the corresponding header files (which I think I got right, but I am not very good with system build files) the compilation fell over in a heap. It seems to be a very old module which may not apply to the current versions of mac OSX.

    I am beginning to think it may be easier to install ubuntu on the mac and use the exiftran that comes as standard with ubuntu.
     
  4. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Messages:
    1,448
    Location:
    Sydney
    #4
    I don't understand. I compiled/installed the dependencies via MacPorts. Then I compiled exiftran like this.

    Code:
    export CFLAGS="-g -O0"
    make exiftrans
    
    Then when I run it, it still didn't work, but I get a full-info backtrace. (You can probably ignore that I'd compiled a 64-bit executable).

    Code:
    (gdb) run -ai IMG_0095.JPG
    Starting program: /Users/jim/Downloads/fbida-2.07/exiftran -ai IMG_0095.JPG
    Reading symbols for shared libraries .+++........ done
    processing IMG_0095.JPG
    
    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_INVALID_ADDRESS at address: 0x0000000300000010
    0x000000010000650a in transpose_critical_parameters (dstinfo=0x7fff5fbfe738) at transupp.c:656
    656	    itemp = compptr->h_samp_factor;
    (gdb) bt
    #0  0x000000010000650a in transpose_critical_parameters (dstinfo=0x7fff5fbfe738) at transupp.c:656
    #1  0x00000001000068c5 in jtransform_adjust_parameters (srcinfo=0x7fff5fbfe4a8, dstinfo=0x7fff5fbfe738, src_coef_arrays=0x100832710, info=0x7fff5fbfe3f0) at transupp.c:785
    #2  0x0000000100003b30 in do_transform (src=0x7fff5fbfe4a8, dst=0x7fff5fbfe738, transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, flags=1) at jpegtools.c:447
    #3  0x0000000100003257 in do_thumbnail (ed=0x1002062c0, transform=JXFORM_ROT_90) at jpegtools.c:299
    #4  0x0000000100003547 in do_exif (src=0x7fff5fbff0c8, transform=0x7fff5fbfec2c, thumbnail=0x0, tsize=0, flags=35) at jpegtools.c:364
    #5  0x0000000100003a05 in do_transform (src=0x7fff5fbff0c8, dst=0x7fff5fbfee80, transform=JXFORM_ROT_90, comment=0x0, thumbnail=0x0, tsize=0, flags=35) at jpegtools.c:427
    #6  0x0000000100003d2b in jpeg_transform_fp (in=0x7fff70726f40, out=0x7fff70726fd8, transform=4294967295, comment=0x0, thumbnail=0x0, tsize=0, flags=35) at jpegtools.c:496
    #7  0x0000000100004399 in jpeg_transform_inplace (file=0x7fff5fbff78d "IMG_0095.JPG", transform=4294967295, comment=0x0, thumbnail=0x0, tsize=0, flags=35) at jpegtools.c:593
    #8  0x0000000100001f9e in main (argc=3, argv=0x7fff5fbff630) at exiftran.c:263
    (gdb) 
    
     

Share This Page