[FFmpeg-devel] [PATCH] libopenjpeg: do not define OPJ_STATIC for shared builds

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Tue Oct 11 18:50:01 EEST 2016


Setting OPJ_STATIC when building shared libraries with openjpeg 2 causes
the openjpeg symbols to have visibility hidden and the final linker step
to fail due to undefined references.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/libopenjpegdec.c | 3 +++
 libavcodec/libopenjpegenc.c | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 65167e6..1f8dadf 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -24,7 +24,10 @@
  * JPEG 2000 decoder using libopenjpeg
  */
 
+#include "config.h"
+#if !CONFIG_SHARED
 #define  OPJ_STATIC
+#endif
 
 #include "libavutil/common.h"
 #include "libavutil/imgutils.h"
diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 1443551..023fdf4 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -24,7 +24,10 @@
  * JPEG 2000 encoder using libopenjpeg
  */
 
+#include "config.h"
+#if !CONFIG_SHARED
 #define  OPJ_STATIC
+#endif
 
 #include "libavutil/avassert.h"
 #include "libavutil/common.h"
-- 
2.9.3


More information about the ffmpeg-devel mailing list