mstop4 / FMODGMS

🎶 GML bindings to the FMOD Studio low-level API for GM:S and GMS2. Can be used in Windows, macOS, and Linux games.
https://quadolorgames.itch.io/fmodgms
BSD 2-Clause "Simplified" License
62 stars 18 forks source link

Including fmod libraries with ubuntu #16

Closed Grix closed 6 years ago

Grix commented 6 years ago

Hi. I tried running this in ubuntu with the new 64-bit binary release, but when I run either the Test or Starter program, in either YYC or VM, I get the message "Error! FMODGMS was not loaded properly."

This is with an unmodified repo at commit 04818d028db25593cc9c305356ea8cf7d7924acc , and completely fresh ubuntu 16.04 install after only following this guide: https://help.yoyogames.com/hc/en-us/articles/235186168-Setting-Up-For-Ubuntu

Is something else needed to make it work? How can I debug this?

I saw the git wiki page about the ubuntu setup and that you manually had to install fmod libraries locally. Now it works, but that's not very user friendly, the libraries should be included with the extension so that the user doesn't have to do anything IMO, like I set up the mac version to do.

mstop4 commented 6 years ago

I haven't able to get the Demo running with GMS2 on my MacBook Air, neither with YYC or VM, without having to resort to manually installing the FMOD dylibs into /usr/local/lib like I did in Ubuntu. Does the Mac extension still work for you?

I have managed to get the Ubuntu Demo running with libfmod.so included locally in the extension by using a wrapper script, but I'm looking to see if there is another way to do this.

Grix commented 6 years ago

I just tested and indeed it doesn't work, but it seems to be because libfmodL.dylib was removed from the extension. I added it back in and now the Starter demo works for me again (on YYC) with nothing in /usr/local/lib. Don't know what is the difference between libfmod.dylib and libfmodL.dylib but it seems to need both for some reason.

I haven't tried yet but I think it should be possible to use the same technique of modifying the runpath to get it working on ubuntu too. Either with a flag to the compiler, or after it has been compiled using a tool like chrpath or patchelf like mentioned here: https://stackoverflow.com/questions/13769141/can-i-change-rpath-in-an-already-compiled-binary

mstop4 commented 6 years ago

I managed to get the extension wokring on Mac without having to include both libfmod.dylib and libfmodL.dylib. I imported libfmodL.dylib into the extension and then renamed it to libfmod.dylib.

libfmodL.dylib is the development version of the FMOD API library. It contains internal logging functions that are used for debugging but not necessary for production code (it also bloats the size of the library a bit). libfmodgms.dylib should be built using the production library (libfmod.dylib) since that's what it expects. I'll have to look into the Xcode project settings for to see if I can change that.

mstop4 commented 6 years ago

After a lot of experimenting, I managed to get the Ubuntu extension to work with FMOD installed within the extension itself in all cases, at least on my end. You can test it by pull the latest changes from master.

On side note, I managed to get the Mac extension running on the VM in both GM:S 1.4 and GMS 2, but only via "Create executable". It doesn't seem to work at all when I use GM:S 1.4 YYC.

Grix commented 6 years ago

Yes, it seems to work nicely. Thanks!