[FFmpeg-trac] #2016(undetermined:new): undefined reference to `opj_version'

FFmpeg trac at avcodec.org
Wed Dec 12 05:24:38 CET 2012

#2016: undefined reference to `opj_version'
               Reporter:  KSHawkEye  |                  Owner:
                   Type:  defect     |                 Status:  new
               Priority:  important  |              Component:
                Version:  git-       |  undetermined
  master                             |               Keywords:  openjpeg
             Blocked By:             |               Blocking:
Reproduced by developer:  0          |  Analyzed by developer:  0
 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:
 Here: [http://sourceforge.net/mailarchive/message.php?msg_id=30209438]

 And one of my users on my forum posted about it here:

 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(); }


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

 00000228 T _opj_version at 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

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2016>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list