OSX: Library not loaded: libp3dtool.1.9.dylib

Hiho…

So I could swear that I got Panda3D to compile successfully once before, but now no matter what I try, it’s consistently failing, and I’m not sure what’s going on…

I’m trying to build Panda3D on OS X (10.11 / El Capitan)… Ultimately I’m hoping to be able to build things against a custom Python version, etc, but in the interest of just trying to get it working initially I’ve actually completely uninstalled all of that from my system and am just working with the stock system Python/libs…

I have downloaded the panda3d-1.9.0.tar.gz, unpacked it, copied the “thirdparty” directory from panda3d-1.9.0-tools-mac.tar.gz into the source tree, and then run ‘python makepanda/makepanda.py --everything --installer’. About 7% in, however, it fails because it’s apparently unable to run ‘interrogate’ (which it looks like is an executable it just built?):

$ python makepanda/makepanda.py --everything --installer
Version: 1.9.0
WARNING: Could not locate thirdparty package fftw, excluding from build
WARNING: Could not locate thirdparty package gles, excluding from build
WARNING: Could not locate thirdparty package gles2, excluding from build
WARNING: Could not locate thirdparty package egl, excluding from build
WARNING: Could not locate thirdparty package vrpn, excluding from build
WARNING: Could not locate thirdparty package openssl, excluding from build
WARNING: Could not locate pkg-config package gtk+-2.0, excluding from build
Generating dependencies...
[  0%] Building C++ object built/tmp/p3dtoolbase_composite1.o
[  0%] Building C++ object built/tmp/p3dtoolbase_composite2.o
[  0%] Building C object built/tmp/p3dtoolbase_lookup3.o
[  0%] Building C++ object built/tmp/p3dtoolbase_indent.o
[  0%] Building C++ object built/tmp/p3dtoolutil_composite1.o
[  0%] Building C++ object built/tmp/p3dtoolutil_composite2.o
[  1%] Building Objective-C++ object built/tmp/p3dtoolutil_filename_assist.o
[  1%] Building C++ object built/tmp/p3dtool_dtool.o
[  1%] Linking dynamic library built/lib/libp3dtool.dylib
clang: warning: argument unused during compilation: '-pthread'
[  1%] Building Bison object built/tmp/p3cppParser_cppBison.o
[  2%] Building C++ object built/tmp/p3cppParser_composite1.o
[  2%] Building C++ object built/tmp/p3cppParser_composite2.o
[  2%] Linking static library built/tmp/libp3cppParser.a
[  2%] Building C++ object built/tmp/p3prc_composite1.o
[  2%] Building C++ object built/tmp/p3prc_composite2.o
[  3%] Building C++ object built/tmp/p3dconfig_composite1.o
[  3%] Building C++ object built/tmp/p3interrogatedb_composite1.o
[  3%] Building C++ object built/tmp/p3interrogatedb_composite2.o
[  3%] Building C++ object built/tmp/p3dtoolconfig_dtoolconfig.o
[  3%] Linking dynamic library built/lib/libp3dtoolconfig.dylib
clang: warning: argument unused during compilation: '-pthread'
[  4%] Building C++ object built/tmp/dtoolconfig_pydtool.o
[  4%] Linking dynamic library built/panda3d/dtoolconfig.so
clang: warning: argument unused during compilation: '-pthread'
[  4%] Building C++ object built/tmp/p3pystub_pystub.o
[  4%] Linking static library built/lib/libp3pystub.a
[  4%] Building C++ object built/tmp/interrogate_composite1.o
[  5%] Building C++ object built/tmp/interrogate_composite2.o
[  5%] Linking executable built/bin/interrogate
clang: warning: argument unused during compilation: '-pthread'
[  5%] Building C++ object built/tmp/interrogate_module_interrogate_module.o
[  5%] Linking executable built/bin/interrogate_module
clang: warning: argument unused during compilation: '-pthread'
[  5%] Building C++ object built/tmp/parse_file_parse_file.o
[  6%] Linking executable built/bin/parse_file
clang: warning: argument unused during compilation: '-pthread'
[  6%] Building C++ object built/tmp/test_interrogate_test_interrogate.o
[  6%] Linking executable built/bin/test_interrogate
clang: warning: argument unused during compilation: '-pthread'
[  6%] Building C++ object built/tmp/p3pandabase_pandabase.o
[  6%] Building C++ object built/tmp/p3express_composite1.o
[  7%] Building C++ object built/tmp/p3express_composite2.o
[  7%] Building Interrogate database built/pandac/input/libp3express.in
dyld: Library not loaded: libp3dtool.1.9.dylib
  Referenced from: /Users/astewart/personal/panda3d/panda3d-1.9.0/built/bin/interrogate
  Reason: image not found
