I downloaded the official precompiled Panda3D SDK 1.10.4.1 for mac os and built a C++ hello world program following this tutorial using CLion. The compilation was smooth but code always crashed at framework.open_window() and returned code 11. More specifically was at make_default_pipe.
Here is my code:
#include <iostream>
#include "pandaFramework.h"
#include "pandaSystem.h"
using namespace std;
int main(int argc, char *argv[]) {
PandaFramework framework;
framework.open_framework(argc, argv);
framework.set_window_title("My Panda3D Window");
cout << "mark1" << endl;
WindowFramework *window = framework.open_window();
cout << "mark2" << endl;
if (window != nullptr) {
cout << "Opened the window successfully!\n";
framework.main_loop();
} else {
cout << "Could not load the window!\n";
}
framework.close_framework();
return 0;
}
Running result is
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
mark1
Process finished with exit code 11
CMakeList.txt
cmake_minimum_required(VERSION 3.14)
project(Panda3D)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/)
include_directories(/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/)
include_directories(include)
link_directories(lib)
set(PANDA3D_LIB -lp3framework -lpanda -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct)
add_executable(Panda3D main.cpp)
target_link_libraries(Panda3D ${PANDA3D_LIB})
And here’s my project structure:
Demo
├─bin/
├─include/
├─lib/
├─etc/
├─Frameworks/
├─main.cpp
└─CMakeList.txt
I copied the folders include
lib
Frameworks
and etc
from the precompiled SDK to my Demo
folder without any modification.
I tried to compile Panda3D source code on my Mac but always failed at:
[T1] Linking dynamic library built/panda3d/ai.so
[T1] Building C object built/tmp/cpython-27m/deploy-stubw.o
[T1] Linking executable built/bin/deploy-stubw
7 warnings generated.
[T1] Waiting for tasks...
[T3] Waiting for tasks...
[T4] Waiting for tasks...
7 warnings generated.
[T1] Linking dynamic library built/panda3d/_rplight.so
[ 0%] Compressing built/models/misc/Dirlight.egg.pz
dyld: Symbol not found: __ZNSsD1Ev
Referenced from: /Users/hezhenbang/Downloads/panda3d/built/bin/../lib/libpanda.1.10.dylib
Expected in: flat namespace
in /Users/hezhenbang/Downloads/panda3d/built/bin/../lib/libpanda.1.10.dylib
Storing dependency cache.
Elapsed Time: 22 min 32 sec
The following command returned a non-zero value: built/bin/pzip built/models/misc/Dirlight.egg
Build terminated.
Anyone can help?