2014-10-01 24 views
1

我使用autotools創建了一個簡單的測試應用程序+庫。問題是make不會在Cygwin下生成動態庫(DLL等)。autotools - make不會在cygwin下創建dll

Makefile.am:

ACLOCAL_AMFLAGS = -I m4 
VERSION=0:0:0 
EXTRA_DIST = autogen.sh 
bin_PROGRAMS = testApp 
libtest_la_SOURCES = src/testLibrary.c 
libtest_la_LDFLAGS = -version-info ${VERSION} 
testApp_SOURCES = src/testApp.c 
testApp_LDADD = libtest.la 
lib_LTLIBRARIES = libtest.la 

configure.ac:

AC_INIT(foobar, 1.0, [email protected]) 
AC_CONFIG_AUX_DIR(config) 
AC_CONFIG_SRCDIR(src) 
AC_PROG_CC 
AM_PROG_CC_C_O 
LT_INIT 
AC_CONFIG_MACRO_DIR([m4]) 
AM_INIT_AUTOMAKE([subdir-objects]) 
AC_OUTPUT(Makefile) 

配置指示動態庫將建:

checking whether the gcc linker (/usr/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes 
checking whether -lc should be explicitly linked in... yes 
checking dynamic linker characteristics... Win32 ld.exe 
checking how to hardcode library paths into programs... immediate 
checking whether stripping libraries is possible... yes 
checking if libtool supports shared libraries... yes 
checking whether to build shared libraries... yes 
checking whether to build static libraries... yes 
checking that generated files are newer than configure... done 

但沒有動態庫建立在:

$ ls .libs 
libtest.a libtest.la libtest.lai lt-testApp.c testApp.exe testApp_ltshwrapper 

回答

1

在Makefile.am,libtest_la_LDFLAGS缺少-no-undefined

libtest_la_LDFLAGS = -version-info ${VERSION} -no-undefined 
+0

謝謝,這做到了。 – 2014-10-04 01:32:22