我遇到与this thread类似的错误。我在Python中输入错误如下:
File" /home/cayman/multiviewer/src/analyzer/analyzer.py" ;,第23行, 在 from wrapped.libraries.IpMetrics import IpMetrics ImportError:/home/cayman/multiviewer/src/analyzer/wrapped/libraries/IpMetrics.so: 未定义的符号: Z15calcTimevalDiff7timevalS
以下是我的makefile
MODULE_NAME=IpMetrics
CPPFLAGS=-O2 -Wall -fPIC -c -std=c++11 -I../src
CC=g++-4.9
o_dir ?= "../../wrapped/"
lib_dir := $(o_dir)libraries/
PYTHON_VERSION = 2.7
PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION)
ifeq "$(wildcard $(/usr/lib/boost-gcc49) )" ""
BOOST_INC = /usr/lib/boost-gcc49/include
BOOST_LIB = /usr/lib/boost-gcc49/lib
else
BOOST_INC = /usr/include
BOOST_LIB = /usr/lib
endif
all:
$(eval obj_dir=$(o_dir)objects)
$(eval lib_dir=$(o_dir)libraries)
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketMetricsBase.o ../src/IpPacketMetricsBase.cpp
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketJitterDelayVariation.o ../src/IpPacketJitterDelayVariation.cpp
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketJitterCumulative.o ../src/IpPacketJitterCumulative.cpp
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketMetricsUtil.o ../src/IpPacketMetricsUtil.cpp
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketLossMetrics.o ../src/IpPacketLossMetrics.cpp
$(CC) $(CPPFLAGS) -o $(obj_dir)/IpPacketMetrics.o ../src/IpPacketMetrics.cpp
$(CC) $(CPPFLAGS) -I$(PYTHON_INCLUDE) -I$(BOOST_INC) -o $(obj_dir)/boost_$(MODULE_NAME).o boost_$(MODULE_NAME).cpp
$(CC) -shared -Wl,--export-dynamic \
$(obj_dir)/boost_$(MODULE_NAME).o \
$(obj_dir)/IpPacketMetricsBase.o \
$(obj_dir)/IpPacketJitterDelayVariation.o \
$(obj_dir)/IpPacketJitterCumulative.o \
$(obj_dir)/IpPacketLossMetrics.o \
$(obj_dir)/IpPacketMetrics.o \
-lpcap -lboost_thread -L$(BOOST_LIB) -lboost_python -L/usr/lib/python$(PYTHON_VERSION)/config \
-lpython$(PYTHON_VERSION) -o $(lib_dir)/$(MODULE_NAME).so
clean:
我的软件编译和构建如下:
:〜/ multiviewer / src / analyzer / cpp / IpMetrics $ make g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../ src -o" ../../ wrapped /" objects / IpPacketMetricsBase.o ../src/IpPacketMetricsBase.cpp g ++ -O2 -Wall - fPIC -c -std = c ++ 11 -I ../src -o" ../../ wrapped /" objects / IpPacketJitterDelayVariation.o ../src/IpPacketJitterDelayVariation.cpp g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../ src -o" ../../ wrapped /" objects / IpPacketJitterCumulative.o ../src/IpPacketJitterCumulative.cpp g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../ src -o" ../../ wrapped /" objects / IpPacketMetricsUtil.o ../src/IpPacketMetricsUtil.cpp g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../ src -o" ../../ wrapped /" objects / IpPacketLossMetrics.o ../src/IpPacketLossMetrics.cpp g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../src -o" ../../ wrapped /" objects / IpPacketMetrics.o ../src/IpPacketMetrics.cpp g ++ -O2 -Wall -fPIC -c -std = c ++ 11 -I ../ src -I / usr / include / python2.7 -I / usr / lib / boost-gcc49 / include -o" ../../ wrapped /" objects / boost_IpMetrics.o boost_IpMetrics.cpp g ++ -shared -Wl, - export-dynamic \" ../../ wrapped /" objects / boost_IpMetrics.o \ " ../../ wrapped /" objects / IpPacketMetricsBase.o \ " ../../ wrapped /" objects / IpPacketJitterDelayVariation.o \ " ../../ wrapped /" objects / IpPacketJitterCumulative.o \ " ../../ wrapped /" objects / IpPacketLossMetrics.o \ " ../../ wrapped /" objects / IpPacketMetrics.o \ -lpcap -lboost_thread -L / usr / lib / boost-gcc49 / lib -lboost_python -L / usr / lib / python2.7 / config \ -lpython2.7 -o" ../../ wrapped /" libraries / IpMetrics.so
知道可能出现什么问题吗?