问题是关于以下库,预计它将尝试成为 boost 的一部分。
https://github.com/apolukhin/stacktrace
尝试使用此 makefile 进行编译:
CC = g++
CFLAGS = -c -O2 -Wall -std=c++1y -DHAVE_CSTDDEF -I ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND
LDFLAGS = -L ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND
SOURCES = $(shell find ./src -name '*.cpp')
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = main
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE) : $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ -pthread -lipopt
.cpp.o:
$(CC) $(CFLAGS) $< -o $@ -pthread -lipopt
这是输出:
g++ -c -O2 -Wall -std=c++1y -DHAVE_CSTDDEF -I ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND src/common.cpp -o src/common.o -pthread -lipopt
g++ -c -O2 -Wall -std=c++1y -DHAVE_CSTDDEF -I ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND src/impl/deterministic_algo.cpp -o src/impl/deterministic_algo.o -pthread -lipopt
g++ -c -O2 -Wall -std=c++1y -DHAVE_CSTDDEF -I ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND src/impl/magic_algo.cpp -o src/impl/magic_algo.o -pthread -lipopt
g++ -c -O2 -Wall -std=c++1y -DHAVE_CSTDDEF -I ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND src/main.cpp -o src/main.o -pthread -lipopt
g++ -L ./stacktrace/include -lunwind -DBOOST_STACKTRACE_USE_LIBUNWIND ./src/common.o ./src/impl/deterministic_algo.o ./src/impl/magic_algo.o ./src/estimator.o ./src/evaluator.o ./src/input/input_data.o ./src/input/input_links.o ./src/input/input_reader.o ./src/input/market_reader.o ./src/ialgorithm.o ./src/main.o -o main -pthread -lipopt
./src/impl/magic_algo.o: In function `boost::stacktrace::stacktrace::stacktrace()':
magic_algo.cpp: (.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x4f): undefined reference to `_Ux86_64_getcontext'
magic_algo.cpp: (.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x91): undefined reference to `_ULx86_64_init_local'
magic_algo.cpp:(.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0xad): undefined reference to `_ULx86_64_step'
magic_algo.cpp:(.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0xc6): undefined reference to `_ULx86_64_init_local'
magic_algo.cpp:(.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x209): undefined reference to `_ULx86_64_step'
magic_algo.cpp:(.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x247): undefined reference to `_ULx86_64_get_proc_name'
magic_algo.cpp:(.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x2a2): undefined reference to `_ULx86_64_get_proc_info'
magic_algo.cpp: (.text._ZN5boost10stacktrace10stacktraceC2Ev[_ZN5boost10stacktrace10stacktraceC5Ev]+0x5c9): undefined reference to `_ULx86_64_get_proc_name'
collect2: error: ld returned 1 exit status
makefiles/opt-makefile:11: recipe for target 'main' failed