zoukankan      html  css  js  c++  java
  • MinGW平台 openjpeg-2.1.0 静态编译后未定义引用的解决方法

    undefined reference to __imp_opj_xxx
    keyword:
       ffmpeg,openjpeg,OPJ_EXPORTS,OPJ_STATIC,opj_version,__imp_opj
    
    出错原因: 
        1. __declspec(dllexport) / __declspec(dllimport)
        2. __stdcall
    
    解决方法:
    openjpeg-2.1.0-modify.to.static.patch
    
    --- src/lib/openjp2/openjpeg.h.orig	2014-04-29 20:58:10 +0800
    +++ src/lib/openjp2/openjpeg.h	2016-03-26 01:07:32 +0800
    @@ -80,14 +80,14 @@
     /* http://gcc.gnu.org/wiki/Visibility */
     #if __GNUC__ >= 4
     #define OPJ_API    __attribute__ ((visibility ("default")))
    -#define OPJ_LOCAL  __attribute__ ((visibility ("hidden")))
    +#define OPJ_LOCAL  __attribute__ ((visibility ("default")))
     #else
     #define OPJ_API
     #define OPJ_LOCAL
     #endif
     #define OPJ_CALLCONV
     #else
    -#define OPJ_CALLCONV __stdcall
    +#define OPJ_CALLCONV 
     /*
     The following ifdef block is the standard way of creating macros which make exporting 
     from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
    @@ -97,9 +97,9 @@
     defined with this macro as being exported.
     */
     #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
    -#define OPJ_API __declspec(dllexport)
    +#define OPJ_API __attribute__ ((visibility ("default")))
     #else
    -#define OPJ_API __declspec(dllimport)
    +#define OPJ_API 
     #endif /* OPJ_EXPORTS */
     #endif /* !OPJ_STATIC || !_WIN32 */
     
    --- src/lib/openjp3d/openjp3d.h.orig	2014-04-29 20:58:10 +0800
    +++ src/lib/openjp3d/openjp3d.h	2016-03-26 00:08:35 +0800
    @@ -64,9 +64,9 @@
     defined with this macro as being exported.
     */
     #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
    -#define OPJ_API __declspec(dllexport)
    +#define OPJ_API __attribute__((visibility ("default")))
     #else
    -#define OPJ_API __declspec(dllimport)
    +#define OPJ_API 
     #endif /* OPJ_EXPORTS */
     #endif /* !OPJ_STATIC || !WIN32 */
     
    --- src/lib/openmj2/openjpeg.h.orig	2014-04-29 20:58:10 +0800
    +++ src/lib/openmj2/openjpeg.h	2016-03-26 00:09:40 +0800
    @@ -66,9 +66,9 @@
     defined with this macro as being exported.
     */
     #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
    -#define OPJ_API __declspec(dllexport)
    +#define OPJ_API __attribute__((visibility ("default")))
     #else
    -#define OPJ_API __declspec(dllimport)
    +#define OPJ_API 
     #endif /* OPJ_EXPORTS */
     #endif /* !OPJ_STATIC || !_WIN32 */
     
    --- thirdparty/include/zconf.h.orig	2014-04-29 20:58:10 +0800
    +++ thirdparty/include/zconf.h	2016-03-25 11:15:49 +0800
    @@ -277,9 +277,9 @@
     #  ifdef ZLIB_DLL
     #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
     #      ifdef ZLIB_INTERNAL
    -#        define ZEXTERN extern __declspec(dllexport)
    +#        define ZEXTERN extern __attribute__((visibility ("default")))
     #      else
    -#        define ZEXTERN extern __declspec(dllimport)
    +#        define ZEXTERN extern
     #      endif
     #    endif
     #  endif  /* ZLIB_DLL */
    @@ -306,11 +306,11 @@
     #if defined (__BEOS__)
     #  ifdef ZLIB_DLL
     #    ifdef ZLIB_INTERNAL
    -#      define ZEXPORT   __declspec(dllexport)
    -#      define ZEXPORTVA __declspec(dllexport)
    +#      define ZEXPORT   __attribute__((visibility ("default")))
    +#      define ZEXPORTVA __attribute__((visibility ("default")))
     #    else
    -#      define ZEXPORT   __declspec(dllimport)
    -#      define ZEXPORTVA __declspec(dllimport)
    +#      define ZEXPORT
    +#      define ZEXPORTVA
     #    endif
     #  endif
     #endif
    --- thirdparty/liblcms2/include/lcms2.h.orig	2016-03-26 00:00:04 +0800
    +++ thirdparty/liblcms2/include/lcms2.h	2016-03-25 23:59:52 +0800
    @@ -195,14 +195,14 @@
     #ifdef CMS_IS_WINDOWS_
     #  if defined(CMS_DLL) || defined(CMS_DLL_BUILD)
     #     ifdef __BORLANDC__
    -#        define CMSEXPORT    __stdcall _export
    +#        define CMSEXPORT    __attribute__((visibility ("default")))
     #        define CMSAPI
     #     else
     #        define CMSEXPORT    _stdcall
     #        ifdef CMS_DLL_BUILD
    -#            define CMSAPI   __declspec(dllexport)
    +#            define CMSAPI   __attribute__((visibility ("default")))
     #        else
    -#           define CMSAPI    __declspec(dllimport)
    +#           define CMSAPI
     #       endif
     #     endif
     #  else
    --- thirdparty/libpng/pngconf.h.orig	2014-04-29 20:58:10 +0800
    +++ thirdparty/libpng/pngconf.h	2016-03-25 11:15:20 +0800
    @@ -1315,9 +1315,9 @@
     
     #    ifndef PNG_IMPEXP
     #      ifdef PNG_BUILD_DLL
    -#        define PNG_IMPEXP __declspec(dllexport)
    +#        define PNG_IMPEXP __attribute__((visibility ("default")))
     #      else
    -#        define PNG_IMPEXP __declspec(dllimport)
    +#        define PNG_IMPEXP
     #      endif
     #    endif
     #  endif  /* PNG_IMPEXP */
    
  • 相关阅读:
    Asp.net2.0中的提供程序dashcommerce中的税率计算提供程序
    C#中的位操作
    一个很不错的日历控件
    统计商品留言信息,列出 已读,未读和总数
    Linq学习笔记
    TSQL 选择某一记录的前后相关记录
    XPath简明语法
    统计下载的周排行跟月排行
    二进制度序列化碰到的问题 切实认识Asp.net2.0页面编译机制
    Asp.net中Web.config 页面访问按角色授权配置
  • 原文地址:https://www.cnblogs.com/nlsoft/p/5322777.html
Copyright © 2011-2022 走看看