LUI does not compile on MacOS 10.14.5, Python 3.7, and Panda3D 1.10.3
gmyoungblood opened this issue · comments
Not sure if this is missing a library or some other issue?
MacOS 10.14.5, Python 3.7, Panda3D 1.10.3
Undefined symbols for architecture x86_64:
"TextEncoder::encode_wtext(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, TextEncoder::Encoding)", referenced from:
operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&) in luiText.cxx.o
"InternalName::append(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
InternalName::make(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiRegion.cxx.o
PointerTo<InternalName> InternalName::make<7>(char const (&) [7]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<6>(char const (&) [6]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<9>(char const (&) [9]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<7>(char const (&) [7]) in luiVertexChunk.cxx.o
PointerTo<InternalName> InternalName::make<9>(char const (&) [9]) in luiVertexChunk.cxx.o
PointerTo<InternalName> InternalName::make<6>(char const (&) [6]) in luiVertexChunk.cxx.o
...
"InternalName::InternalName(InternalName*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
InternalName::make(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiRegion.cxx.o
PointerTo<InternalName> InternalName::make<7>(char const (&) [7]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<6>(char const (&) [6]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<9>(char const (&) [9]) in luiRoot.cxx.o
PointerTo<InternalName> InternalName::make<7>(char const (&) [7]) in luiVertexChunk.cxx.o
PointerTo<InternalName> InternalName::make<9>(char const (&) [9]) in luiVertexChunk.cxx.o
PointerTo<InternalName> InternalName::make<6>(char const (&) [6]) in luiVertexChunk.cxx.o
...
"TypeRegistry::register_type(TypeHandle&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
LUIRegion::init_type() in config_lui.cxx.o
LUIInputHandler::init_type() in config_lui.cxx.o
LUIBaseElement::init_type() in config_lui.cxx.o
LUISprite::init_type() in config_lui.cxx.o
LUIObject::init_type() in config_lui.cxx.o
LUIText::init_type() in config_lui.cxx.o
LUIEventData::init_type() in config_lui.cxx.o
...
"TypeRegistry::record_alternate_name(TypeHandle, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
TypedWritableReferenceCount::init_type() in config_lui.cxx.o
TypedWritable::init_type() in config_lui.cxx.o
TypedWritableReferenceCount::init_type() in interrogate_wrapper.cpp.o
TypedWritable::init_type() in interrogate_wrapper.cpp.o
TypedWritableReferenceCount::init_type() in luiAtlas.cxx.o
TypedWritable::init_type() in luiAtlas.cxx.o
TypedWritableReferenceCount::init_type() in luiChunkDescriptor.cxx.o
...
"TypeRegistry::register_dynamic_type(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
CopyOnWriteObj1<ov_multiset<PandaNode::DownConnection, std::__1::less<PandaNode::DownConnection>, pvector<PandaNode::DownConnection> >, TypeHandle>::init_type() in config_lui.cxx.o
CopyOnWriteObj1<ov_set<PandaNode::UpConnection, std::__1::less<PandaNode::UpConnection>, pvector<PandaNode::UpConnection> >, TypeHandle>::init_type() in config_lui.cxx.o
CopyOnWriteObj1<ov_multiset<PandaNode::DownConnection, std::__1::less<PandaNode::DownConnection>, pvector<PandaNode::DownConnection> >, TypeHandle>::init_type() in interrogate_wrapper.cpp.o
CopyOnWriteObj1<ov_set<PandaNode::UpConnection, std::__1::less<PandaNode::UpConnection>, pvector<PandaNode::UpConnection> >, TypeHandle>::init_type() in interrogate_wrapper.cpp.o
CopyOnWriteObj1<ov_multiset<PandaNode::DownConnection, std::__1::less<PandaNode::DownConnection>, pvector<PandaNode::DownConnection> >, TypeHandle>::init_type() in luiInputHandler.cxx.o
CopyOnWriteObj1<ov_set<PandaNode::UpConnection, std::__1::less<PandaNode::UpConnection>, pvector<PandaNode::UpConnection> >, TypeHandle>::init_type() in luiInputHandler.cxx.o
"GeomVertexData::GeomVertexData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, GeomVertexFormat const*, GeomEnums::UsageHint)", referenced from:
LUIRoot::LUIRoot(float, float) in luiRoot.cxx.o
LUIVertexChunk::LUIVertexChunk(int) in luiVertexChunk.cxx.o
"ExecutionEnvironment::ns_shadow_environment_variable(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
Dtool_PyModuleInitHelper(LibraryDef const**, PyModuleDef*) in interrogate_module.cpp.o
"Camera::Camera(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Lens*)", referenced from:
LUIRegion::LUIRegion(GraphicsOutput*, LVecBase4f const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiRegion.cxx.o
"Notify::get_category(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::init() in config_lui.cxx.o
NotifyCategoryGetCategory_lui::get_category() in config_lui.cxx.o
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::get_unsafe_ptr() in config_lui.cxx.o
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::get_safe_ptr() in config_lui.cxx.o
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::operator->() in config_lui.cxx.o
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::operator*() in config_lui.cxx.o
NotifyCategoryProxy<NotifyCategoryGetCategory_lui>::operator NotifyCategory*() in config_lui.cxx.o
...
"Shader::make(Shader::ShaderLanguage, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
LUIRoot::create_object_shader() in luiRoot.cxx.o
"Texture::Texture(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
LUIRegion::LUIRegion(GraphicsOutput*, LVecBase4f const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiRegion.cxx.o
"DataNode::define_input(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, TypeHandle)", referenced from:
LUIInputHandler::LUIInputHandler(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiInputHandler.cxx.o
"Filename::from_os_specific_w(std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> > const&, Filename::Type)", referenced from:
Dtool_PyModuleInitHelper(LibraryDef const**, PyModuleDef*) in interrogate_module.cpp.o
"PandaNode::r_copy_children(PandaNode const*, pmap<PandaNode*, PandaNode*, std::__1::less<PandaNode*> >&, Thread*)", referenced from:
vtable for LUIInputHandler in luiInputHandler.cxx.o
"PandaNode::PandaNode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
LUIInputHandler::LUIInputHandler(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiInputHandler.cxx.o
"VirtualFile::read_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, bool) const", referenced from:
LUIAtlas::load_descriptor_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in luiAtlas.cxx.o
"CallbackData::output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
vtable for LUIEventData in luiEventData.cxx.o
"DisplayRegion::output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
vtable for LUIRegion in luiRegion.cxx.o
"ExecutionEnvironment::ns_has_environment_variable(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
Dtool_PyModuleInitHelper(LibraryDef const**, PyModuleDef*) in interrogate_module.cpp.o
"PandaNode::r_copy_subgraph(pmap<PandaNode*, PandaNode*, std::__1::less<PandaNode*> >&, Thread*) const", referenced from:
vtable for LUIInputHandler in luiInputHandler.cxx.o
"PandaNode::write(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int) const", referenced from:
vtable for LUIInputHandler in luiInputHandler.cxx.o
"PandaNode::output(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const", referenced from:
vtable for LUIInputHandler in luiInputHandler.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lui.so] Error 1
make[1]: *** [CMakeFiles/lui.dir/all] Error 2
This is because the Panda3D SDK was compiled with an older (ancient) version of xcode which used -stdlib=libstdc++
, but newer versions only support -stdlib=libc++
. You can either try to compile LUI with xcode 4.4.1 (I couldn't get it to work) or compile the Panda SDK with a newer version of xcode.
If you want to compile with a newer xcode, this is what I did to get it to work:
# Install some requirements beforehand. There may be more which I already had installed.
brew install yasm
brew install icu4c
brew install python3
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"
# Building panda-thirdparty - these are required to build the Panda3D SDK. I skipped bullet because I can't get it to compile.
git clone https://github.com/treamology/panda3d-thirdparty.git
cd panda3d-thirdparty
# This is important! This branch has the changes needed for newer versions of MacOS.
git checkout ios
mkdir build
cd build
# NOTE: the output will be in ../darwin-libs-a
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BULLET:BOOL=FALSE ..
cmake --build . --config Release
# Go back to the top level.
cd ../../
# Building panda
git clone https://github.com/panda3d/panda3d.git
cd panda3d
# Copy the third party stuff over to here.
mkdir thirdparty
cp -R ../panda3d-thirdparty/darwin-libs-a thirdparty/
# You might need to change your osxtarget depending on your MacOS version.
python3 makepanda/makepanda.py --everything --no-bullet --osxtarget 10.15 --threads 4 --python-incdir=/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/include --python-libdir=/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib --installer
# Go back to the top-level directory.
cd ..
# Now you have an installer for the Panda3D SDK. You need to do a couple of things to install it (especially if you are using MacOS 10.15 which makes the root directory read-only).
# 1. open disk utility
# 2. Click file -> New Image -> Blank Image
# 3. Name it PandaSDK-1_11_0
# 4. Set size to 1 GB
# 5. Click save and it should be mounted automatically but if it isn't, then mount it.
# 6. Run your new Panda3D SDK installer, and when you get to the drive selection, select your volume you just created.
# 7. VERY IMPORTANT select back and make sure to check to install the headers. Whenever you change the drives it will uncheck that option...
# Now that you have the SDK installed, we can finally compile lui.
git clone https://github.com/tobspr/LUI.git
cd LUI
python3 update_module_builder.py
VERBOSE=1 PYTHONPATH=/Volumes/PandaSDK-1_11_0/Developer/Panda3D python3 build.py
# Finally you should have lui.so compiled, now we just need to add it to the sdk.
cp osx_amd64_panda1.11.0_py37/lui.so /Volumes/PandaSDK-1_11_0/Developer/Panda3D/panda3d/
# Now make python find the panda python files and try importing lui.
export PYTHONPATH=/Volumes/PandaSDK-1_11_0/Developer/Panda3D python3 -c "import panda3d.lui"
# Great! Now you have LUI compiled! A couple of gotchas:
# 1. A lot of the LUI code uses unicode(). If you're in python3, you need to replace this with str().
# 2. IMPORTANT!!! In your prc file for panda you need
# gl-version 3 2
#
# For example:
# from panda3d.core import load_prc_file_data
# load_prc_file_data("", """
# text-minfilter linear
# text-magfilter linear
# text-pixels-per-unit 32
# sync-video #f
# textures-power-2 none
# show-frame-rate-meter #t
# win-size 700 600
# window-title LUI Minimal Example
# gl-version 3 2
# """)
# If you forget this, then LUI won't render correctly.
I made this script by looking through my bash history, so there may be a small mistake somewhere. Let me know if you run into any trouble and I can help you get it sorted out. If this is too much work, I can also just upload the volume I created with the Panda3D SDK including lui.so.