Storing dependency cache.
Elapsed Time: 55 sec
The following command returned a non-zero value: built/bin/interrogate -srcdir panda/src/express -Ipanda/src/express -Dvolatile -Dmutable -DCPPPARSER -D__STDC__=1 -D__cplusplus -D__inline -D__const=const -D__attribute__\(x\)= -D_LP64 -oc built/tmp/libp3express_igate.cxx -od built/pandac/input/libp3express.in -fnames -string -refcount -assert -python-native -Sbuilt/include/parser-inc -Ipanda/src/express -Sbuilt/tmp -Sbuilt/include -S/System/Library/Frameworks/Python.framework/Versions/2.7/Headers -Sthirdparty/darwin-libs-a/eigen/include -module panda3d.core -library libp3express buffer.h checksumHashGenerator.h circBuffer.h compress_string.h config_express.h copy_stream.h datagram.h datagramGenerator.h datagramIterator.h datagramSink.h dcast.h encrypt_string.h error_utils.h export_dtool.h fileReference.h filename_ext.h globPattern_ext.h hashGeneratorBase.h hashVal.h indirectLess.h memoryInfo.h memoryUsage.h memoryUsagePointerCounts.h memoryUsagePointers.h memoryUsagePointers_ext.h multifile.h namable.h nodePointerTo.h nodePointerToBase.h nodeReferenceCount.h openSSLWrapper.h ordered_vector.h p3express_composite1.cxx p3express_composite2.cxx p3express_ext_composite.cxx pStatCollectorForwardBase.h password_hash.h patchfile.h pointerTo.h pointerToArray.h pointerToArrayBase.h pointerToArray_ext.h pointerToBase.h pointerToVoid.h profileTimer.h pta_double.h pta_float.h pta_int.h pta_stdfloat.h pta_uchar.h ramfile.h ramfile_ext.h referenceCount.h streamReader_ext.h subStream.h subStreamBuf.h subfileInfo.h temporaryFile.h threadSafePointerTo.h threadSafePointerToBase.h trueClock.h typeHandle_ext.h typedReferenceCount.h typedef.h vector_double.h vector_float.h vector_stdfloat.h vector_uchar.h virtualFile.h virtualFileComposite.h virtualFileList.h virtualFileMount.h virtualFileMountAndroidAsset.h virtualFileMountMultifile.h virtualFileMountRamdisk.h virtualFileMountSystem.h virtualFileSimple.h virtualFileSystem.h virtualFileSystem_ext.h weakPointerCallback.h weakPointerTo.h weakPointerToBase.h weakPointerToVoid.h weakReferenceList.h windowsRegistry.h zStream.h zStreamBuf.h
Build terminated.

Does anybody have any idea what’s going on here? I have to admit I’m more a Linux guy than a Mac guy so I’m not that familiar with how to troubleshoot this sort of build error on OSX…

El Capitan introduced some backward-incompatible changes that prevent 1.9 from working on Mac.

I’ve checked in some changes yesterday to address this. If you get the latest development build from Git, you shouldn’t see these issues:
github.com/panda3d/panda3d
If you prefer a stable version of Panda3D over the latest development branch, you can check out the “release/1.9.x” branch, which contains only bugfixes made since 1.9.0 was released.

Note that El Capitan doesn’t have OpenSSL any more, so some networking capabilities of Panda may be unavailable. I’ll look into adding it to the thirdparty packages.

I actually did eventually figure out the problem late last night…

I did some digging and some hacking on makepanda.py and discovered that even though it was setting DYLD_LIBRARY_PATH correctly, and when I set it the same and called interrogate myself it worked, for some reason when makepanda did it the DYLD_LIBRARY_PATH setting was being ignored when invoking interrogate, so it wasn’t able to find the libraries.

After a fair bit more head scratching and Google searching, I eventually discovered that apparently with El Capitan, Apple quietly slipped in a “feature” (without really telling anybody what it does or how it was going to screw up all kinds of things, particularly for developers) called System Integrity Protection (aka “Rootless”). Amongst the many behaviors it breaks is the use of DYLD_LIBRARY_PATH for most applications, causing things to just quitely ignore it and fail, even if it’s set correctly.

So the long and the short of it is: In order to compile Panda3D on OS X El Capitan, you must disable SIP first

For anyone needing this info, the procedure for doing this is:

  1. Reboot into Recovery Mode by holding down command-R during boot.
  2. In Recovery mode, from the “Utilities” pulldown menu, open a terminal window
  3. Run ‘csrutil disable’ from the command prompt

(Then reboot back into the normal OS and it will come up without SIP enabled so you can actually do normal developer things again)

(After doing this I did then also run into some additional compilation problems with 1.9.0, but I’ve pulled down the latest git master and it builds like a charm and seems to work! Thanks rdb!)

Glad you figured it out. Note that setting DYLD_LIBRARY_PATH is not necessary in the latest Git version of Panda3D.

I do not recommend disabling SIP; with the changes I made, it should not be necessary. I’d rather it be left enabled so that we can test and fix Panda to work properly regardless of that setting.