Skip to content

OpenJpeg cross compile with Emscripten #1182

@Neuroforge

Description

@Neuroforge

Hello,

I am looking at the project https://github.com/cornerstonejs/openjpeg which is a fork of this repository that uses Emscripten to compile OpenJpeg to Javascript.

I have managed to compile the original with a newer version of Emscripten (v1.38.27) which appears to provide a significant improvement in the file size.

The project is 2 years old and ~435 commits behind the current version of OpenJpeg.

It appears that OpenJpeg is quite different after two years of work.

The wrapper file needed by Emscripten is not longer valid.

https://github.com/cornerstonejs/openjpeg/blob/master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c

There appears to be 4 errors in the wrapper which mean that i cannot compile with any of the updates made in the past 2 years. Does anyone have enough insight into how the codebase has changed in order to resolve these issues?

  1. opj_buffer_info_t is now opj_marker_info_t - Easy fix i assumed, just a name change.
  2. opj_marker_info no longer has a buf - Not clear how this works.
  3. opj_marker_info no longer has a cur - Not clear how this works.
  4. opj_stream_create_buffer_stream is now opj_stream_create_file_stream - Takes an extra argument.

/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:75:5: error: unknown type name 'opj_buffer_info_t'; did you mean 'opj_marker_info_t'?
opj_buffer_info_t buffer_info;
^~~~~~~~~~~~~~~~~
opj_marker_info_t
/Documents/Openjpeg/openjpeg-master/src/lib/openjp2/openjpeg.h:749:3: note: 'opj_marker_info_t' declared here
} opj_marker_info_t;
^
/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:76:17: error: no member named 'buf' in 'struct opj_marker_info'
buffer_info.buf = data;
~~~~~~~~~~~ ^
/Users/johnbell/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:77:17: error: no member named 'cur' in 'struct opj_marker_info'
buffer_info.cur = data;
~~~~~~~~~~~ ^
/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:79:16: error: implicit declaration of function 'opj_stream_create_buffer_stream' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
l_stream = opj_stream_create_buffer_stream(&buffer_info, OPJ_TRUE);
^
/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:79:16: note: did you mean 'opj_stream_create_file_stream'?
/Users/johnbell/Documents/Openjpeg/openjpeg-master/src/lib/openjp2/openjpeg.h:1220:36: note: 'opj_stream_create_file_stream' declared here
OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream(
^
/Documents/Openjpeg/openjpeg-master/wrapping/JS/openjp2/JSOpenJPEGDecoder.c:79:14: warning: incompatible integer to pointer conversion assigning to 'opj_stream_t *' (aka 'void **') from 'int' [-Wint-conversion]
l_stream = opj_stream_create_buffer_stream(&buffer_info, OPJ_TRUE);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 4 errors generated.
shared:ERROR: compiler frontend failed to generate LLVM bitcode, halting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions