vendredi 28 novembre 2014

static link boost log failed when i used boost log


Vote count:

0




At first , I build boost with command: sudo ./bjam variant=release link=static threading=multi runtime-link=static -j4 install


I copy my Makefile to directory log example /home/fof606/work/boost_1_57_0/libs/log/example/trivial


The content of Makefile is



DEFS = '-DMSG="Hello world!\n"'
INCS =
LIBS = -lboost_log_setup \
-lboost_log \
-lboost_date_time \
-lboost_filesystem \
-lboost_system \
-lboost_thread

CFLAGS = $(DEFS) $(INCS) -O2 -Wall
CXXFLAGS = $(DEFS) $(INCS) -O2 -Wall
LDFLAGS = $(LIBS) -s

CFLAGS_DEBUG = $(DEFS) $(INCS) -g -Wall
CXXFLAGS_DEBUG = $(DEFS) $(INCS) -g -Wall
LDFLAGS_DEBUG = $(LIBS)

SRCS = $(wildcard *.c *.cc *.cpp *.cxx)
EXT = $(firstword $(suffix $(SRCS)))
OBJS = $(SRCS:$(EXT)=.o)
DEPS = $(SRCS:$(EXT)=.d)
BIN = main

PREFIX=/usr/local

ifeq ($(EXT), .c)
LANG = C
else
LANG = CXX
endif

.PHONY: all debug strip install uninstall clean

all: $(BIN)

debug: CFLAGS = $(CFLAGS_DEBUG)
debug: CXXFLAGS = $(CXXFLAGS_DEBUG)
debug: LDFLAGS = $(LDFLAGS_DEBUG)
debug: all

strip: all
strip $(BIN)

$(BIN): $(OBJS)
ifeq ($(LANG), C)
$(CC) $(LDFLAGS) -o $@ $^
else
$(CXX) $(LDFLAGS) -o $@ $^
endif

%.d: %$(EXT)
ifeq ($(LANG), C)
$(CC) -MM -MP -MT $(patsubst %.d,%.o,$@) -MT $@ $< >$@
else
$(CXX) -MM -MP -MT $(patsubst %.d,%.o,$@) -MT $@ $< >$@
endif

install: all
install $(BIN) $(DESTDIR)$(PREFIX)/bin

uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)

clean:
rm -f $(BIN) *.o *.d

-include $(DEPS)


Then i run make. link error shows(part of all error info):



main.cpp:(.text.startup+0x11ff): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x1206): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x124e): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x1294): undefined reference to `boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x129c): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x12ca): undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
main.cpp:(.text.startup+0x130f): undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
main.cpp:(.text.startup+0x131f): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x1326): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x136e): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x13b4): undefined reference to `boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x13bc): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x13ea): undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
main.cpp:(.text.startup+0x142f): undefined reference to `boost::log::v2s_mt_posix::trivial::logger::get()'
main.cpp:(.text.startup+0x143f): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::allocate_compound(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x1446): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x148e): undefined reference to `boost::log::v2s_mt_posix::aux::unhandled_exception_count()'
main.cpp:(.text.startup+0x14d4): undefined reference to `boost::log::v2s_mt_posix::core::push_record_move(boost::log::v2s_mt_posix::record&)'
main.cpp:(.text.startup+0x14dc): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x1dae): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x1de5): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x1e5a): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.cpp:(.text.startup+0x1ec5): undefined reference to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)'
main.o:main.cpp:(.text.startup+0x1f0d): more undefined references to `boost::log::v2s_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2s_mt_posix::aux::stream_provider<char>::stream_compound*)' follow


many thanks!



asked 35 secs ago







static link boost log failed when i used boost log

Aucun commentaire:

Enregistrer un commentaire