JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.03k stars 614 forks source link

rdsp-vanilla_x86.dylib is not copied to openjk_sp.x86.app #438

Closed kirbysayshi closed 9 years ago

kirbysayshi commented 11 years ago

Basically when I try to compile and run a build, the executable can't find rdsp-vanilla_x86.dylib. If I copy the dylib into openjk_sp.x86.app/Contents/MacOS/, then it works. Am I doing something wrong?

Build steps below:

$ mkdir build && cd build
$ cmake -G 'Unix Makefiles' -DCMAKE_OSX_ARCHITECTURES=i386 -DZLIB_LIBRARY=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libz.dylib -DCMAKE_BUILD_TYPE=Release -DUseInternalPNG=1 ..
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Architecture is x86
Git revision is 8aef52bf89bd477d40f1b6eca00818bd10cdeb4d
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/libz.dylib (found version "1.2.5")
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework
-- Found SDL2: /usr/local/lib/libSDL2main.a;/usr/local/lib/libSDL2.dylib;-framework Cocoa
-- Found OpenAL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenAL.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/drew/GIT/OpenJK/build
$ make -j7

The build appears to succeed (log is here).

I wind up with a few .app files. If I try to run any of them (after copying assets to ~/Library/Application\ Support/JKOpen/base), I get the following output:

$ openjk_sp.x86.app/Contents/MacOS/openjk_sp.x86
OpenJK: v1.0.1.1 macosx-x86 Nov 12 2013
Initialising zone memory .....
----- FS_Startup -----
Current search path:
/Users/drew/Library/Application Support/OpenJK/base/assets6.pk3 (28 files)
/Users/drew/Library/Application Support/OpenJK/base/assets5.pk3 (4 files)
/Users/drew/Library/Application Support/OpenJK/base/assets2.pk3 (289 files)
/Users/drew/Library/Application Support/OpenJK/base/assets1.pk3 (8011 files)
/Users/drew/Library/Application Support/OpenJK/base/assets0.pk3 (6674 files)
/Users/drew/Library/Application Support/OpenJK/base
openjk_sp.x86.app/Contents/MacOS/base
./base

----------------------
15006 files in pk3 files
execing default.cfg
execing openjk_sp.cfg
couldn't exec autoexec_sp.cfg
Running Jedi Academy Mode
----- Client Initialization -----
----- Initializing Renderer ----
Trying to load "rdsp-vanilla_x86.dylib" from "openjk_sp.x86.app/Contents/MacOS"...
Trying to load "rdsp-vanilla_x86.dylib" from "."...
Trying to load "rdsp-vanilla_x86.dylib" from ""...
Loading "rdsp-vanilla_x86.dylib" failed

The files exist:

$ find . | grep vanilla_x86.dylib
./code/rd-vanilla/rdsp-vanilla_x86.dylib
./codemp/rd-vanilla/rd-vanilla_x86.dylib

And if I copy fdsp-vanilla:

$ cp code/rd-vanilla/rdsp-vanilla_x86.dylib openjk_sp.x86.app/Contents/MacOS/
$ openjk_sp.x86.app/Contents/MacOS/openjk_sp.x86
OpenJK: v1.0.1.1 macosx-x86 Nov 12 2013
Initialising zone memory .....
----- FS_Startup -----
Current search path:
/Users/drew/Library/Application Support/OpenJK/base/assets6.pk3 (29 files)
/Users/drew/Library/Application Support/OpenJK/base/assets3.pk3 (16 files)
/Users/drew/Library/Application Support/OpenJK/base/assets2.pk3 (62 files)
/Users/drew/Library/Application Support/OpenJK/base/assets1.pk3 (8320 files)
/Users/drew/Library/Application Support/OpenJK/base/assets0.pk3 (15346 files)
/Users/drew/Library/Application Support/OpenJK/base
openjk_sp.x86.app/Contents/MacOS/base
./base

----------------------
23773 files in pk3 files
execing default.cfg
couldn't exec openjk_sp.cfg
couldn't exec autoexec_sp.cfg
Running Jedi Academy Mode
----- Client Initialization -----
----- Initializing Renderer ----
Trying to load "rdsp-vanilla_x86.dylib" from "openjk_sp.x86.app/Contents/MacOS"...
-------------------------------
----- Client Initialization Complete -----
--- Common Initialization Complete ---
SDL using driver "cocoa"
Initializing OpenGL display
.... (everything else that happens when it runs)
ensiform commented 11 years ago

