{"action":"closed","issue":{"url":"https://api.github.com/repos/SFTtech/openage/issues/379","labels_url":"https://api.github.com/repos/SFTtech/openage/issues/379/labels{/name}","comments_url":"https://api.github.com/repos/SFTtech/openage/issues/379/comments","events_url":"https://api.github.com/repos/SFTtech/openage/issues/379/events","html_url":"https://github.com/SFTtech/openage/issues/379","id":106262812,"number":379,"title":"Python 3.4 library not found on Mac OS X.","user":{"login":"darrenstrash","id":9133924,"avatar_url":"https://avatars.githubusercontent.com/u/9133924?v=3","gravatar_id":"","url":"https://api.github.com/users/darrenstrash","html_url":"https://github.com/darrenstrash","followers_url":"https://api.github.com/users/darrenstrash/followers","following_url":"https://api.github.com/users/darrenstrash/following{/other_user}","gists_url":"https://api.github.com/users/darrenstrash/gists{/gist_id}","starred_url":"https://api.github.com/users/darrenstrash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrenstrash/subscriptions","organizations_url":"https://api.github.com/users/darrenstrash/orgs","repos_url":"https://api.github.com/users/darrenstrash/repos","events_url":"https://api.github.com/users/darrenstrash/events{/privacy}","received_events_url":"https://api.github.com/users/darrenstrash/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SFTtech/openage/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/SFTtech/openage/labels/buildsystem","name":"buildsystem","color":"eb6420"},{"url":"https://api.github.com/repos/SFTtech/openage/labels/os%20x","name":"os x","color":"ff35e5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-14T03:07:20Z","updated_at":"2015-09-19T13:47:16Z","closed_at":"2015-09-19T13:47:16Z","body":"**System setup:**\r\nMac OS X Yosemite 10.10.4 (14E46)\r\nPython 3.4 installed with `brew install python3`\r\nUsing g++ version 5.2.0\r\n\r\n**The symptom:** When building the \"run\" executable, the linker fails with error `ld: library not found for -lpython3.4`\r\n\r\nMy investigation reveals the following:\r\n\r\n**The superficial cause:** Python libraries are not copied to system library directories in Mac installs. And no `-Lpath` compiler option is used for compiling \"run\".\r\n\r\n**The root cause:** The distutils python package is currently being erroneously used to grab the C/C++ library information. In fact, distutils is currently returning the location of libraries to *import* into python scripts. It's a coincidence that the real library name has the same name `python3.4`. Therefore, since it wasn't designed for it, distutils can't be used to the find the library's location...\r\n\r\n**Recommendation:** We use the python configuration tool to tell us the exact linker arguments instead: (e.g., with `python$(VERSION)-config --ldflags`). While we are at it, we could grab the cflags with `--cflags` as well. This way we are always using the appropriate flags that the Python package builders meant for us to use when linking against Python. \r\n\r\n**Drawbacks:** This solution works with the Homebrew Python 3.4 installation on Mac OS X. However, I have observed the ldflags can sometimes contain extra -lfile libs that are not currently included in our build system, which can then lead to a similar error. This was observed with the MacPorts installation.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/26662116-python-3-4-library-not-found-on-mac-os-x?utm_campaign=plugin&utm_content=tracker%2F371436&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F371436&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"}}