From: <geo...@us...> - 2011-12-20 00:02:26
|
Revision: 4525 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=4525&view=rev Author: geoffthemedio Date: 2011-12-20 00:02:20 +0000 (Tue, 20 Dec 2011) Log Message: ----------- Patch by Vezzra to fix AI Python startup issues on OSX. Modified Paths: -------------- trunk/FreeOrion/server/ServerApp.cpp Modified: trunk/FreeOrion/server/ServerApp.cpp =================================================================== --- trunk/FreeOrion/server/ServerApp.cpp 2011-12-19 20:30:02 UTC (rev 4524) +++ trunk/FreeOrion/server/ServerApp.cpp 2011-12-20 00:02:20 UTC (rev 4525) @@ -137,6 +137,10 @@ } } +#ifdef FREEORION_MACOSX +#include <stdlib.h> +#endif + void ServerApp::CreateAIClients(const std::vector<PlayerSetupData>& player_setup_data) { // check if AI clients are needed for given setup data @@ -158,6 +162,15 @@ if (!need_AIs) return; +#ifdef FREEORION_MACOSX + // On OSX set environment variable DYLD_LIBRARY_PATH to python framework folder + // bundled with app, so the dynamic linker uses the bundled python library. + // Otherwise the dynamic linker will look for a correct python lib in system + // paths, and if it can't find it, throw an error and terminate! + // Setting environment variable here, spawned child processes will inherit it. + setenv("DYLD_LIBRARY_PATH", GetPythonHome().string().c_str(), 1); +#endif + // binary / executable to run for AI clients const std::string AI_CLIENT_EXE = AIClientExe(); |