StarRuler2-Source
StarRuler2-Source copied to clipboard
Any blocker for macOS compilation?
I didn't had time to look and the code and dependencies yet, but I was waiting for ages to play it natively on macOS.
Any blocker anyone already saw before I try to work on a compilation flow for macOs?
Yes, but you'd need to ask one of the devs to give you a thorough breakdown of it. (I only remember that there was something...)
Well, I'll try tonight anyway, looking at dependencies, look like everything will link Ok on Mac. Maybe I'll have to tweaks code then.
Well, if you do get it to work, I know someone who might be interested in getting it. (Assuming he's still interested in the game... it's been a while since I talked to him about it, mostly because I never know when he has access to a Windows machine.)
There shouldn't be any major blockers for compiling on macOS, but the libraries in use had some issues of incompatible behavior, mostly around mouse interactions.
I've got it building on Mac, using brew libraries. Only issue I've found so far is that the mouse is invisible.
TLDR:
- Copy
source/linux
tosource/mac
-
brew install libpng zlib glew freetype libvorbis libogg libopenal gcc cmake
- Replace
gcc-ar
andgcc-ranlib
withar
andranlib
in makefiles- source/os/gcc/Makefile
- source/sound/gcc/
- source/as_addons/gcc/Makefile
- source/libircclient/gcc/Makefile
- source/network/gcc/Makefile
- source/util/gcc/Makefile
- Update brew paths for
libpng
andglew
to match current versions insource/mac/Makefile
- Run
CC=g++-8 make -f source/mac/Makefile compile
- Note, this must be run from top-level directory.
- Run
./bin/osx64/StarRuler2.bin
- SUCCESS
It may be possible to switch from gcc-ar
and gcc-ranlib
to ar
and ranlib
with environment variables (AR=ar
, etc) however I haven't investigated this yet. This would avoid the need to change all the Makefiles.
End TLDR
For more details, the notes I made while working on this are pasted below:
-
Can install most dependencies using brew
-
brew install libpng zlib glew freetype libvorbis libogg libopenal
-
-
Dependencies which can’t be installed may not be strictly necessary
- See Makefile in
./source/linux/
- It appears to already have Mac options and flags!
- See Makefile in
-
Can fix initial Clang issues by setting environment variable
NLTO
to some value- e.g.
NLTO=1 make -f …
- e.g.
-
Next issue appears to be due to the lack of
gcc-ar
in Clang.- This is set and called from
./source/os/gcc/Makefile
- We can either find out what clang uses instead, or switch to GNU gcc
- This is set and called from
-
Suggestion: Try compiling with GNU gcc. See if that fixes anything.
-
CC=g++-8 make -f …
- GNU
gcc
seems very happy until it can’t findgcc-ar
(because brew calls itgcc-ar-8
) - Problem. brew’s version of
gcc-ar
appears to be missingliblto_plugin.so
- Solution? Switch to
ar
instead ofgcc-ar
? - Seems to be working. Need to change in these files:
- source/os/gcc/Makefile
- source/sound/gcc/Makefile
- source/as_addons/gcc/Makefile
- source/libircclient/gcc/Makefile
- source/network/gcc/Makefile
- source/util/gcc/Makefile
- Solution? Switch to
- Otherwise, investigate what’s up with brew’s
gcc-ar…
- Next issue: needs
gcc-ranlib
, but brew’sgcc-ranlib-8
is missingliblto_plugin.so
- Solution? Switch to
ranlib
instead ofgcc-ranlib
?
- Solution? Switch to
- Next issue:
cmake
missing. Install with brew. (brew install cmake
) - Update brew paths for
libpng
andglew
to match current versions insource/mac/Makefile
-
-
Success!!!
-
Now see if we can get it working with CLANG.
Got the game to run on macos as well -- thanks for the steps, @daviewales! Managed to simplify them quite a bit; just copy-paste the below in a terminal window in a directory with the source code.
Can other macos users confirm that the game runs?
# NOTE: ensure dependencies are installed.
# https://brew.sh/
brew install cmake freetype gcc glew libogg libpng libvorbis openal-soft zlib
# NOTE: create symlink aliases for missing executables.
mkdir -p "$HOME/bin"
ln -s "/usr/bin/ar" "$HOME/bin/gcc-ar"
ln -s "/usr/bin/ranlib" "$HOME/bin/gcc-ranlib"
# NOTE: set/add/override compiler and dependency paths.
export CC="g++-8"
export CXXFLAGS="-I$(brew --prefix libpng)/include -I$(brew --prefix glew)/include"
export LDFLAGS="-I$(brew --prefix libpng)/lib -L$(brew --prefix glew)/lib"
# NOTE: build using linux/macos makefile.
# NOTE: just ignore ld warnings about libpng/glew directories not found.
make -f "./source/linux/Makefile" compile
# NOTE: start the game!
./bin/osx64/StarRuler2.bin
The game starts, can click around in the menu, start to the tutorial etcetera. Didn't test gameplay yet.
- The screen seems to be 1/4th of the size of the expected viewport.
- Might it be an issue with @2x/retina displays?
- Perhaps there's an easy enough patch for detecting/fixing it?
- The mouse pointer is visible, but due to the resized graphics the pointer "location" has a 2x scaled offset.
- The game crashes with a segfault upon exit, but it doesn't affect the experience.
./bin/osx64/StarRuler2.bin
terminal output
Initializing sound Initializing window system Loading engine settings Initializing OpenGL Engine Registering mods Starting 9 threads on 8 processors. Loading mod(s) OpenGL vendor 'ATI Technologies Inc.', renderer 'AMD Radeon R9 M370X OpenGL Engine' version '2.1 ATI-1.68.20' Loaded in 1.5 seconds libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile Shadow scripts: 347ms load, 3038ms compile libpng warning: iCCP: known incorrect sRGB profile Client scripts: 366ms load, 7034ms compile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB Server scripts: 341ms load, 8053ms compile Loaded in 8.4 seconds libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile Finished computing hulls in 12841.7msCaught Segfault at 0x0
Stack trace: 0 StarRuler2.bin 0x0000000105c63a0d _Z11print_tracev + 29 1 ??? 0x00000001152f6bbf 0x0 + 4650396607
No active script context to log. Abort trap: 6
Excellent work! I knew there were a lot of ways to streamline it, but just haven't had the time.
I've noticed the retina scaling issue only occurs in windowed mode. But the cursor disappears in full screen mode! So we can't win, without having a serious look at the code.
I suspect we need to think carefully about the glfw
cursor mode.
Have a look at the output of
grep -rI cursor .
(Run from top level directory of project)
On 29 September 2018 2:36:15 am AEST, Joel Purra [email protected] wrote:
Got the game to run on macos as well -- thanks for the steps, @daviewales! Managed to simplify them quite a bit; just copy-paste the below in a terminal window in a directory with the source code.
Can other macos users confirm that the game runs?
# NOTE: ensure dependencies are installed. # https://brew.sh/ brew install cmake freetype gcc glew libogg libpng libvorbis openal-soft zlib # NOTE: create symlink aliases for missing executables. mkdir -p "$HOME/bin" ln -s "/usr/bin/ar" "$HOME/bin/gcc-ar" ln -s "/usr/bin/ranlib" "$HOME/bin/gcc-ranlib" # NOTE: set/add/override compiler and dependency paths. export CC="g++-8" export CXXFLAGS="-I$(brew --prefix libpng)/include -I$(brew --prefix glew)/include" export LDFLAGS="-I$(brew --prefix libpng)/lib -L$(brew --prefix glew)/lib" # NOTE: build using linux/macos makefile. # NOTE: just ignore ld warnings about libpng/glew directories not found. make -f "./source/linux/Makefile" compile # NOTE: start the game! ./bin/osx64/StarRuler2.bin
The game starts, can click around in the menu, start to the tutorial etcetera. Didn't test gameplay yet.
- The screen seems to be 1/4th of the size of the expected viewport.
- Might it be an issue with @2x/retina displays?
- Perhaps there's an easy enough patch for detecting/fixing it?
- The mouse pointer is visible, but due to the resized graphics the pointer "location" has a 2x scaled offset.
- The game crashes with a segfault upon exit, but it doesn't affect the experience.
./bin/osx64/StarRuler2.bin
terminal outputInitializing sound Initializing window system Loading engine settings Initializing OpenGL Engine Registering mods Starting 9 threads on 8 processors. Loading mod(s) OpenGL vendor 'ATI Technologies Inc.', renderer 'AMD Radeon R9 M370X OpenGL Engine' version '2.1 ATI-1.68.20' Loaded in 1.5 seconds libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile Shadow scripts: 347ms load, 3038ms compile libpng warning: iCCP: known incorrect sRGB profile Client scripts: 366ms load, 7034ms compile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB Server scripts: 341ms load, 8053ms compile Loaded in 8.4 seconds libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: known incorrect sRGB profile libpng warning: iCCP: cHRM chunk does not match sRGB libpng warning: iCCP: known incorrect sRGB profile Finished computing hulls in 12841.7msCaught Segfault at 0x0
Stack trace: 0 StarRuler2.bin 0x0000000105c63a0d _Z11print_tracev + 29 1 ??? 0x00000001152f6bbf 0x0 + 4650396607
No active script context to log. Abort trap: 6
-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/BlindMindStudios/StarRuler2-Source/issues/4#issuecomment-425493818