Author Topic: AGS engine Mac OS X port  (Read 66792 times)

Re: AGS engine Mac OS X port
« Reply #160 on: 05 May 2020, 02:51 »
This is amazing work, Dennis, thank you!  This has been the key to help me port several games to the Mac.

I'm having some issues trying to port another game, so I'm guessing the game might be built using AGS 3.5.0 (or whatever is the most current), so I am trying to follow Dennis's instructions above to download and build AGS 3.5.0.  However, I've encountered a couple of issues.

The first stumbling block was trying to run the sed command against the Makefile:

Code: Adventure Game Studio
  1. cd ags-release-3.5.0/OSX/buildlibs && sed -i -e "s/10\.7/10.14/gi" -e "s/-arch i386 //gi" -e "s/;i386//gi" Makefile && cd -
  2.  
  3. sed: 1: "s/10\.7/10.14/gi": bad flag in substitute command: 'i'

Not sure why this is complaining about the 'i' substitute.  I also tried adding a backslash before the period in "10.14", but this didn't fix the error.  However, I was able to make the updates by opening up the Makefile in a text editor and making the three sets of replacements (change 10.7 to 10.14 and remove the i386 architecture references).

I then moved on to trying to perform the installation, and it appears to have downloaded a bunch of packages, before it failing

Code: Adventure Game Studio
  1. % cd ags-release-3.5.0/OSX/buildlibs && make install && cd -
  2. allegro-4.4.2.tar.gz: OK
  3. dumb-0.9.3.tar.gz: OK
  4. libogg-1.3.2.tar.gz: OK
  5. libtheora-20150828-gfbb2758.tar.bz2: OK
  6. libtheora-20160525-g50df933.tar.bz2: OK
  7. libtremor-20150108-r19427.tar.bz2: OK
  8. libvorbis-1.3.5.tar.gz: OK
  9. lua-5.1.5.tar.gz: OK
  10. ./checkenv.sh
  11. make: *** [prepare] Error 1

If I run checkenv.sh by itself, no error, so perhaps the next step, or perhaps I am missing something with my system.  Any ideas what might be causing this issue?  Thanks for any tips and assistance.


Best regards,

Chad Armstrong

Is MacOS a fairly up-to-date channel? Is it likely that 3.5.0 might be released for MacOS in the next 6mo?

I already built 3.4.4. I can take a look if I can build 3.5.

I currently can't find the time to integrate my changes properly into the repo, but I'm on it.

Kind regards 
Dennis

Re: AGS engine Mac OS X port
« Reply #161 on: 05 May 2020, 07:14 »
Hey chad!

Thanks, happy to help. :)

Ah, I'm sorry. I guess, I used the GNU sed version I installed with Homebrew for the command. BSD's sed, which is installed by default on macOS has no case-insensitive search. But actually, that isn't needed anyways. I updated my post with the correct command. Perhaps you can try to rerun the command?

However, I can not reproduce the error you're getting. I get past that checkenv.sh and later get errors around a missing freetype library:

