Version 0.18.6 crashes constantly on Mac

Hi,

just trying to update use of libraw within a Java application. Starting wit 0.17 no problems have been found to include it using Java native interface (JNI). Just upgraded to 0.18.6-Release. Now libraw keeps crashing when initializing LibRaw (processor).

Switching back to version 0.17.x will bring the application back to working.

However I'm in need to enable processing of images taken with a new Canon EOS 77D. This won't work with version 0.17. Trying to compile 0.19 from Github also didn't work to solve the problem (just did not create a lib).

I'm working with developer tools on macOS El Capitan and macOS High Sierra with no luck.

While 0.17 compiles and runs like a charm, newer versions don't.

Thank you for your suggestions.

Code sample (in underlying C Code below Java app):

JNIEXPORT jintArray JNICALL Java_net_bwmc_libraw_LibRawImageLoader_loadRawImage
(JNIEnv *env, jclass clazz, jobject javaImageLoaderRef, jstring filename, jobject metadata, jint width, jint height)
{
// Open the file and read the metadata
const char *cfilename = env->GetStringUTFChars(filename, 0);

c_system_out_println(env, "Starting to read file %s.", cfilename);
// SO FAR NO PROBLEM...

// Let's create an image processor
LibRaw iProcessor;

// And bam!
// Code will not show following output, crash seems to be within construction of LibRaw object. and before starting to set output parameters.
c_system_out_println(env, "Preparing output parameters header.");

iProcessor.output_params_ptr()->half_size = 1; /* dcraw -h */
iProcessor.output_params_ptr()->no_auto_bright = 1; /* dcraw -W */
...

Forums: 

Additional info

Thought it probably could be a mismatch between newer Oracle Java which is 64-bit only. Just downloaded the binary distribution 0.18.6 for macOS which is claimed to contain both 32 and 64 bit versions and shall run with Mac OS 10.11. In fact, I only found a single set of libraries pre-compiled. Are these 64-bit? Nevertheless, I experience the same behavior, the code will crash during creation of LibRaw object, when (static) linking the libs against my own code.

Tried both linking with both static libraries libraw and also libraw_r, which is claimed thread-safe. The JNI bridge starts working and properly calls LibRaw::version() without issues. However, when trying to crate the processor object, it crashes during the initializer.

JNIEXPORT jstring JNICALL Java_net_bwmc_libraw_LibRawImageLoader_getVersion
(JNIEnv *env, jclass clazz, jobject javaImageLoaderRef)
{
const char* cversionString = LibRaw::version(); // No problem to call this.
jstring versionString = env->NewStringUTF(cversionString); // C style string to Java String

return versionString;
}

Does provided sample

Does provided sample applications (e.g. bin/dcra_emu) works, or crashes too?

-- Alex Tutubalin @LibRaw LLC

Hi Alex,

Hi Alex,

Thank you for your reply.

Just checked: dcraw_emu will run properly. However, linking the native DLL against the static library 'libraw.a' or 'libraw_r.a' will crash with described failure during initializer of LibRaw (processor). The Java application has reasonable memory added (a few GB of heap). With exactly the same linking procedure libraw.a from LibRaw-0.17 works properly. What might go wrong here at build time?

BTW: Will 0.18 provide support for EOS 77D? I guess, no, but not certain.

Just switched back to dcraw. But this solution comes with drawback not being able to access the native camera data like black values, cam_matrix, etc. So, I prefer the use of libraw for raw processing.

Could you give some advice where to look into make files or build configuration what might cause the crash using libraw.a from the new version?

I can provide a Java stack trace, but this is not very informative, as it does not go deep enough into the native C code.

Best wishes for 2018!

Please make sure you use

Please make sure you use libraw.h (and other include files) for the same version: internal layout changes from version to version, there is no binary (ABI) compatibility between LibRaw 0.17 and (say) LibRaw 0.18 (unless you use C-API only).

If version mismatch is *not* problem cause, I do not have any other ideas.

-- Alex Tutubalin @LibRaw LLC

Hi Alex,

Hi Alex,

thanks a lot! That solved my issue. Found the header files unchanged at the place where they should be and adapted my makefile to use the new ones directly from the source location. Now, linking is no longer the problem, and images will now load.

Unfortunately, EOS 77D doesn't seem to be supported by this version.

Tried to fetch the GitHub repository to get it to run anyway. But there is no branch assigne with version 0.19 as indicated by your latest post about it. Which branch will continue the patch for EOS 77D?

Thank you in advance!

EOS 77D is supported by

EOS 77D is supported by github-master version.

-- Alex Tutubalin @LibRaw LLC

Hi,

Hi,

do you mind to share the Mac and Win jni libraries to this community? :-D

Thanks