我有一个用C语言编写的库但没有使用stdc库,因为它在某些平台上不可用.
但是,我的libsmartrest.la中仍然存在stdc库依赖项,这使得依赖于此库的所有库都无法链接.
这是我的configure.ac和Makefile.am:
# Process this file with autoreconf to produce a configure script.
# See http://www.openismus.com/documents/linux/building_libraries/building_libraries for introduction.
AC_INIT([Cumulocity SmartREST C++ Library], [1.0.0], [support@cumulocity.com], [libsmartrest], [https://bitbucket.org/m2m/cumulocity-clients-c/])
# Must come before AM_INIT_AUTOMAKE.
AC_CONFIG_MACRO_DIR([m4])
# These are automake arguments, not compiler arguments.
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
AC_PROG_CXX
AM_PROG_AR([act-if-fail])
LT_INIT
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([strerror])
AC_FUNC_MALLOC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
dnl Print configuration summary
cat <<EOF
=====================
$PACKAGE_NAME (version $PACKAGE_VERSION) is now configured.
You can now build, test and install $PACKAGE_NAME using the Makefile, by calling
\$make
\$make check # Optional
\$make install
EOF
Makefile.am:
ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libsmartrest.la
libsmartrest_la_SOURCES = \
src/Aggregator.cpp\
src/CharValue.cpp\
src/FloatValue.cpp\
src/IntegerValue.cpp\
src/NullValue.cpp\
src/Parser.cpp\
src/ParsedRecord.cpp\
src/ParsedValue.cpp\
src/SmartRest.cpp\
src/Record.cpp\
src/ComposedRecord.cpp\
src/StaticData.cpp
libsmartrest_la_CXXFLAGS = -fPIC -Wall -Wextra -Wno-deprecated
libsmartrest_la_LDFLAGS = -version-info 1:0:0
libsmartrest_hdir = $(includedir)/smartrest
libsmartrest_h_HEADERS = \
src/AbstractClient.h\
src/AbstractDataSink.h\
src/AbstractDataSource.h\
src/Aggregator.h\
src/CharValue.h\
src/DataGenerator.h\
src/FloatValue.h\
src/IntegerValue.h\
src/NullValue.h\
src/Parser.h\
src/ParsedRecord.h\
src/ParsedValue.h\
src/SmartRest.h\
src/Record.h\
src/ComposedRecord.h\
src/StaticData.h\
src/Value.h
EXTRA_DIST = README \
LICENSE
TESTS = $(check_PROGRAMS)
check_PROGRAMS = values parser client
values_SOURCES = \
test/values/mainvalues.cpp\
test/mock/BufferedDataSink.cpp\
test/values/CharValueTest.cpp\
test/values/ParsedValueTest.cpp\
test/values/AggregatorTest.cpp\
test/values/IntegerValueTest.cpp\
test/values/FloatValueTest.cpp\
test/values/ComposedRecordTest.cpp
values_CXXFLAGS = -Wall -Wextra -I$(srcdir)/src
values_LDADD = -lsmartrest
parser_SOURCES = \
test/parser/mainparser.cpp\
test/mock/BufferedDataSource.cpp\
test/parser/ParserTest.cpp
parser_CXXFLAGS = -Wall -Wextra -I$(srcdir)/src
parser_LDADD = -lsmartrest
client_SOURCES = \
test/client/mainclient.cpp\
test/client/SmartRestTest.cpp\
test/mock/BufferedDataSource.cpp\
test/mock/BufferedDataSink.cpp\
test/mock/MockClient.cpp\
test/mock/MockSmartRest.cpp
client_CXXFLAGS = -Wall -Wextra -I$(srcdir)/src
client_LDADD = -lsmartrest
我的桌面系统上的编译进展顺利.但是,我在我的.la文件中得到了这个:
dependency_libs=' -L/home/ec2-user/SDK_Bovine_ntc_6200/libstage/lib /home/mattf/src/buildbot/sandbox/slave/release_ntc_6200/build/Bovine_src/staging_sdk/SDK_Bovine_ntc_6200/compiler/arm-cdcs-linux-gnueabi/lib/libstdc++.la'
谁能告诉我如何删除这种依赖?
最佳答案 您可能正在使用基于RTTI的C功能,例如exception或typeof / dynmaic_cast.您可以尝试使用-fno-rtti -fno-exceptions进行构建.这应该删除依赖项或显示您实际拥有它的位置.
如果这没有用,并且您使用的是GCC 4.5或更高版本,请尝试使用-static-libstdc进行编译.