I've been searching and bashing my head on this for the last two weeks and would love some help. I'd even pay someone at this point (no joke) just to make progress and move back to the actual coding of my game again. This is my first post here too, so sorry if I miss some information.
I'd be happy to copy and paste any more relevant code samples. Desperation aside, let me begin:
Problem: I have a fairly simple game I'm starting and want to build an App file to distribute for testing etc. on another machine. My game is using CEGUI and only really seems to have trouble properly linking / bundling CEGUI in a way that can work on another computer. The game does run fine from where it builds to before attempting the bundle because it was finding CEGUI dylibs from "@executable_path/../Frameworks" and I copied all the dependencies that were built to a folder to match this in my project directory.
How I built/installed CEGUI: I'm using OSX and cloned both the CEGUI and CEGUI-dependencies repositories and then switched to the 0.8.x branches. Inside the dependencies project, I created a new "build" folder, cd to it, and run "cmake ..". After it finishes, I build it with just "make". Once dependencies are built, I go to cegui, make the "build" folder, make a new symbolic link to cegui-dependencies/build/dependencies as "dependencies" in the cegui directory, cd to my new build directory and "cmake ..", "make", and "sudo make install". This might be part of my problem, I know on other posts / docs that it was recommended not to install. But, I've chosen to install it because I don't know how else I am to get my project to find CEGUI at all.
After a bit of searching, I did find a "FindCEGUI.cmake" file that I put in with my other cmake scripts in my project. I found that this does seem to pick up my CEGUI dylibs from the install location just fine, so I feel good there.
The problems started happening as I now wanted to learn how to make the bundle for OSX. I quickly discovered "fixup_bundle" and with some trial and error I eventually got this to find my App file and go. I've added /usr/local/lib to my directories it searches for libraries and it ends up finding everything just fine. But, it won't find the CEGUI dependency dylibs (yet another problem!).
So, with much more trial and error, I've set up some CMake to copy these over:
Code: Select all
SET(FRAMEWORKS
# "${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUIBase-0.dylib"
# "${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUICommonDialogs-0.dylib"
# "${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUICoreWindowRendererSet.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUIExpatParser.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUIOpenGLRenderer-0.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libCEGUISILLYImageCodec.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libexpat.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libfreetype.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libglew.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libglfw.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libjpeg.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libpcre.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libpng.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libSILLY.dylib"
"${CMAKE_CURRENT_SOURCE_DIR}/Frameworks/libzlib.dylib"
)
SET_SOURCE_FILES_PROPERTIES(${FRAMEWORKS}
PROPERTIES MACOSX_PACKAGE_LOCATION MacOS
)
ADD_EXECUTABLE(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCES} ${FRAMEWORKS} ${RESOURCES})
You might notice that I'm actually copying to "MacOS" instead of "Resources" or really "Frameworks" like the default setting is looking for. I had trouble with fixup_bundle ignoring my files I copied to Frameworks and just adding yet another copy to the executable location (MacOS). So, I rebuilt CEGUI with the option to change the install name to just "@executable_path" and now I don't have duplicate CEGUI libraries being pulled in at least.
So, here's where my crazy problems all begin and the last week now has been mostly trying to figure out this dylib linking mess. I've gone with trying to copy just the minimum amount of dylibs (above script) one by one until it runs and it'll be great on my computer. But, somewhere something is still referencing a dylib installed at /usr/local/lib/cegui-0.8 again and I can't find it with otool -L on all the files either. So, this won't work well.
Here's the type of error for this that I typically see:
Code: Select all
CEGUI::GenericException in function 'CEGUI::DynamicModule::DynamicModule(const
CEGUI::String &)'
(/Users/[username]/CEGUI/cegui/cegui/src/DynamicModule.cpp:224) : Failed to
load module 'libCEGUIExpatParser.dylib':
dlopen(/usr/local/lib/cegui-0.8/libCEGUIExpatParser.dylib, 1): image not found
libc++abi.dylib: terminating with uncaught exception of type
CEGUI::GenericException: CEGUI::GenericException in function
'CEGUI::DynamicModule::DynamicModule(const CEGUI::String &)'
(/Users/timmendenhall/CEGUI/cegui/cegui/src/DynamicModule.cpp:224) : Failed to
load module 'libCEGUIExpatParser.dylib':
dlopen(/usr/local/lib/cegui-0.8/libCEGUIExpatParser.dylib, 1): image not found
zsh: abort ./RpgClient.app/Contents/MacOS/RpgClient ''
I've also tried not copying any of the libraries over with that crazy scripts and just let fixup_bundle find it and I generally still get the same dynamicModule issue. I'll sometimes just get a plain Seg Fault when trying to run the executable directly via running it directly in console ./RpgClient.app/Contents/MacOs/RpgClient.
Did I miss some best practices on including CEGUI in a project of your own that is using Cmake and plan on bundling? What can I do as some next steps to try? I'm currently trying a 3rd build of CEGUI with "@rpath" as the install_name and trying to figure out if I can somehow make CMake agree with that now. But, it's giving me issues with trying to use my binary install directory to look up my resources now instead of resources folder like before (using SDL_GetBasePath())
Here's just the essentials of the CEGUI.log from when it does run successfully. Which I can usually do by not running make install and then running the executable directly in console. Opening the App file breaks under most things I've tried still besides my first example of failure above. Which was the closest and most excited I was for having this "work" until I tried another computer haha.
Code: Select all
07/10/2017 05:48:55 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
07/10/2017 05:48:55 (Std) + Crazy Eddie's GUI System - Event log +
07/10/2017 05:48:55 (Std) + (http://www.cegui.org.uk/) +
07/10/2017 05:48:55 (Std) +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
07/10/2017 05:48:55 (Std) CEGUI::Logger singleton created. (0x7fe60d469c90)
07/10/2017 05:48:55 (Std)
07/10/2017 05:48:55 (Std) ********************************************************************************
07/10/2017 05:48:55 (Std) * Important: *
07/10/2017 05:48:55 (Std) * To get support at the CEGUI forums, you must post _at least_ the section *
07/10/2017 05:48:55 (Std) * of this log file indicated below. Failure to do this will result in no *
07/10/2017 05:48:55 (Std) * support being given; please do not waste our time. *
07/10/2017 05:48:55 (Std) ********************************************************************************
07/10/2017 05:48:55 (Std) ********************************************************************************
07/10/2017 05:48:55 (Std) * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
07/10/2017 05:48:55 (Std) ********************************************************************************
07/10/2017 05:48:55 (Std) ---- Version: 0.8.7 (Build: Oct 4 2017 Apple Mac g++ 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37) 64 bit) ----
07/10/2017 05:48:55 (Std) ---- Renderer module is: CEGUI::OpenGL3Renderer - Official OpenGL 3.2 core based renderer module. TextureTarget support enabled via FBO OGL 3.2 core implementation. ----
07/10/2017 05:48:55 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
07/10/2017 05:48:55 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
07/10/2017 05:48:55 (Std) ---- Scripting module is: None ----
07/10/2017 05:48:55 (Std) ********************************************************************************
07/10/2017 05:48:55 (Std) * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM -------- *
07/10/2017 05:48:55 (Std) ********************************************************************************