libtool和Windows DLL
我与GNU autotools有着艰难的关系,尤其是libtool.但是因为它们在可移植性和交叉编译方面起了作用,我开始再次使用它们.
不幸的是我无法使用libtool来构建正确的Windows DLL.然而,香草制造gcc 例如: LIBEXT = .dll pkzo$(LIBEXT): $(patsubst %.cpp,%.o,$(pkzo_SOURCES)) resources.o $(CXX) -shared -fPIC $(CXXFLAGS) $^ $(LDFLAGS) -Wl,--out-implib=libpkzo.lib -o $@ 将haily建立一个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配置libtool([shared static win32-dl??l]) 解决方法
对于第一个问题,请确保已安装SDL库的共享版本.
如果绝对必须将DLL链接到静态库,则可以通过编辑libtool脚本来欺骗libtool.例如,如果您希望所有依赖库与您的DLL静态链接,您可以通过[在configure.ac结尾处这样做: sed -i '/^whole_archive_flag_spec=/s/"$/ ${wl}-static"/' libtool 现在,这是一个严重的黑客,并依赖于libtool现在构建命令行的特定方式,因此不能保证它将继续工作—但它确实与libtool 2.4.2一起工作.由于您只有一个要静态链接的库,因此可以通过稍微应用sed来实现.可能你会想要的 sed -i '/^whole_archive_flag_spec=/s/"$/ ${wl}-static ${wl}-lSDL2main ${wl}-shared"/' libtool 为了保持与你拥有的任何其他共享库的共享链接,然后你需要将-lSDL2main从你拥有它的任何地方带走.这是懦弱的,但你想要做的事情也是懦弱的,libtool不是为此而做的. 对于第二个问题,将-no-undefined添加到libpkzo_la_LDFLAGS. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows-server-2003 – 备份Windows 2003 Serve
- windows-server-2008 – 如何追踪Windows Server
- Vulkan Tutorial 01 开发环境搭建之Windows
- Windows 10的快捷键归纳
- tidesdk自定义对话框
- Microsoft Dynamics CRM Online与Windows Azure托
- win7 windows server 2008R2下 https SSL证书安装
- 什么是将服务器添加到RDS的服务器池的PowerShell
- windows-server-2008 – 为什么Windows 2008在断
- windows-server-2008 – ADFS 2.0场 – 如何执行