libtool: undefined symbols not allowed in i686-pc-mingw32 shared

烈酒焚心 提交于 2020-01-22 15:16:12

问题


I'm using autotools as build system for a library of mine. Recently library is ported to Windows. Library compiles and links successfully though I encountered a strange error. There is only static libraries after configure and make. Evertything looks OK except a warning from libtool:

libtool: undefined symbols not allowed in i686-pc-mingw32 shared

I have exported all symbols for Windows machines by this code:

#ifdef _WIN32
#    ifdef DLL_EXPORT
#        define LIBRARY_API __declspec(dllexport)
#    else
#        define LIBRARY_API __declspec(dllimport)
#    endif
#endif
#ifndef _WIN32
#    define LIBRARY_API
#endif

And in every single definition I have:

class LIBRARY_API myClass {
// ...

Notes:
Operating System: Windows 8 x86_64
Compiler suite: MinGW x86_64, MSYS x86


回答1:


In your configure.ac, make sure your libtool initialization looks like:

LT_INIT([win32-dll])

Also, you need to pass -no-undefined flag to libtool in your Makefile.am. This flag disables the warning you are getting:

libexample_la_LDFLAGS = -no-undefined

More details about this in the LT_INIT documentation.



来源:https://stackoverflow.com/questions/17487891/libtool-undefined-symbols-not-allowedin-i686-pc-mingw32-shared

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!