2

我正在尝试让我的 HTML Tidy c++ 包装器库在 linux 上构建(目前在 Ubuntu 上测试),但 make 失败并出现 libtool 错误:“libtool: link: you must specify an output file”

这是我的 Makefile.am:

## tidypp:
## A c++ wrapper around HTML Tidy Lib

AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4

lib_LTLIBRARIES = libtidypp-@TIDYPP_API_VERSION@.la

libtidypp_@TIDYPP_API_VERSION@_la_CPPFLAGS = $(DEPS_CFLAGS)
libtidypp_@TIDYPP_API_VERSION@_la_LIBADD = -ltidy $(DEPS_LIBS)

libtidypp_@TIDYPP_API_VERSION@_la_SOURCES = src/attribute.cpp src/buffer.cpp \
    src/document.cpp src/inputsource.cpp src/mem.cpp src/node.cpp src/option.cpp \
    src/outputsink.cpp src/tidypp.cpp include/tidypp/attribute.hpp \
    include/tidypp/basic_wrapper.hpp include/tidypp/buffer.hpp \
    include/tidypp/document.hpp include/tidypp/inputsource.hpp \
    include/tidypp/io.hpp include/tidypp/mem.hpp include/tidypp/node.hpp \
    include/tidypp/option.hpp include/tidypp/outputsink.hpp include/tidypp/tidypp.hpp

libtidypp_@TIDYPP_API_VERSION@_la_LDFLAGS = -version-info $(tidypp_SO_VERSION)

tidypp_includedir=$(includedir)/tidypp-@TIDYPP_API_VERSION@/tidypp
tidypp_include_HEADERS = include/tidypp/attribute.hpp \
    include/tidypp/basic_wrapper.hpp include/tidypp/buffer.hpp \
    include/tidypp/document.hpp include/tidypp/inputsource.hpp \
    include/tidypp/io.hpp include/tidypp/mem.hpp include/tidypp/node.hpp \
    include/tidypp/option.hpp include/tidypp/outputsink.hpp include/tidypp/tidypp.hpp

tidypp_libincludedir = $(libdir)/tidypp-$(TIDYPP_API_VERSION)/include
nodist_tidypp_libinclude_HEADERS = tidyppconfig.h

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = tidypp-$(TIDYPP_API_VERSION).pc

dist_noinst_SCRIPTS = autogen.sh

和我的configure.ac:

## libtidypp:
## a c++ wrapper around html tidy lib

AC_INIT([libtidypp], [1.0], [francesco1149@gmail.com], [tidypp],
        [http://code.google.com/p/tidypp/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.10 -Wall no-define])

AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h tidyppconfig.h])
AC_PROG_CXX
LT_INIT([disable-static])

AC_SUBST([TIDYPP_SO_VERSION], [0:0:0])
AC_SUBST([TIDYPP_API_VERSION], [1.0])

AC_CONFIG_FILES([Makefile
                 tidypp-${TIDYPP_API_VERSION}.pc:tidypp.pc.in])
AC_OUTPUT

这是make的输出:

make  all-am

make[1]: Entering directory `/home/francesco/tidypp'

depbase=`echo src/attribute.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/attribute.lo -MD -MP -MF $depbase.Tpo -c -o src/attribute.lo src/attribute.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/attribute.lo -MD -MP -MF src/.deps/attribute.Tpo -c src/attribute.cpp  -fPIC -DPIC -o src/.libs/attribute.o

depbase=`echo src/buffer.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/buffer.lo -MD -MP -MF $depbase.Tpo -c -o src/buffer.lo src/buffer.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/buffer.lo -MD -MP -MF src/.deps/buffer.Tpo -c src/buffer.cpp  -fPIC -DPIC -o src/.libs/buffer.o

depbase=`echo src/document.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/document.lo -MD -MP -MF $depbase.Tpo -c -o src/document.lo src/document.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/document.lo -MD -MP -MF src/.deps/document.Tpo -c src/document.cpp  -fPIC -DPIC -o src/.libs/document.o

depbase=`echo src/inputsource.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/inputsource.lo -MD -MP -MF $depbase.Tpo -c -o src/inputsource.lo src/inputsource.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/inputsource.lo -MD -MP -MF src/.deps/inputsource.Tpo -c src/inputsource.cpp  -fPIC -DPIC -o src/.libs/inputsource.o

depbase=`echo src/mem.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/mem.lo -MD -MP -MF $depbase.Tpo -c -o src/mem.lo src/mem.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/mem.lo -MD -MP -MF src/.deps/mem.Tpo -c src/mem.cpp  -fPIC -DPIC -o src/.libs/mem.o

depbase=`echo src/node.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/node.lo -MD -MP -MF $depbase.Tpo -c -o src/node.lo src/node.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/node.lo -MD -MP -MF src/.deps/node.Tpo -c src/node.cpp  -fPIC -DPIC -o src/.libs/node.o

depbase=`echo src/option.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/option.lo -MD -MP -MF $depbase.Tpo -c -o src/option.lo src/option.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/option.lo -MD -MP -MF src/.deps/option.Tpo -c src/option.cpp  -fPIC -DPIC -o src/.libs/option.o

depbase=`echo src/outputsink.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/outputsink.lo -MD -MP -MF $depbase.Tpo -c -o src/outputsink.lo src/outputsink.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/outputsink.lo -MD -MP -MF src/.deps/outputsink.Tpo -c src/outputsink.cpp  -fPIC -DPIC -o src/.libs/outputsink.o

depbase=`echo src/tidypp.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
    /bin/bash ./libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I.     -g -O2 -MT src/tidypp.lo -MD -MP -MF $depbase.Tpo -c -o src/tidypp.lo src/tidypp.cpp &&\
    mv -f $depbase.Tpo $depbase.Plo

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -g -O2 -MT src/tidypp.lo -MD -MP -MF src/.deps/tidypp.Tpo -c src/tidypp.cpp  -fPIC -DPIC -o src/.libs/tidypp.o

/bin/bash ./libtool --tag=CXX   --mode=link g++  -g -O2 -version-info   -o libtidypp-1.0.la -rpath /usr/local/lib src/attribute.lo src/buffer.lo src/document.lo src/inputsource.lo src/mem.lo src/node.lo src/option.lo src/outputsink.lo src/tidypp.lo  

libtool: link: you must specify an output file
libtool: link: Try `libtool --help --mode=link' for more information.
make[1]: *** [libtidypp-1.0.la] Error 1
make[1]: Leaving directory `/home/francesco/tidypp'
make: *** [all] Error 2

完整的项目和来源:http ://code.google.com/p/tidypp/

4

1 回答 1

6

您没有将参数传递给-version-info,因此libtool将 解释-o为该选项的必需参数。似乎错误在行

libtidypp_@TIDYPP_API_VERSION@_la_LDFLAGS = -version-info $(tidypp_SO_VERSION)

那应该是$(TIDYPP_SO_VERSION)。中的变量名make区分大小写。

于 2012-09-09T20:39:35.110 回答