2011-12-01 59 views
0

在mac os x(10.6.8)中構建SUMO(模擬城市MObility http://sumo.sf.net/)時發生以下錯誤。我不認爲這是特定於SUMO,而是在mac相關的問題python安裝,所以我張貼在這裏。僅供參考,Python版本在這裏是2.7.1。python in mac os x error未定義符號:「_PyImport_Import」

有關如何解決此問題的任何想法?

libtool: link: g++ -g -pthread -o sumo sumo_main.o ./microsim/MSMoveReminder.o -Wl,-bind_at_load -L/opt/local/lib ./netload/libnetload.a ./microsim/libmicrosim.a ./microsim/cfmodels/libmicrosimcfmodels.a ./microsim/devices/libmicrosimdevs.a ./microsim/output/libmicrosimoutput.a ./microsim/trigger/libmicrosimtrigger.a ./microsim/actions/libmsactions.a ./microsim/traffic_lights/libmicrosimtls.a ./utils/geom/libgeom.a ./utils/shapes/libshapes.a ./traci-server/libtraciserver.a ./utils/options/liboptions.a ./utils/common/libcommon.a ./utils/xml/libxml.a ./utils/importio/libimportio.a ./utils/iodevices/libiodevices.a ./foreign/tcpip/libtcpip.a ./foreign/nvwa/libnvwa.a -lxerces-c /opt/local/lib/libproj.dylib -lm -pthread 
Undefined symbols: 
"_PyImport_Import", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_PyString_FromString", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_Py_Finalize", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_Py_Initialize", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_Py_InitModule4_64", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_PyRun_SimpleFileExFlags", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_PyErr_Print", referenced from: 
traci::TraCIServer::runEmbedded(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in libtraciserver.a(TraCIServer.o) 
"_PyArg_ParseTuple", referenced from: 
traci::traciemb_execute(_object*, _object*)in libtraciserver.a(TraCIServer.o) 
"_Py_BuildValue", referenced from: 
traci::traciemb_execute(_object*, _object*)in libtraciserver.a(TraCIServer.o) 
ld: symbol(s) not found 
collect2: ld returned 1 exit status 
make[3]: *** [sumo] Error 1 
make[2]: *** [all-recursive] Error 1 
make[1]: *** [all] Error 2 
make: *** [all-recursive] Error 1 
+0

如果你使用python符號,你不應該鏈接到python庫嗎? –

+0

我以爲默認情況下python符號已經鏈接到了庫上,不是嗎?我怎樣才能做到這一點? – Morison

+0

我的印象是,靜態庫(在Unix上; Windows是不同的,但與你無關)並不知道它們需要鏈接以解決它們的符號。 –

回答

1

我發現了SUMO網站(here)鏈接:

export CPPFLAGS="$CPPFLAGS -I/opt/local/include" 
export LDFLAGS="$LDFLAGS -L/opt/local/lib -lpython2.7" 
./configure --with-fox=/opt/local --with-proj-gdal=/opt/local --with-xerces=/opt/local --prefix=/opt/sumo --with-python 

它的工作對我來說,突破這個編譯錯誤。儘管這些行與MacPort一起工作。

+0

謝謝,它也適用於我。 :) – Morison