Code: Adventure Game Studio
  1. ~/Downloads/ags-v.3.5.0.24/OSX/buildlibs ➜  make install  
  2. cd /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/../../libsrc && ./download.sh
  3.  
  4. allegro-4.4.2.tar.gz: https://s3-ap-southeast-2.amazonaws.com/ags-shared/allegro-4.4.2.tar.gz
  5.  
  6.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  7.                                  Dload  Upload   Total   Spent    Left  Speed
  8. 100 4565k  100 4565k    0     0  1002k      0  0:00:04  0:00:04 --:--:-- 1177k
  9.  
  10. dumb-0.9.3.tar.gz: https://s3-ap-southeast-2.amazonaws.com/ags-shared/dumb-0.9.3.tar.gz
  11.  
  12.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  13.                                  Dload  Upload   Total   Spent    Left  Speed
  14. 100  163k  100  163k    0     0  74225      0  0:00:02  0:00:02 --:--:-- 74225
  15.  
  16. libogg-1.3.2.tar.gz: https://s3-ap-southeast-2.amazonaws.com/ags-shared/libogg-1.3.2.tar.gz
  17.  
  18.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  19.                                  Dload  Upload   Total   Spent    Left  Speed
  20. 100  537k  100  537k    0     0   156k      0  0:00:03  0:00:03 --:--:--  156k
  21.  
  22. libvorbis-1.3.5.tar.gz: https://s3-ap-southeast-2.amazonaws.com/ags-shared/libvorbis-1.3.5.tar.gz
  23.  
  24.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  25.                                  Dload  Upload   Total   Spent    Left  Speed
  26. 100 1600k  100 1600k    0     0   481k      0  0:00:03  0:00:03 --:--:--  481k
  27.  
  28. libtheora-20150828-gfbb2758.tar.bz2: https://s3-ap-southeast-2.amazonaws.com/ags-shared/libtheora-20150828-gfbb2758.tar.bz2
  29.  
  30.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  31.                                  Dload  Upload   Total   Spent    Left  Speed
  32. 100  996k  100  996k    0     0   157k      0  0:00:06  0:00:06 --:--:--  224k
  33.  
  34. libtheora-20160525-g50df933.tar.bz2: https://s3-ap-southeast-2.amazonaws.com/ags-shared/libtheora-20160525-g50df933.tar.bz2
  35.  
  36.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  37.                                  Dload  Upload   Total   Spent    Left  Speed
  38. 100  958k  100  958k    0     0   269k      0  0:00:03  0:00:03 --:--:--  269k
  39.  
  40. libtremor-20150108-r19427.tar.bz2: https://s3-ap-southeast-2.amazonaws.com/ags-shared/libtremor-20150108-r19427.tar.bz2
  41.  
  42.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  43.                                  Dload  Upload   Total   Spent    Left  Speed
  44. 100  122k  100  122k    0     0  49498      0  0:00:02  0:00:02 --:--:-- 49478
  45.  
  46. lua-5.1.5.tar.gz: https://s3-ap-southeast-2.amazonaws.com/ags-shared/lua-5.1.5.tar.gz
  47.  
  48.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  49.                                  Dload  Upload   Total   Spent    Left  Speed
  50. 100  216k  100  216k    0     0  93654      0  0:00:02  0:00:02 --:--:-- 93654
  51. allegro-4.4.2.tar.gz: OK
  52. dumb-0.9.3.tar.gz: OK
  53. libogg-1.3.2.tar.gz: OK
  54. libtheora-20150828-gfbb2758.tar.bz2: OK
  55. libtheora-20160525-g50df933.tar.bz2: OK
  56. libtremor-20150108-r19427.tar.bz2: OK
  57. libvorbis-1.3.5.tar.gz: OK
  58. lua-5.1.5.tar.gz: OK
  59. ./checkenv.sh
  60. mkdir -p /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt
  61. mkdir -p /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/build
  62. tar xf /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/../../libsrc/lua-5.1.5.tar.gz -C /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/build
  63. cd /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/build/lua-5.1.5 && \
  64.                 patch -p1 < /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/../patches/lua-5.1.5.patch && \
  65.                 make macosx INSTALL_TOP="/Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt" PLAT_LDFLAGS="-mmacosx-version-min=10.14 -arch x86_64" PLAT_CFLAGS="-mmacosx-version-min=10.14 -arch x86_64" && \
  66.                 make install INSTALL_TOP="/Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt"
  67. patching file src/Makefile
  68. cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make macosx
  69. /Applications/Xcode.app/Contents/Developer/usr/bin/make all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline"
  70. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lapi.o lapi.c
  71. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lcode.o lcode.c
  72. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldebug.o ldebug.c
  73. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldo.o ldo.c
  74. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldump.o ldump.c
  75. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lfunc.o lfunc.c
  76. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lgc.o lgc.c
  77. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o llex.o llex.c
  78. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lmem.o lmem.c
  79. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lobject.o lobject.c
  80. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lopcodes.o lopcodes.c
  81. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lparser.o lparser.c
  82. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstate.o lstate.c
  83. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstring.o lstring.c
  84. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltable.o ltable.c
  85. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltm.o ltm.c
  86. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lundump.o lundump.c
  87. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lvm.o lvm.c
  88. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lzio.o lzio.c
  89. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lauxlib.o lauxlib.c
  90. lauxlib.c:577:61: warning: while loop has empty body [-Wempty-body]
  91.    while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
  92.                                                             ^
  93. lauxlib.c:577:61: note: put the semicolon on a separate line to silence this warning
  94. 1 warning generated.
  95. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lbaselib.o lbaselib.c
  96. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ldblib.o ldblib.c
  97. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o liolib.o liolib.c
  98. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lmathlib.o lmathlib.c
  99. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o loslib.o loslib.c
  100. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o ltablib.o ltablib.c
  101. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lstrlib.o lstrlib.c
  102. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o loadlib.o loadlib.c
  103. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o linit.o linit.c
  104. ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o      # DLL needs all object files
  105. ranlib liblua.a
  106. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o lua.o lua.c
  107. gcc -o lua  -mmacosx-version-min=10.14 -arch x86_64 lua.o liblua.a -lm -lreadline
  108. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o luac.o luac.c
  109. gcc -O2 -Wall -DLUA_USE_LINUX -mmacosx-version-min=10.14 -arch x86_64   -c -o print.o print.c
  110. gcc -o luac  -mmacosx-version-min=10.14 -arch x86_64 luac.o print.o liblua.a -lm -lreadline
  111. cd src && mkdir -p /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/bin /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/include /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/lib /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/man/man1 /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/share/lua/5.1 /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/lib/lua/5.1
  112. cd src && install -p -m 0755 lua luac /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/bin
  113. cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/include
  114. cd src && install -p -m 0644 liblua.a /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/lib
  115. cd doc && install -p -m 0644 lua.1 luac.1 /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/opt/man/man1
  116. tar xf /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/../../libsrc/freetype-2.4.12.tar.bz2 -C /Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/build
  117. tar: Error opening archive: Failed to open '/Users/dennis.ploeger/Downloads/ags-v.3.5.0.24/OSX/buildlibs/../../libsrc/freetype-2.4.12.tar.bz2'
  118. make: *** [freetype] Error 1
  119.  

