b3dgs / lionheart-remake

Java remake of Lionheart amiga game
https://lionheart.b3dgs.com
GNU General Public License v3.0
79 stars 7 forks source link

Add sc68 macos support #217

Closed jerellsworth closed 1 year ago

jerellsworth commented 3 years ago

Expected Behavior

Running java -Xverify:none -XX:+UseParallelGC -Xmx256m -Xms256m -Dsun.java2d.uiScale=1.0 -jar lionheart-remake-pc-1.0.0.jar launches the program

Actual Behavior

Error message starting with Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'sc68'

Steps to Reproduce the Problem

Extract on Macos (I'm running Mojave) and run the above command.

I also ran brew install sc68 before launching java. Homebrew did install the library, but it didn't fix the problem

Specifications

BTW This also showed up on SO https://stackoverflow.com/questions/59534141/file-libsc68-dylib-is-missing

DjThunder commented 3 years ago

Just to try if this works:

jerellsworth commented 3 years ago

Thanks for looking into this! Unfortunately, that didn't work either (assuming I'm doing this right)

$ unzip lionheart-remake-pc-1.0.0.jar -d lionheart
$ cd lionheart
$ mv linux-x86-64/ darwin-x86-64
$ cd darwin-x86-64/
$ mv libsc68.so libsc68.dylib
$ cd ../..
$ jar cMf lionheart-remake-darwin.jar -C lionheart .
$ java -Xverify:none -XX:+UseParallelGC -Xmx256m -Xms256m -Dsun.java2d.uiScale=1.0 -jar lionheart-remake-darwin.jar

error message was:

Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
7/3/21, 10:37 AM    INFO: Starting "LionEngine "10.0.0" for "Lionheart Remake 1.0.0"
7/3/21, 10:37 AM    INFO: Class resources = com.b3dgs.lionheart.AppLionheart
Exception in thread "main" com.b3dgs.lionengine.LionEngineException: Error on loading SC68 Library: sc68
    at com.b3dgs.lionengine.audio.sc68.Sc68Format.loadLibrary(Sc68Format.java:79)
    at com.b3dgs.lionengine.audio.sc68.Sc68Format.<init>(Sc68Format.java:107)
    at com.b3dgs.lionheart.AppLionheart.main(AppLionheart.java:42)
Caused by: java.lang.UnsatisfiedLinkError: dlopen(/Users/me/Library/Caches/JNA/temp/jna7628144770551454083.tmp, 9): no suitable image found.  Did find:
    /Users/me/Library/Caches/JNA/temp/jna7628144770551454083.tmp: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    /Users/me/Library/Caches/JNA/temp/jna7628144770551454083.tmp: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    at com.sun.jna.Native.open(Native Method)
    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
    at com.sun.jna.Library$Handler.<init>(Library.java:192)
    at com.sun.jna.Native.load(Native.java:596)
    at com.sun.jna.Native.load(Native.java:570)
    at com.b3dgs.lionengine.audio.sc68.Sc68Format.getLibrary(Sc68Format.java:90)
    at com.b3dgs.lionengine.audio.sc68.Sc68Format.loadLibrary(Sc68Format.java:75)
    ... 2 more
DjThunder commented 3 years ago

Ok so I need to compile it on Mac... I re-uploaded the release, you can download it, it will no longer fail, simply silent music.

jerellsworth commented 3 years ago

Thanks! Where can I download the new version? I think the one the README links to is still the old version.

Also, if you don't have a Mac handy I can try to compile sc68 on my end. It would be helpful if you could let me know how you build it for Linux, since it wasn't obvious to me how you build this library from just poking around https://github.com/Zeinok/sc68

DjThunder commented 3 years ago

Use same link, I just repackaged the same with failsafe library loading. Everything is here about sc68: https://github.com/b3dgs/sc68

jerellsworth commented 3 years ago

running your configure command in https://github.com/b3dgs/sc68/blob/master/README.md and then make in https://sourceforge.net/projects/sc68/ succeeded in building an executable binary, but I can't find a shared library. Is there a weird make target or something?

DjThunder commented 3 years ago

Yes because you also need to compile PortAudio as SC68 (whose are raw library) And then compile the code in my repo (aggregating SC68 and PortAudio to build audio routine as external library). Note: I used eclipse CDT (it just need to import existing project and build, I did not generated makefile...)

This will build THE dynamic library from PortAudio and SC68 static library.

DjThunder commented 3 years ago

I compiled it for win 32bits.

DjThunder commented 3 years ago

@jerellsworth Do you have free time for this task ? I can't make Mac compilation (even virtual machines don't work on my computer with this OS).

What need to be done is

jerellsworth commented 3 years ago

@DjThunder A little bit of progress here:

I was able to configure sc68 and PortAudio. PortAudio required the additional flag --disable-mac-universal.

I attempted to just run make and it worked after running mkdir src/hostapi/skeleton/, but it looks like that only compiles libportaudio.la. sc68's library is absent.

I then attempted to build in eclipse, and got the error: Error: Program "armv7a-linux-androideabi22-clang" not found in PATH PATH=[/usr/bin:/bin:/usr/sbin:/sbin:/home/djthunder/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin]. Maybe there's a way to turn off the android target?

DjThunder commented 3 years ago

Thanks a lot for your time !

DjThunder commented 3 years ago

@jerellsworth Did it worked ?

DjThunder commented 3 years ago

I tried to cross compile, but I'm stuck with missing CoreAudio/CoreAudio.h, of course (portaudio part).

DjThunder commented 2 years ago

@jerellsworth Hello, were you able to test something ? It would be great to make it work on macos for the next release :)

DjThunder commented 1 year ago

@jerellsworth I finally compiled a dylib ! Do you want to test it ?

DjThunder commented 1 year ago

Tested on macos, working !