From what I see it looks like it is supposed to be doing so in the cmake for rdsp. I'm not on mac so I don't know the full logistics of how the app bundles work.

aronkihui commented 11 years ago

I compiled it succefully on Mac, do you put vanilla library in the compiled binary folder? them you must put the sp game library in the base folder. Im playing JA without problems in OSX 10.9.

MazterQyou commented 11 years ago

It indeed does not copy the .dylibs into their right place, you have to put them manually. Not sure if it's how it's intended to be, or it's a bug in cmake rules.

kirbysayshi commented 11 years ago

Ok, I guess I'll take a look at the cmake rules to see if that's suppose to be happening or not? Not too familiar with cmake itself.

I'm writing up some build instructions for mac... aside from needing to manually copy over .dylibs, what other custom things need to happen? Right now I've run the following:

$ mkdir -p ~/Library/Application\ Support/OpenJK
$ cp -r ~/Library/Application\ Support/Steam/SteamApps/common/Jedi\ Academy/SWJKJA.app/Contents/base/ ~/Library/Application\ Support/OpenJK/base/

But my build crashes once I try to start actually playing.

Is there any other documentation on building/running on a mac?

kirbysayshi commented 11 years ago

...And I just found https://github.com/JACoders/OpenJK/wiki/Compilation-guide. Sorry for not looking at the wiki earlier.

Are there any objections to a compilation guide existing within the source, like a COMPILING.md?

aronkihui commented 11 years ago

what OSX version are you using?

kirbysayshi commented 11 years ago

OSX 10.9

Homebrew installed:

ensiform commented 11 years ago

2.0.1 is newest actual stable SDL2, whether its available for you on 10.9 is another story.

We will not be adding any sort of extra compilation guide that describes how to add things to the .app. This should be solved so that its done automatically by CMake.

kirbysayshi commented 11 years ago

I'll look for 2.0.1.

By add a guide, I meant would you be open to me making a COMPILING.md file in a PR, just showing how to get things setup on a mac (and other platforms eventually) quickly. Again, I just found the wiki but I think it's really useful for new people if there is basic documentation close to the source code... I suppose I could just add it to the wiki, but I'd like some peer review first since I wouldn't want to give bad information.

Razish commented 11 years ago

I support moving the current compilation guide to COMPILING.md, and adding any missing Mac steps. Sounds like this issue in particular should be solved too.

kirbysayshi commented 11 years ago

Cool! I'll work on porting the info over and adding my mac stuff, if that's ok.

MazterQyou commented 10 years ago

@kirbysayshi It might crash because you might have not copied libjagame which is a must. Try running OpenJK from Terminal and see what it outputs.

kirbysayshi commented 10 years ago

libjagame? I don't see that file anywhere in my file hierarchy. Do you mean jagamex86.dylib? From the run log, it appears I need to at least copy jagamex86.dylib to a base folder within the build folder.

kirbysayshi commented 10 years ago

Ok, looks like if I manually run:

$ find . -name 'rd*.dylib' | xargs -I{} cp -f {} .
$ mkdir -p base && find code codemp -name '*.dylib' | xargs -I{} cp -f {} ./base/

Then single player loads up! Ideally the make file would copy non rd*.dylibs to openjk{_sp,}.x86.app/Contents/MacOS/base/, and the rd*.dylibs to openjk{_sp,}.x86.app/Contents/MacOS/

Seems like that needs to happen anyway if .app files will ever be available for release as well.

ensiform commented 10 years ago

Its supposed to be happening however the rules in our cmake were never fully finished.

