Skip to content

Commit 872e4be

Browse files
committed
Fix loading numpy library on Linux
1 parent 77017bb commit 872e4be

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/PythonProcessor.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ You should have received a copy of the GNU General Public License
2020
along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
*/
2222

23-
24-
23+
#if JUCE_LINUX
24+
#include <dlfcn.h>
25+
#endif
2526
#include <filesystem>
2627

2728
#include "PythonProcessor.h"
@@ -439,6 +440,14 @@ bool PythonProcessor::initInterpreter(String pythonHome)
439440
throw std::runtime_error("Failed to set Python home");
440441
}
441442

443+
#if JUCE_LINUX
444+
// Try to open libpython with RTLD_GLOBAL
445+
void* handle = dlopen("libpython3.10.so.1.0", RTLD_NOW | RTLD_GLOBAL);
446+
if (!handle) {
447+
LOGE("Could not dlopen libpython3.10.so.1.0: ", dlerror());
448+
}
449+
#endif
450+
442451
// Initialize with PyConfig
443452
py::initialize_interpreter(&config);
444453
{

0 commit comments

Comments
 (0)