{"id":1679,"date":"2022-08-30T15:18:32","date_gmt":"2022-08-30T15:18:32","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/python-in-mac-os-x-error-undefined-symbols-_pyimport_import-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:32","modified_gmt":"2022-08-30T15:18:32","slug":"python-in-mac-os-x-error-undefined-symbols-_pyimport_import-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/python-in-mac-os-x-error-undefined-symbols-_pyimport_import-collection-of-common-programming-errors\/","title":{"rendered":"python in mac os x error Undefined symbols: &ldquo;_PyImport_Import&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>While building SUMO (Simulation of Urban MObility http:\/\/sumo.sf.net\/) in mac os x (10.6.8) the following error occured. I don&#8217;t think this is specific to SUMO, rather python installation in mac related issue, so I am posting here. FYI, the python version is 2.7.1 here.<\/p>\n<p>Any idea on how to solve this issue?<\/p>\n<pre><code>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\nUndefined symbols:\n\"_PyImport_Import\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_PyString_FromString\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_Py_Finalize\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_Py_Initialize\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_Py_InitModule4_64\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_PyRun_SimpleFileExFlags\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_PyErr_Print\", referenced from:\ntraci::TraCIServer::runEmbedded(std::basic_string)in libtraciserver.a(TraCIServer.o)\n\"_PyArg_ParseTuple\", referenced from:\ntraci::traciemb_execute(_object*, _object*)in libtraciserver.a(TraCIServer.o)\n\"_Py_BuildValue\", referenced from:\ntraci::traciemb_execute(_object*, _object*)in libtraciserver.a(TraCIServer.o)\nld: symbol(s) not found\ncollect2: ld returned 1 exit status\nmake[3]: *** [sumo] Error 1\nmake[2]: *** [all-recursive] Error 1\nmake[1]: *** [all] Error 2\nmake: *** [all-recursive] Error 1\n<\/code><\/pre>\n<ol>\n<li>\n<p>I found a link on SUMO&#8217;s website (here):<\/p>\n<pre><code> export CPPFLAGS=\"$CPPFLAGS -I\/opt\/local\/include\"\n export LDFLAGS=\"$LDFLAGS -L\/opt\/local\/lib -lpython2.7\"\n.\/configure --with-fox=\/opt\/local --with-proj-gdal=\/opt\/local --with-xerces=\/opt\/local --prefix=\/opt\/sumo --with-python\n<\/code><\/pre>\n<p>It worked for me to get past this compilation error. These lines are working with MacPort though.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:27:21. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>While building SUMO (Simulation of Urban MObility http:\/\/sumo.sf.net\/) in mac os x (10.6.8) the following error occured. I don&#8217;t think this is specific to SUMO, rather python installation in mac related issue, so I am posting here. FYI, the python version is 2.7.1 here. Any idea on how to solve this issue? libtool: link: g++ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1679","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1679"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1679\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}