Renderer dylibs should not be in the base or mod folders. Should be at the equivalent of the root directory (which would be where the executable would be under other OS')

xycaleth commented 10 years ago

I looked into this in a bit more detail - the renderer dylibs are only copied into the .app bundle when you do make install. This should be fixed at some point.

kirbysayshi commented 10 years ago

@ensiform That makes sense. In this case I copied them there because I noticed it was looking for it, and that was easier than specifying the proper dylib names and app bundle paths.

@xycaleth make install does indeed copy them into the app bundles, but it also copied all of that (including other build targets) into /usr/local, e.g. my homebrew directory:

$ make install
[ 11%] Built target openjk_sp.x86
[ 30%] Built target jagamex86
[ 42%] Built target rdsp-vanilla_x86
[ 45%] Built target botlib
[ 58%] Built target openjk.x86
[ 70%] Built target openjkded.x86
[ 80%] Built target jampgamex86
[ 86%] Built target cgamex86
[ 88%] Built target uix86
[100%] Built target rd-vanilla_x86
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/./openjk_sp.x86.app
-- Installing: /usr/local/./openjk_sp.x86.app/Contents
-- Installing: /usr/local/./openjk_sp.x86.app/Contents/Info.plist
-- Installing: /usr/local/./openjk_sp.x86.app/Contents/MacOS
-- Installing: /usr/local/./openjk_sp.x86.app/Contents/MacOS/openjk_sp.x86
-- Installing: /usr/local/./openjk_sp.x86.app/Contents/Resources
-- Installing: /usr/local/./openjk_sp.x86.app/Contents/Resources/OpenJK.icns
-- Installing: /usr/local/OpenJK/jagamex86.dylib
-- Installing: /usr/local/openjk_sp.x86.app/Contents/MacOS/rdsp-vanilla_x86.dylib
-- Installing: /usr/local/./openjk.x86.app
-- Installing: /usr/local/./openjk.x86.app/Contents
-- Installing: /usr/local/./openjk.x86.app/Contents/Info.plist
-- Installing: /usr/local/./openjk.x86.app/Contents/MacOS
-- Installing: /usr/local/./openjk.x86.app/Contents/MacOS/openjk.x86
-- Installing: /usr/local/./openjk.x86.app/Contents/Resources
-- Installing: /usr/local/./openjk.x86.app/Contents/Resources/OpenJK.icns
-- Installing: /usr/local/./openjkded.x86
-- Installing: /usr/local/OpenJK/jampgamex86.dylib
-- Installing: /usr/local/OpenJK/cgamex86.dylib
-- Installing: /usr/local/OpenJK/uix86.dylib
-- Installing: /usr/local/openjk.x86.app/Contents/MacOS/rd-vanilla_x86.dylib
kirbysayshi commented 10 years ago

Once I configured the install prefix, I was able to force it to install locally.

But even then, jagamex86.dylib was not copied to a ./base folder.

ensiform commented 10 years ago

@redsaurus kinda just hacked up the support for app bundles, so don't expect it to even remotely be 100% working or perfect ;)

No idea if the game can/will even load it from there anyway.

Ideally this is the expected how it should be in the end whenever this is all sorted:

We haven't finalized if it will copy to base or the OpenJK folder yet. There is some potential issues with mixing and changing the default game folder etc.

openjk_sp.x86.app
openjk_sp.x86.app\Contents
openjk_sp.x86.app\Contents\Info.plist
openjk_sp.x86.app\Contents\MacOS
openjk_sp.x86.app\Contents\PkgInfo
openjk_sp.x86.app\Contents\Resources
openjk_sp.x86.app\Contents\MacOS\base
openjk_sp.x86.app\Contents\MacOS\openjk_sp.x86
openjk_sp.x86.app\Contents\MacOS\rdsp-vanilla_x86.dylib
openjk_sp.x86.app\Contents\MacOS\OpenJK\jagamex86.dylib
openjk_sp.x86.app\Contents\MacOS\base\jagamex86.dylib
openjk_sp.x86.app\Contents\Resources\OpenJK.icns

openjk.x86.app
openjk.x86.app\Contents
openjk.x86.app\Contents\Info.plist
openjk.x86.app\Contents\MacOS
openjk.x86.app\Contents\PkgInfo
openjk.x86.app\Contents\Resources
openjk.x86.app\Contents\MacOS\base
openjk.x86.app\Contents\MacOS\openjk.x86
openjk.x86.app\Contents\MacOS\openjkded.x86
openjk.x86.app\Contents\MacOS\rd-vanilla_x86.dylib
openjk.x86.app\Contents\MacOS\OpenJK\jampgamex86.dylib
openjk.x86.app\Contents\MacOS\OpenJK\cgamex86.dylib
openjk.x86.app\Contents\MacOS\OpenJK\uix86.dylib
openjk.x86.app\Contents\MacOS\base\jampgamex86.dylib
openjk.x86.app\Contents\MacOS\base\cgamex86.dylib
openjk.x86.app\Contents\MacOS\base\uix86.dylib
openjk.x86.app\Contents\Resources\OpenJK.icns
redsaurus commented 9 years ago

When using make install all the correct dylibs are copied into the application bundle now (and have been for a while).

xycaleth commented 9 years ago

Using CPack will also package the renderer dylib in the correct place (in the same way that make install does) so I'm closing this issue.