- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将预建静态库中的符号包含到我正在构建的静态库中。然后在可执行文件中使用我正在构建的静态库。我遇到的问题是我在我的静态库中从另一个静态库中获取了 undefined symbol 。这意味着我需要从预先构建的静态库中获取的符号没有包含在我的静态库中。
使用自动工具执行此操作的正确方法是什么?我知道我需要取消存档预构建并将这些 .o 文件包含在我的存档中。我只是不知道如何使用 automake 来做到这一点。
下面是我的 makefile.am,我目前遇到的相关构建错误。
lib_LTLIBRARIES = lib_xml_wrapper.la
# List your sources
lib_xml_wrapper_la_SOURCES = \
xml_system.cpp
lib_xml_wrapper_la_LDFLAGS = -static -l$(WRAPPER_LDFLAGS)
lib_xml_wrapper_la_CXXFLAGS = -DXERCES_STATIC_LIBRARY
lib_xml_wrapper_la_CPPFLAGS = -I../.. $(WRAPPER_CPPFLAGS)
-I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include -DXERCES_STATIC_LIBRARY
and
-static -l../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/lib/libxerces-c.a
make all-recursive
make[1]: Entering directory `/home/mehoggan/Devel/RuleSimulator/src/xml'
Making all in xml_wrapper
make[2]: Entering directory `/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper'
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -I../.. -DLINUX -DAMD64 -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include -DXERCES_STATIC_LIBRARY -g -O2 -MT lib_xml_wrapper_la-xml_system.lo -MD -MP -MF .deps/lib_xml_wrapper_la-xml_system.Tpo -c -o lib_xml_wrapper_la-xml_system.lo `test -f 'xml_system.cpp' || echo './'`xml_system.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I../.. -DLINUX -DAMD64 -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include -DXERCES_STATIC_LIBRARY -g -O2 -MT lib_xml_wrapper_la-xml_system.lo -MD -MP -MF .deps/lib_xml_wrapper_la-xml_system.Tpo -c xml_system.cpp -fPIC -DPIC -o .libs/lib_xml_wrapper_la-xml_system.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -I../.. -DLINUX -DAMD64 -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include -DXERCES_STATIC_LIBRARY -g -O2 -MT lib_xml_wrapper_la-xml_system.lo -MD -MP -MF .deps/lib_xml_wrapper_la-xml_system.Tpo -c xml_system.cpp -o lib_xml_wrapper_la-xml_system.o >/dev/null 2>&1
mv -f .deps/lib_xml_wrapper_la-xml_system.Tpo .deps/lib_xml_wrapper_la-xml_system.Plo
/bin/sh ../libtool --tag=CXX --mode=link g++ -DXERCES_STATIC_LIBRARY -g -O2 -static -l../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/lib/libxerces-c.a -o lib_xml_wrapper.la -rpath /usr/local/lib lib_xml_wrapper_la-xml_system.lo
libtool: link: ar cru .libs/lib_xml_wrapper.a lib_xml_wrapper_la-xml_system.o
libtool: link: ranlib .libs/lib_xml_wrapper.a
libtool: link: ( cd ".libs" && rm -f "lib_xml_wrapper.la" && ln -s "../lib_xml_wrapper.la" "lib_xml_wrapper.la" )
make[2]: Leaving directory `/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper'
Making all in xml_wrapper_tester
make[2]: Entering directory `/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester'
g++ -DHAVE_CONFIG_H -I. -I.. -DLINUX -DAMD64 -I../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include -I../xml_wrapper -I../../../tools/unit_tests/cxxtest-4.2.1/ -I../.. -g -O2 -MT xml_wrapper_tester-runner.o -MD -MP -MF .deps/xml_wrapper_tester-runner.Tpo -c -o xml_wrapper_tester-runner.o `test -f 'runner.cpp' || echo './'`runner.cpp
mv -f .deps/xml_wrapper_tester-runner.Tpo .deps/xml_wrapper_tester-runner.Po
/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -o xml_wrapper_tester xml_wrapper_tester-runner.o ../xml_wrapper/.libs/lib_xml_wrapper.a
libtool: link: g++ -g -O2 -o xml_wrapper_tester xml_wrapper_tester-runner.o ../xml_wrapper/.libs/lib_xml_wrapper.a
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
xml_wrapper_tester-runner.o: In function `xercesc_3_1::XMLAttDefList::~XMLAttDefList()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/framework/XMLAttDefList.hpp:158: undefined reference to `xercesc_3_1::XMemory::operator delete(void*)'
xml_wrapper_tester-runner.o: In function `xercesc_3_1::HandlerBase::fatalError(xercesc_3_1::SAXParseException const&)':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/sax/HandlerBase.hpp:398: undefined reference to `xercesc_3_1::SAXParseException::SAXParseException(xercesc_3_1::SAXParseException const&)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/sax/HandlerBase.hpp:398: undefined reference to `xercesc_3_1::SAXParseException::~SAXParseException()'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/sax/HandlerBase.hpp:398: undefined reference to `typeinfo for xercesc_3_1::SAXParseException'
xml_wrapper_tester-runner.o: In function `xercesc_3_1::DTDEntityDecl::~DTDEntityDecl()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/validators/DTD/DTDEntityDecl.hpp:160: undefined reference to `xercesc_3_1::XMLEntityDecl::~XMLEntityDecl()'
xml_wrapper_tester-runner.o: In function `~DTDEntityDecl':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/validators/DTD/DTDEntityDecl.hpp:160: undefined reference to `xercesc_3_1::XMLEntityDecl::~XMLEntityDecl()'
xml_wrapper_tester-runner.o: In function `xercesc_3_1::DTDEntityDecl::~DTDEntityDecl()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper_tester/../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/include/xercesc/validators/DTD/DTDEntityDecl.hpp:162: undefined reference to `xercesc_3_1::XMemory::operator delete(void*)'
xml_wrapper_tester-runner.o:(.rodata._ZTIN11xercesc_3_113DTDEntityDeclE[_ZTIN11xercesc_3_113DTDEntityDeclE]+0x10): undefined reference to `typeinfo for xercesc_3_1::XMLEntityDecl'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113XMLAttDefListE[_ZTVN11xercesc_3_113XMLAttDefListE]+0x20): undefined reference to `xercesc_3_1::XMLAttDefList::isSerializable() const'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113XMLAttDefListE[_ZTVN11xercesc_3_113XMLAttDefListE]+0x28): undefined reference to `xercesc_3_1::XMLAttDefList::serialize(xercesc_3_1::XSerializeEngine&)'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113XMLAttDefListE[_ZTVN11xercesc_3_113XMLAttDefListE]+0x30): undefined reference to `xercesc_3_1::XMLAttDefList::getProtoType() const'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113DTDEntityDeclE[_ZTVN11xercesc_3_113DTDEntityDeclE]+0x20): undefined reference to `xercesc_3_1::DTDEntityDecl::isSerializable() const'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113DTDEntityDeclE[_ZTVN11xercesc_3_113DTDEntityDeclE]+0x28): undefined reference to `xercesc_3_1::DTDEntityDecl::serialize(xercesc_3_1::XSerializeEngine&)'
xml_wrapper_tester-runner.o:(.rodata._ZTVN11xercesc_3_113DTDEntityDeclE[_ZTVN11xercesc_3_113DTDEntityDeclE]+0x30): undefined reference to `xercesc_3_1::DTDEntityDecl::getProtoType() const'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::startElement(unsigned short const*, xercesc_3_1::AttributeList&)':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:130: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:130: undefined reference to `xercesc_3_1::XMLString::transcode(unsigned short const*, xercesc_3_1::MemoryManager*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:132: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:132: undefined reference to `xercesc_3_1::XMLString::release(char**, xercesc_3_1::MemoryManager*)'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::fatalError(xercesc_3_1::SAXParseException const&)':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:139: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:139: undefined reference to `xercesc_3_1::XMLString::transcode(unsigned short const*, xercesc_3_1::MemoryManager*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:141: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:141: undefined reference to `xercesc_3_1::XMLString::release(char**, xercesc_3_1::MemoryManager*)'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::deinitialize()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:40: undefined reference to `xercesc_3_1::XMLPlatformUtils::Terminate()'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:42: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:42: undefined reference to `xercesc_3_1::XMLString::transcode(unsigned short const*, xercesc_3_1::MemoryManager*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:43: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:43: undefined reference to `xercesc_3_1::XMLString::release(char**, xercesc_3_1::MemoryManager*)'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::parse_and_validate(std::string const&, std::string const&)':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:61: undefined reference to `xercesc_3_1::XercesDOMParser::resetCachedGrammarPool()'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:83: undefined reference to `xercesc_3_1::AbstractDOMParser::parse(char const*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:70: undefined reference to `xercesc_3_1::XercesDOMParser::loadGrammar(char const*, xercesc_3_1::Grammar::GrammarType, bool)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:86: undefined reference to `xercesc_3_1::AbstractDOMParser::getDocument()'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::xml_system()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:27: undefined reference to `xercesc_3_1::XMLPlatformUtils::fgMemoryManager'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:27: undefined reference to `xercesc_3_1::XercesDOMParser::XercesDOMParser(xercesc_3_1::XMLValidator*, xercesc_3_1::MemoryManager*, xercesc_3_1::XMLGrammarPool*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:29: undefined reference to `xercesc_3_1::AbstractDOMParser::setDoNamespaces(bool)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:30: undefined reference to `xercesc_3_1::AbstractDOMParser::setDoSchema(bool)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:32: undefined reference to `xercesc_3_1::XercesDOMParser::cacheGrammarFromParse(bool)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:33: undefined reference to `xercesc_3_1::XercesDOMParser::setErrorHandler(xercesc_3_1::ErrorHandler*)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:34: undefined reference to `xercesc_3_1::AbstractDOMParser::setValidationScheme(xercesc_3_1::AbstractDOMParser::ValSchemes)'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:27: undefined reference to `xercesc_3_1::XercesDOMParser::~XercesDOMParser()'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::initialize()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:11: undefined reference to `xercesc_3_1::XMLUni::fgXercescDefaultLocale'
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:11: undefined reference to `xercesc_3_1::XMLPlatformUtils::Initialize(char const*, char const*, xercesc_3_1::PanicHandler*, xercesc_3_1::MemoryManager*)'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o): In function `rule_builder::xml_system::~xml_system()':
/home/mehoggan/Devel/RuleSimulator/src/xml/xml_wrapper/xml_system.cpp:47: undefined reference to `xercesc_3_1::XercesDOMParser::~XercesDOMParser()'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o):(.gcc_except_table+0x1c): undefined reference to `typeinfo for xercesc_3_1::XMLException'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o):(.gcc_except_table+0xdc): undefined reference to `typeinfo for xercesc_3_1::XMLException'
../xml_wrapper/.libs/lib_xml_wrapper.a(lib_xml_wrapper_la-xml_system.o):(.gcc_except_table+0x10c): undefined reference to `typeinfo for xercesc_3_1::XMLException'
collect2: error: ld returned 1 exit status
最佳答案
做这样的事情可能比使用 libtool
更容易因为你基本上
只需将一些目标文件添加到原始静态库中即可。在这个例子中,我假设 WRAPPER_LDFLAGS
是您想要添加对象的静态库(例如 ../../../external/xerces-c-3.1.1-x86_64-linux-gcc-3.4/lib/libxerces-c.a
):
lib_LIBRARIES = lib_xml_wrapper.a
# List your sources
lib_xml_wrapper_a_SOURCES = \
xml_system.cpp
lib_xml_wrapper_a_CXXFLAGS = -DXERCES_STATIC_LIBRARY
lib_xml_wrapper_a_CPPFLAGS = -I../.. $(WRAPPER_CPPFLAGS)
lib_xml_wrapper.a: $(lib_xml_wrapper_a_OBJECTS) $(WRAPPER_LDFLAGS)
-rm -f $@
cp $(WRAPPER_LDFLAGS) $@
$(AR) r $@ $(lib_xml_wrapper_a_OBJECTS)
$(RANLIB) $@
关于static-libraries - Automake 将两个静态库合二为一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23420190/
以下语句不起作用: dist_include_DATA = someheaders.h 导致错误: Makefile.am:8: `includedir' is not a legitimate di
在我的 Makefile.am文件我有这样的东西: bin_PROGRAMS = foo bar foo_SOURCES = foo.cpp bar_SOURCES = bar.cpp 我有兴趣拥有
假设我有一个这样的项目: (dev dir) - README - INSTALL / src - blah.cpp - blah.hpp / conf - blah_one.xml
想象一下由 autoconf 生成的以下目标和命令: .c.lo: $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
我想在安装二进制文件之前使用 automake 处理/修改它们。例如,我想将二进制文件中的符号提取到单独的文件和位置(如 this )。另一个示例是收集关键 Assets 的 md5sum 以发布报告
我遇到了一个 automake 的问题,我似乎找不到一个干净的解决方案,这似乎应该是可能的(甚至是简单的),但没有简单的工作。 基本上,我遇到的问题是源文件包含自动生成的头文件。我可以添加依赖项来生成
此主题的大部分内容都在 pkginclude_HEADERS 上的此主题中进行了介绍。 我有一个开源库,它有一些包含通用名称的内容。我怀疑最好的解决方案是将我的伞形包含文件放在 pkginclude_
假设我开发了 libfoo.a 作为我编译过程的中间步骤。这是 Makefile.am 中的一行: noinst_LIBRARIES = libfoo.a 这个库依赖于其他库。为了防止我收到 unde
操作系统: Ubuntu 14.14 automake 版本:automake (GNU automake) 1.14.1 我使用 automake 构建源代码以创建共享库。 但是我得到一个错误,au
我在 Rapbian (2014-09-09-wheezy-raspbian) 发行版上安装 automake 1.14.1 时遇到问题。我写了 sh ./configure 然后我写了 make 然
我对 GNU Make 非常有经验,但对 autotools 完全陌生。通过查看一些教程,我了解到 autotools 是一种标准化 makefile 目标并跨多个体系结构构建的方法。这是一件好事,因
我的 Makefile.am包括一个文件(带有各种定义的变量),例如: include make.config ... 问题是该文件又是由工具(即 config.generator.sh )基于某些输
我正在尝试编译和构建 automake 1.16,但它以下列方式失败: help2man: can't get `--help' info from automake-1.16 Try `--no-d
我正在尝试在 CentOS5 上构建 glib-2.36.4。我意识到升级到 6 会更明智,但由于客户要求,这是不可能的。 我已经开始构建,但出现以下错误。该错误提示系统上不存在 automake-1
在我的Makefile.am中,我进行了以下测试: TESTS += tests/test1 check_PROGRAMS += tests/test1 tests_test1_SOURCES = t
我正在尝试在 automake 中执行此操作 platform=$(uname) ifeq ($(platform), Darwin) stmt = ... else stmt1 =
我正在尝试在 automake 中执行此操作 platform=$(uname) ifeq ($(platform), Darwin) stmt = ... else stmt1 =
如何告诉 Automake 构建一个不需要安装的动态模块? pkglib_LTLIBRARIES = mywrapper.la mywrapper_la_LDFLAGS = -no-undefined
我刚刚建立了一个 cross-helloworld automake 项目(用于 stm32f4-discovery)。我有一个自定义 discovery.ld 脚本。我在我的 Makefile.am
我知道我可以使用 install-data-hook在复制我的数据文件后做任何我想做的事情,这样我就可以按照我想要的方式调整文件权限。 不过,我的问题在它之前。 有什么办法可以告诉我automake在
我是一名优秀的程序员,十分优秀!