I guess there's some dependency, that has not been downloaded. Can't check that right now.

Oh, did you perhaps don't have the xcode command line tools installed? I guess, those are required. Please try to run

Code: Adventure Game Studio
  1. xcode-select --install

first and then try again.

Kind regards
Dennis
deep

Re: AGS engine Mac OS X port
« Reply #162 on: 05 May 2020, 07:37 »
Oh, to solve the freetype error you have to download https://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2 to the libsrc directory.
deep

Re: AGS engine Mac OS X port
« Reply #163 on: 06 May 2020, 16:01 »
Thanks for the quick response, Dennis!

I forgot to mention (even though I thought about it while writing the original post) to mention that I am running macOS 10.14.6 using the built in Bash shell.  That you are using a custom version of sed explains the the first issue.

Yes, I have Xcode installed, and I verified that the path looks good.

I don't have freetype, most likely, so that's the next step I'll take.

Best regards,

Chad Armstrong

Oh, to solve the freetype error you have to download https://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.bz2 to the libsrc directory.
« Last Edit: 07 May 2020, 01:18 by edenwaith »

Re: AGS engine Mac OS X port
« Reply #164 on: 06 May 2020, 18:53 »
Suuuuccess!

I compiled 3.5.0.24 and completely without xcode. Only a few fixes finished and I could play an advjam20-game without problems (so far).

So add freetype like I commented earlier. Also, in Engine/Makefile-defs.osx, add ../Common/libsrc/alfont-2.0.9 to INCDIR in the fourth line.

Then, in the main root run

Code: Adventure Game Studio
  1. make --directory Engine

After that you can find the engine binary as ags in the Engine subfolder.

I have recompiled my App container. You can download it here:

https://drive.google.com/file/d/1f3pt_e1lRoqmkJYqrdU-DwQFxwExv2F9/view?usp=sharing

Without XCode I now have means on how to easily compile the engine and will send a PR on github in the next days.

Dennis
deep

Re: AGS engine Mac OS X port
« Reply #165 on: 06 May 2020, 21:09 »
Aaand here's the PR: https://github.com/adventuregamestudio/ags/pull/1063

That should fix the OSX build for now and hopefully newer versions.
deep

Re: AGS engine Mac OS X port
« Reply #166 on: 07 May 2020, 01:22 »
Awesome work, Dennis.  I'll test these out and see how things run.


Aaand here's the PR: https://github.com/adventuregamestudio/ags/pull/1063

That should fix the OSX build for now and hopefully newer versions.

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: AGS engine Mac OS X port
« Reply #167 on: 07 May 2020, 14:41 »
Time to beg!  :=
Do you think you guys could upload the 3.5.0.x engine executable for MacOS somewhere? And since you're there, maybe also the Linux one? (I'm guessing they're not too different but maybe I'm wrong).
Asking for my personal sanity. The learning curve for compiling on Mac is just too much.
 


Re: AGS engine Mac OS X port
« Reply #169 on: 08 May 2020, 04:58 »
I tried the latest version of the AGS shell app.

The Good:
• It worked with an AGS 3.5.0 game I was trying to port.

The Bad:
• macOS Catalina only (a macOS Mojave build would be nice, I'll see if I can get that working)
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.

Re: AGS engine Mac OS X port
« Reply #170 on: 08 May 2020, 10:41 »
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.


I swear, this happens all the time. Each 2-3 years someone fixes it, and then it appears again.

There are two places where color conversions are mentioned, first: https://github.com/adventuregamestudio/ags/blob/master/Engine/main/engine_setup.cpp#L185
and second this bitmap->video mem conversion: https://github.com/adventuregamestudio/ags/blob/master/Engine/gfx/gfxdriverbase.cpp#L314

Re: AGS engine Mac OS X port
« Reply #171 on: 08 May 2020, 19:22 »
• macOS Catalina only (a macOS Mojave build would be nice, I'll see if I can get that working)
• Some of the colors in the game were inverted.  Not sure if it is the game, the engine, or some combo.  I'll need to do some research.

Could you try it with the CMake build instead, the colour issues were already meant to be fixed.

The build instructions are one page back on this same topic:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=47264.msg636611972#msg636611972
Or you can download a binary from here:
https://cirrus-ci.com/task/5955130990264320

Monsieur OUXX

  • Mittens Vassal
  • Cavefish
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: AGS engine Mac OS X port
« Reply #172 on: 18 May 2020, 09:57 »
I'm still interested in the MacOS executable though, even with the colors issue  :=
I can act as a tester if you guys wish.