【发布时间】:2013-12-07 05:56:49
【问题描述】:
我与 GNU 自动工具,尤其是 libtool 的关系很不好。但是因为它们在可移植性和交叉编译方面表现出色,所以我再次开始使用它们。
不幸的是,我无法让 libtool 构建正确的 Windows DLL。然而用香草制作 gcc 会很乐意为我构建 DLL。
例如:
LIBEXT = .dll
pkzo$(LIBEXT): $(patsubst %.cpp, %.o, $(pkzo_SOURCES)) resources.o
$(CXX) -shared -fPIC $(CXXFLAGS) $^ $(LDFLAGS) -Wl,--out-implib=libpkzo.lib -o $@
将愉快地构建一个 DLL 和导入库。 (即使没有任何恼人的 decelspec)。
如果我像这样使用 libtool:
lib_LTLIBRARIES = libpkzo.la
libpkzo_la_CXXFALGS = ...
libpkzo_la_LDADD = ...
libpkzo_la_SOURCES = ...
Libtool 来抱怨:
*** Warning: linker path does not have real file for library -lSDL2main.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libSDL2main and none of the candidates passed a file format test
*** using a file magic. Last file checked: /usr/local/lib/libSDL2main.a
*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.
猜猜 libSDL2main.a 是一个静态库并且没有 DLL。
有没有办法用 automake 构建一个 DLL,而不是使用 libtool 或告诉 libtool 不要再无所事事?
PS:在任何人提到它之前,我正在使用LT_INIT([shared static win32-dll])配置libtool
【问题讨论】:
-
我在尝试在 Fedora 上交叉编译 Quake 克隆时遇到了同样的问题。赞成的答案是否低于您确定的解决方案?
-
所以..有趣的故事。在为这个问题头疼了几个小时之后,我刚刚删除了从源代码构建 SDL、SDL_image 和 SDL_ttf 安装的愚蠢的 libSDL*.la libtool turds。突然之间,一切都愉快地重新连接起来。谢谢,libtool。真的。干得好。
标签: windows dll mingw32 libtool