Ticket #2016 (open enhancement)

Opened 5 months ago

Last modified 3 months ago

Support libopenjpeg 2.0.0

Reported by: KSHawkEye Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: libopenjpeg
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I'm trying to compile the latest FFmpeg git with openjpeg 2.0.0 but keep getting an undefined reference to opj_version.

I have already asked for help with this issue here:  http://code.google.com/p/openjpeg/issues/detail?id=200
Here:  http://sourceforge.net/mailarchive/message.php?msg_id=30209438

And one of my users on my forum posted about it here:  http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5&t=674&hilit=opj_version

I think openjpeg is failing to compile in static and is searching for some .dll file when FFmpeg tries to link to it.

Some code that does compile with opj_version is:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <openjpeg.h>

int main(void)
{
    printf("OPJ2 version is %s\n",opj_version());

    return 0;
}

Though I have no idea why that succeeds, and FFmpeg's test code:

extern int opj_version();
int main(void){ opj_version(); }

fails.

This command: $ i686-w64-mingw32-nm ./libopenjp2.a | grep opj_version

Returns:
00000228 T _opj_version@0

So it looks like it is in the lib, but just keeps failing.

Openjpeg 2.0.0 compiled without error.

It also looks like FFmpeg is trying to test the lib with:

BEGIN /tmp/ffconf.ns4yWT3Y.c
    1	extern int opj_version();
    2	int main(void){ opj_version(); }
END /tmp/ffconf.ns4yWT3Y.c
i686-w64-mingw32-gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -std=c99 -fomit-frame-pointer -c -o /tmp/ffconf.ohUKczd4.o /tmp/ffconf.ns4yWT3Y.c
i686-w64-mingw32-gcc -Wl,--as-needed -o /tmp/ffconf.hJciF3wT.exe /tmp/ffconf.ohUKczd4.o -lopenjpeg -lm -lz
/tmp/ffconf.ohUKczd4.o:ffconf.ns4yWT3Y.c:(.text+0xc): undefined reference to `opj_version'
collect2: error: ld returned 1 exit status
ERROR: libopenjpeg not found

I'm happy to provide any further needed information to help get this fixed.

Change History

comment:1 follow-up: ↓ 2 Changed 5 months ago by cehoyos

  • Keywords libopenjpeg added; openjpeg removed
  • Priority changed from important to wish
  • Type changed from defect to enhancement
  • Status changed from new to open
  • Summary changed from undefined reference to `opj_version' to Support libopenjpeg 2.0.0

openjpeg 1.5.1 is expected to work fine, please open an independent ticket if there are any problems with it.

comment:2 in reply to: ↑ 1 Changed 5 months ago by KSHawkEye

Replying to cehoyos:

openjpeg 1.5.1 is expected to work fine, please open an independent ticket if there are any problems with it.

So your saying that FFmpeg doesn't support 2.0.0? There is no reason why the new version should fail and the outdated to succeed.

comment:3 Changed 5 months ago by cehoyos

I am not sure I understand you: Do you mean that when openjpeg support was implemented in 2009, the FFmpeg developers should have foreseen that the libopenjpeg developers will decide to change the name of the libopenjpeg library in 2012 from openjpeg.dll to libopenjp2.dll?
(Note that I am not claiming the name change would be the only change from 1.5 to 2.0, I am just trying to explain that if an external library decides to change its API, there is generally no way to already support the new api when it gets released, so claiming that "there is no reason why the new version should fail and the outdated to succeed" seems like an overreaction to me given that the new version was released three weeks ago and to the best of my knowledge you are the first one to report that there is a new version.)

Last edited 5 months ago by cehoyos (previous) (diff)

comment:4 Changed 5 months ago by rogerdpack

for me, after renaming libopenjp2.a to libopenjpeg.a (to try and fake out ffmpeg), I get this:

libavcodec/libavcodec.a(libopenjpegenc.o): In function `libopenjpeg_encode_frame’:
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:421: undefined reference to `opj_cio_open’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:433: undefined reference to `cio_tell’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:442: undefined reference to `opj_cio_close’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:435: undefined reference to `opj_cio_close’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:428: undefined reference to `opj_cio_close’
libavcodec/libavcodec.a(libopenjpegenc.o): In function `libopenjpeg_encode_close’:
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:450: undefined reference to `opj_destroy_compress’
libavcodec/libavcodec.a(libopenjpegenc.o): In function `libopenjpeg_encode_init’:
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegenc.c:203: undefined reference to `opj_set_event_mgr’
libavcodec/libavcodec.a(libopenjpegdec.o): In function `libopenjpeg_decode_frame’:
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:268: undefined reference to `opj_set_event_mgr’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:273: undefined reference to `opj_cio_open’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:283: undefined reference to `opj_decode_with_info’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:284: undefined reference to `opj_cio_close’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:330: undefined reference to `opj_cio_open’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:339: undefined reference to `opj_decode_with_info’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:340: undefined reference to `opj_cio_close’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:389: undefined reference to `opj_destroy_decompress’
/home/rdp/dev/ffmpeg-windows-build-helpers/sandbox/win32/ffmpeg_git/libavcodec/libopenjpegdec.c:288: undefined reference to `opj_destroy_decompress’
collect2: error: ld returned 1 exit status

Which I assume means that openjpeg has changed their internal api, with version 2, perhaps? (though I might be cross compiling libopenjpeg 2.0.0 wrong as well).

Version 0, edited 5 months ago by rogerdpack (next)

comment:5 Changed 3 months ago by richardpl

  • Component changed from undetermined to avcodec
Note: See TracTickets for help on using tickets.