【问题标题】:autotools -- make doesn't create dll under cygwinautotools -- make 不会在 cygwin 下创建 dll
【发布时间】:2014-10-01 22:56:19
【问题描述】:

我创建了一个使用自动工具构建的简单测试应用程序 + 库。问题是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

配置.ac:

AC_INIT(foobar, 1.0, me@mail.com)
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)

configure 表示将构建一个动态库:

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

【问题讨论】:

    标签: makefile cygwin autotools


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2011-10-06
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多