我正在尝试编译Bavieca(现在已经几周了),同时习惯于在Linux中编译,学习静态和动态库等,所以我对这个领域有点新意。 Bavieca依赖于BLAS / LAPACK库。在尝试依赖库之后,我正在使用atlas各自的库。
我可以成功编译分发的前两部分(api& common),但编译在第三部分(工具)失败。
生成文件:
include ../Makefile.defines
INC = -I./algebra -I./alignment -I./audio -I./base -I./decoding -I./dynamicdecoder -I./estimation -I./config -I./hmm \
-I./io -I./other -I./param -I./text -I./transform -I./wfsadecoder ${INCS_DIR_CBLAS} ${INCS_DIR_LAPACK}
SRC_DIR = ../common
OBJ_DIR = ../../obj/$(ARCH)-$(OS)/common
LIB_DIR = ../../lib/$(ARCH)-$(OS)
OBJFILES_BASE = $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(patsubst %.cpp,%.o,$(wildcard $(SRC_DIR)/*/*.cpp)))
static: CPPFLAGS_ = $(CPPFLAGS)
pic: CPPFLAGS_ = $(CPPFLAGS_SHARED)
# targets (pic stands for position independent code)
static: createDirectories libcommon.a
pic: createDirectories libcommon_pic.a
clean:
rm -rf $(OBJ_DIR)
rm -rf $(LIB_DIR)/libcommon.a
rm -rf $(LIB_DIR)/libcommon_pic.a
createDirectories:
(mkdir -p $(LIB_DIR))
(mkdir -p $(OBJ_DIR)/algebra)
(mkdir -p $(OBJ_DIR)/alignment)
(mkdir -p $(OBJ_DIR)/audio)
(mkdir -p $(OBJ_DIR)/base)
(mkdir -p $(OBJ_DIR)/config)
(mkdir -p $(OBJ_DIR)/decoding)
(mkdir -p $(OBJ_DIR)/dynamicdecoder)
(mkdir -p $(OBJ_DIR)/estimation)
(mkdir -p $(OBJ_DIR)/hmm)
(mkdir -p $(OBJ_DIR)/io)
(mkdir -p $(OBJ_DIR)/other)
(mkdir -p $(OBJ_DIR)/param)
(mkdir -p $(OBJ_DIR)/sadmodule)
(mkdir -p $(OBJ_DIR)/text)
(mkdir -p $(OBJ_DIR)/transform)
(mkdir -p $(OBJ_DIR)/vtlestimator)
(mkdir -p $(OBJ_DIR)/wfsabuilder)
(mkdir -p $(OBJ_DIR)/wfsadecoder)
# ----------------------------------------------
# create the static library
#-----------------------------------------------
libcommon.a: $(OBJFILES_BASE)
$(AR) $@ $?
(mv libcommon.a $(LIB_DIR))
rm -rf $(OBJ_DIR)
libcommon_pic.a: $(OBJFILES_BASE)
$(AR) $@ $?
(mv libcommon_pic.a $(LIB_DIR))
rm -rf $(OBJ_DIR)
# ----------------------------------------------
# create the object files from the source files
# ----------------------------------------------
$(OBJ_DIR)/algebra/%.o: $(SRC_DIR)/algebra/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/alignment/%.o: $(SRC_DIR)/alignment/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/audio/%.o: $(SRC_DIR)/audio/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/base/%.o: $(SRC_DIR)/base/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/config/%.o: $(SRC_DIR)/config/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/decoding/%.o: $(SRC_DIR)/decoding/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/dynamicdecoder/%.o: $(SRC_DIR)/dynamicdecoder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/estimation/%.o: $(SRC_DIR)/estimation/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/hmm/%.o: $(SRC_DIR)/hmm/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/io/%.o: $(SRC_DIR)/io/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/other/%.o: $(SRC_DIR)/other/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/param/%.o: $(SRC_DIR)/param/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/sadmodule/%.o: $(SRC_DIR)/sadmodule/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/text/%.o: $(SRC_DIR)/text/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/transform/%.o: $(SRC_DIR)/transform/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/vtlestimator/%.o: $(SRC_DIR)/vtlestimator/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/wfsabuilder/%.o: $(SRC_DIR)/wfsabuilder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
$(OBJ_DIR)/wfsadecoder/%.o: $(SRC_DIR)/wfsadecoder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $@
Makefile.defines:
# ---------------------------------------
# Arch and Operating System settings
# ---------------------------------------
MAKE = make --quiet -w
ARCH := $(shell uname -m | sed s/' '//g)
OS := $(shell uname -s)
# ---------------------------------------
# Linux compile options
# ---------------------------------------
XCC = gcc
# SIMD flags (vector based arithmetic operations)
#SIMD_FLAGS =
# SSE is enabled by default on gcc-4.0 and higher. If SSE is enabled, the C preprocessor symbol __SSE__ is defined
SIMD_FLAGS = -msse3
# AVX is available on Sandy Bridge and later Intel and AMD architectures. If AVX is enabled the C preprocessor symbol __AVX__ is defined
#SIMD_FLAGS = -march=corei7-avx
#CPPFLAGS = -g -Wno-deprecated -Wall -O2 -finline-functions $(SIMD_FLAGS)
CPPFLAGS = -g -Wno-deprecated -O2 -finline-functions $(SIMD_FLAGS)
# -fPIC generates Position Independent Code, which is needed to build shared libraries
# so they can be dynamically relocated, however it may slowdown the code, for this reason
# it should be avoided for object files that build executables or static libraries
CPPFLAGS_SHARED = $(CPPFLAGS) -fPIC
AR = ar rs
# ---------------------------------------
# CBLAS and LAPACK includes/libraries
# ---------------------------------------
BASE = /usr
INCS_DIR_CBLAS = -I$(BASE)/include/atlas
INCS_DIR_LAPACK = -I$(BASE)/include/atlas
LIBS_DIR_CBLAS = -L$(BASE)/lib/atlas-base
LIBS_DIR_LAPACK = -L$(BASE)/lib/atlas-base/atlas
LIB_CBLAS = -lcblas -lblas -lgfortran -lf2c
LIB_LAPACK = -llapack
# ----------------------------------------------------
# Java JNI (Java Native Interface) includes/libraries
# ----------------------------------------------------
JAVA_BASE = /usr/lib/jvm/java-1.7.0-openjdk-amd64
INCS_DIR_JNI = -I$(JAVA_BASE)/include -I$(JAVA_BASE)/include/linux
输出如下:
(mkdir -p ../../obj/x86_64-Linux/tools)
(mkdir -p ../../bin/x86_64-Linux)
gcc -g -Wno-deprecated -O2 -finline-functions -msse3 -L../../lib/x86_64-Linux/ -L/usr/lib/atlas-base -L/usr/lib/atlas-base/atlas -o ../../bin/x86_64-Linux/aligner ../../obj/x86_64-Linux/tools/mainAligner.o -lcommon -llapack -lcblas -lblas -lgfortran -lf2c
/usr/bin/ld: ../../lib/x86_64-Linux//libcommon.a(HMMStateDecoding.o): undefined reference to symbol 'exp@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [aligner] Error 1
现在,我用谷歌搜索并发现我需要将-lm附加到链接器阶段。我做了什么,导致多个未定义的引用。在这种情况下,这是输出的一小部分:
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `ParameterValue':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/./config/ParameterManager.h:92: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/./config/ParameterManager.h:92: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator++()':
/usr/include/c++/4.8/bits/stl_tree.h:189: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `_Alloc_hider':
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::operator=(std::string const&)':
/usr/include/c++/4.8/bits/basic_string.h:547: undefined reference to `std::string::assign(std::string const&)'
/usr/include/c++/4.8/bits/basic_string.h:547: undefined reference to `std::string::assign(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `__gnu_cxx::new_allocator<Bavieca::ParameterValue>::deallocate(Bavieca::ParameterValue*, unsigned long)':
/usr/include/c++/4.8/ext/new_allocator.h:110: undefined reference to `operator delete(void*)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_get_exception_ptr'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `vtable for std::runtime_error'
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_begin_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:111: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_end_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_end_catch'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::exception::~exception()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::terminate()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `~basic_string':
/usr/include/c++/4.8/bits/basic_string.h:539: undefined reference to `std::string::_Rep::_M_dispose(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o):(.gcc_except_table+0xe4): undefined reference to `typeinfo for std::runtime_error'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o):(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:48: undefined reference to `operator new[](unsigned long)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_get_exception_ptr'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `vtable for std::runtime_error'
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_begin_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:54: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:54: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_end_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_end_catch'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::exception::~exception()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::terminate()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o):(.gcc_except_table+0x48): undefined reference to `typeinfo for std::runtime_error'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o):(.eh_frame+0x53): undefined reference to `__gxx_personality_v0'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:456: undefined reference to `std::ios_base::ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ostream':
/usr/include/c++/4.8/ostream:385: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:456: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ostream':
/usr/include/c++/4.8/ostream:385: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:385: undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ofstream':
/usr/include/c++/4.8/fstream:625: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:625: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:625: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf()'
/usr/include/c++/4.8/fstream:626: undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `_Alloc_hider':
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::assign(char const*)':
/usr/include/c++/4.8/bits/basic_string.h:1131: undefined reference to `std::string::assign(char const*, unsigned long)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_string':
/usr/include/c++/4.8/bits/basic_string.h:539: undefined reference to `std::string::_Rep::_M_dispose(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `Bavieca::FileOutput::FileOutput(char const*, bool)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/io/FileOutput.cpp:26: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ofstream':
/usr/include/c++/4.8/fstream:625: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::~basic_filebuf()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ofstream':
/usr/include/c++/4.8/fstream:674: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:674: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_filebuf':
/usr/include/c++/4.8/fstream:220: undefined reference to `vtable for std::basic_filebuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:220: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::close()'
/usr/include/c++/4.8/fstream:220: undefined reference to `std::__basic_file<char>::~__basic_file()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_streambuf':
/usr/include/c++/4.8/streambuf:198: undefined reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/streambuf:198: undefined reference to `std::locale::~locale()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_streambuf':
/usr/include/c++/4.8/streambuf:198: undefined reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/streambuf:198: undefined reference to `std::locale::~locale()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_filebuf':
/usr/include/c++/4.8/fstream:220: undefined reference to `std::__basic_file<char>::~__basic_file()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ofstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)':
/usr/include/c++/4.8/fstream:716: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)'
/usr/include/c++/4.8/fstream:721: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_filebuf<char, std::char_traits<char> >::is_open() const':
/usr/include/c++/4.8/fstream:228: undefined reference to `std::__basic_file<char>::is_open() const'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `operator<< <std::char_traits<char> >':
/usr/include/c++/4.8/ostream:535: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/usr/include/c++/4.8/ostream:535: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate)':
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ofstream<char, std::char_traits<char> >::close()':
/usr/include/c++/4.8/fstream:755: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::close()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate)':
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o):(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
make: *** [param] Error 1
现在我处于死胡同。关于下一步做什么,我没有经验或知识。可能是libm运行不正常吗?本网站中类似问题的其他答案并不适用于我的案例。
修改 改变Makefile.defined&#34; gcc&#34; to&#34; g ++&#34;导致以下输出错误:对cblas_sgemm的未定义引用(CBLAS_ORDER,CBLAS_TRANSPOSE,CBLAS_TRANSPOSE,int,int,int,float,float const *,int,float const *,int,float,float *,int)collect2:error:ld返回1退出状态make:*** [param]错误1
似乎无法找到cblas库,即使我已经链接了include和lib目录。
答案 0 :(得分:1)
这看起来像一个非常糟糕的makefile ......你正在用C编译器(std::string
)编译一个C ++库(因为它需要gcc
)。它不能工作。请尝试在gcc
中将g++
替换为Makefile.defines
,并在任何情况下向图书馆的开发人员报告您的不良体验。