ptitSeb / box86

Box86 - Linux Userspace x86 Emulator with a twist, targeted at ARM Linux devices
https://box86.org
MIT License
3.31k stars 227 forks source link

Steam and KSP #273

Closed Pythonic456 closed 2 years ago

Pythonic456 commented 3 years ago

Is there a way to run KSP in Steam (with box86) as 32 bit? I know it's not much of an issue with box86, but was wondering if you could, I remember reading a thread on a forum a while ago about someone doing that on a mac...

Thanks in advance!

ptitSeb commented 3 years ago

I haven't tried myself, but I have seen it may start. It seems very slow to load, so not sure it's completly playable yet.

Pythonic456 commented 3 years ago

So it can run as 32-bit? How do I make it do that?

ptitSeb commented 3 years ago

You need an old version that still support 32bits I guess.

Itai-Nelken commented 3 years ago

1.4.5 is the oldest version that supports 32bit

Pythonic456 commented 3 years ago

Can you get that on Steam? Or how else?

Pythonic456 commented 3 years ago

Ah okay, you just use 1.4.3. This happens when running the executable:

Box86 with Dynarec v0.1.9 a3b0149a built on Dec 19 2020 19:34:02
Set current directory to /home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program
Found path: /home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP.x86
Error: Global Symbol data_start not found, cannot apply R_386_GLOB_DAT @0xadcd9b68 ((nil)) in /home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP_Data/Mono/x86/libmono.so
Error: Global Symbol __data_start not found, cannot apply R_386_GLOB_DAT @0xadcd9d44 ((nil)) in /home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP_Data/Mono/x86/libmono.so
Mono path[0] = '/home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP_Data/Managed'
Mono config path = '/home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Player data archive not found at `/home/pi/.local/share/Steam/steamapps/common/Kerbal Space Program/KSP_Data/data.unity3d`, using local filesystem
PlayerPrefs - Creating folder: /home/pi/.config/unity3d/Squad/Kerbal Space Program
Logging to /home/pi/.config/unity3d/Squad/Kerbal Space Program/Player.log
Segmentation fault

Running the Launcher.x86 just aborts

Itai-Nelken commented 3 years ago

more or less same with me, a black window opens but closes after about 30 seconds with no errors.

Pythonic456 commented 3 years ago

@ptitSeb You said you've seen it running, can you remember where you saw it doing that please?

Thanks :)

ptitSeb commented 3 years ago

I think it was phoenixbrd user on the discord channel. I don't remember well. I'll check later that game, but I'm some other bug for now.

Itai-Nelken commented 3 years ago

@Pythonic456 I fixed KSP not starting for me by downgrading to mesa 20.2. here are the commands if you need:

git clone https://gitlab.freedesktop.org/mesa/mesa
cd mesa
git checkout 20.2
mkdir build
meson --prefix /usr -Dplatforms=x11 -Dvulkan-drivers= -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4,virgl -Dbuildtype=release build
ninja -C build
sudo ninja -C build install 

Hope this helps!

Pythonic456 commented 3 years ago

meson --prefix /usr -Dplatforms=x11 -Dvulkan-drivers= -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4,virgl -Dbuildtype=release build aborts with this error: meson.build:21:0: ERROR: Meson version is 0.49.2 but project requires >= 0.52.

Thanks for your help.

ptitSeb commented 3 years ago

Don't use the meson from apt (so sudo apt remove meson probaly) but the one from python: pip3 install meson Check google for more details.

Pythonic456 commented 3 years ago

Okay, now it does this:

The Meson build system
Version: 0.56.0
Source dir: /home/pi/mesa
Build dir: /home/pi/mesa/build
Build type: native build
Program python3 found: YES (/usr/bin/python3)
Project name: mesa
Project version: 20.2.6

...

Dependency expat from subproject subprojects/expat-2.2.5 found: YES 2.2.5
Library m found: YES
Run-time dependency libdrm found: NO 

meson.build:1423:0: ERROR: Pkg-config binary for machine MachineChoice.HOST not found. Giving up.

A full log can be found at /home/pi/mesa/build/meson-logs/meson-log.txt
root@raspberrypi44g:/home/pi/mesa#

Thanks for your help.

Heasterian commented 3 years ago

Did you try sudo apt install --reinstall pkg-config?

Pythonic456 commented 3 years ago

Now it does this:

Run-time dependency libdrm found: NO (tried pkgconfig and cmake)

meson.build:1423:0: ERROR: Dependency "libdrm" not found, tried pkgconfig and cmake

A full log can be found at /home/pi/mesa/build/meson-logs/meson-log.txt
root@raspberrypi44g:/home/pi/mesa# 

Thanks for your help.

Itai-Nelken commented 3 years ago

Now it does this:

Run-time dependency libdrm found: NO (tried pkgconfig and cmake)

meson.build:1423:0: ERROR: Dependency "libdrm" not found, tried pkgconfig and cmake

A full log can be found at /home/pi/mesa/build/meson-logs/meson-log.txt
root@raspberrypi44g:/home/pi/mesa# 

Thanks for your help.

@Pythonic456 try this:

sudo apt install libdrm
Heasterian commented 3 years ago

Go for sudo apt build-dep mesa and sudo apt install libxcb-shm0-dev. It should install all dependencies.

Pythonic456 commented 3 years ago

Thank you for your continuing help.

Now it does this when running the KSP.x86 executable:

Box86 with Dynarec v0.1.9 591bafe8 built on Dec 23 2020 13:44:14
No protocol specified
Set current directory to /home/pi/ksp/KerbalSpaceProgram
Found path: /home/pi/ksp/KerbalSpaceProgram/KSP.x86
Error: Global Symbol data_start not found, cannot apply R_386_GLOB_DAT @0xb2e49b68 ((nil)) in /home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Error: Global Symbol __data_start not found, cannot apply R_386_GLOB_DAT @0xb2e49d44 ((nil)) in /home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Mono path[0] = '/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Managed'
Mono config path = '/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Player data archive not found at `/home/pi/ksp/KerbalSpaceProgram/KSP_Data/data.unity3d`, using local filesystem
Logging to /root/.config/unity3d/Squad/Kerbal Space Program/Player.log
No protocol specified
Stacktrace:

Native stacktrace:

    /usr/local/bin/box86() [0x628b25d0]
    /usr/local/bin/box86() [0x628a03d0]
    /usr/local/bin/box86() [0x6286c29c]
    /usr/local/bin/box86() [0x62868de4]
    /usr/local/bin/box86() [0x628a75f0]
    /usr/local/bin/box86() [0x628a7d14]
    /usr/local/bin/box86() [0x628a836c]
    /lib/arm-linux-gnueabihf/libc.so.6(__default_rt_sa_restorer+0) [0xb6d2d130]

Debug info from gdb:

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted
root@raspberrypi44g:/home/pi/ksp/KerbalSpaceProgram# 

Some info on this setup:

I'm doing this in a chroot, on a RPi 4B, (I'm just using the chroot to contain it), and here's the command I used to create this chroot: sudo debootstrap --variant=minbase buster rpios http://raspbian.raspberrypi.org/raspbian/ I was just thinking that the --variant=minbase might have not installed some libs and things, so I was wondering if this is the cause of the errors?

When running the Launcher.x86, this happens:

Box86 with Dynarec v0.1.9 591bafe8 built on Dec 23 2020 13:44:14
No protocol specified
7527|SIGSEGV @0xb5aaba7c (???(/lib/arm-linux-gnueabihf/libX11.so.6/0xb5aaba7c)) (x86pc=0x635d537b/???:"???", esp=0xb636a11c), for accessing 0x84 (code=1/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???)
Segmentation fault
root@raspberrypi44g:/home/pi/ksp/KerbalSpaceProgram# 
Pythonic456 commented 3 years ago

What do I need to do next?

Thanks :)

Pythonic456 commented 3 years ago

@Itai-Nelken Can you describe exactly how you got it to work?

Thanks!

Itai-Nelken commented 3 years ago

@Pythonic456 it never really worked for me, the farthest I got is the 'new game' menu after downgrading to mesa 20.2, than it crashed. now it opening it a black window appears for a few seconds and disappears without any errors. when it did work, it took over a hour to load, but rpinews says it should take a few minutes to load, so I have no idea what is happening and why it isn't loading properly.

Pythonic456 commented 3 years ago

Do you think it is possible for it to work though?

Thanks :)

Itai-Nelken commented 3 years ago

Do you think it is possible for it to work though?

@Pythonic456 rpinews and phoenixbyrd say it runs.

for me it aborts here:

Importing game controller configs
Aborted
Pythonic456 commented 3 years ago

Same for me.

Thanks anyway.

ptitSeb commented 3 years ago

Yeah, I also have the Abort message on my side. I'll see if I can debug it, but no promesses, unity games are still difficult to debug.

Pythonic456 commented 3 years ago

Thanks :+1:

Itai-Nelken commented 3 years ago

Thanks!

ptitSeb commented 3 years ago

image I got the old Linux 32bits version to works. Here in a 800x600 Windows on Pi4/TwisterOS. (It does segfault at exit, but game itself seems to run). I haven't tried the Steam/Windows version yet.

Pythonic456 commented 3 years ago

So you have to use TwisterOS?

Thanks :)

ptitSeb commented 3 years ago

So you have to use TwisterOS?

I don't know, I don't test on twenty thousand OS.... I just tested on TwisterOS. I assume it can work elsewhere, as long as you have box86 and a good build of mesa.

Pythonic456 commented 3 years ago

Do I need gl4es? The KSP log:

Box86 with Dynarec v0.1.9 eca39e6a built on Jan  1 2021 18:57:07
Found path: /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP.x86
Error: Global Symbol data_start not found, cannot apply R_386_GLOB_DAT @0xb1e1db68 ((nil)) in /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Error: Global Symbol __data_start not found, cannot apply R_386_GLOB_DAT @0xb1e1dd44 ((nil)) in /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Mono path[0] = '/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Managed'
Mono config path = '/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Player data archive not found at `/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/data.unity3d`, using local filesystem
Logging to /home/pi/.config/unity3d/Squad/Kerbal Space Program/Player.log
(rpios)pi@raspberrypi44g:~/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram $ cat "/home/pi/.config/unity3d/Squad/Kerbal Space Program/Player.log" 
Desktop is 1920 x 1080 @ 60 Hz
Unable to find a supported OpenGL core profile
Failed to create valid graphics context: please ensure you meet the minimum requirements
E.g. OpenGL core profile 3.2 or later for OpenGL Core renderer
No supported renderers found, exiting

(Filename:  Line: 542)

(rpios)pi@raspberrypi44g:~/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram $  

Thanks :)

ptitSeb commented 3 years ago

It's not the same version I used. This one required an OpenGL 3.3 driver. gl4es will not help, it support only 2.1. Try with MESA_GL_VERSION_OVERRIDE=3.3 but at this point, it's not a box86 it's just the RPi4 beeing too weak for this game.

Pythonic456 commented 3 years ago

Okay, it does this now:

Box86 with Dynarec v0.1.9 eca39e6a built on Jan  1 2021 18:57:07
Found path: /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP.x86
Error: Global Symbol data_start not found, cannot apply R_386_GLOB_DAT @0xb1dd3b68 ((nil)) in /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Error: Global Symbol __data_start not found, cannot apply R_386_GLOB_DAT @0xb1dd3d44 ((nil)) in /home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/x86/libmono.so
Mono path[0] = '/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Managed'
Mono config path = '/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Preloaded 'ScreenSelector.so'
Preloaded 'libCSteamworks.so'
Preloaded 'libkeyboard.so'
Preloaded 'liblingoona.grammar.kerbal.so'
Preloaded 'libsteam_api.so'
Player data archive not found at `/home/pi/chroots/32-bit-x86/rpios/home/pi/ksp/KerbalSpaceProgram/KSP_Data/data.unity3d`, using local filesystem
Logging to /home/pi/.config/unity3d/Squad/Kerbal Space Program/Player.log
munmap_chunk(): invalid pointer
Stacktrace:

Native stacktrace:

    box86() [0x628b3910]
    box86() [0x628a1800]
    box86() [0x6286b1ec]
    box86() [0x62868d58]
    box86() [0x628a8a70]
    box86() [0x628a91a0]
    /lib/arm-linux-gnueabihf/libc.so.6(__default_rt_sa_restorer+0) [0xb6d34130]

Debug info from gdb:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Aborted

You said you didn't use this same version?

Thanks :)

ptitSeb commented 3 years ago

Yes, 1.2.2 something.

Pythonic456 commented 3 years ago

Okay... How do I get that version from Steam if the Properties button doesn't work?

Thanks for your help :)

ptitSeb commented 3 years ago

I don't know. I didn't got it from steam.

Pythonic456 commented 3 years ago

Did you get it from the KSP Store?

Thanks for your continuing help :)

ptitSeb commented 3 years ago

No. I have the game on my Steam colleciton but I haven't found any practical way to get a working Linux version.

ptitSeb commented 3 years ago

I also tried in BigPicture mode but I didn't saw any way to choose version to install there. The download of data is really unstable for now on Steam/Box86, so until I found something, I'm unsure steam is the way to go (pretty sure it's not).

Pythonic456 commented 3 years ago

It kinda works now! I only had two problems, one of which makes it very hard to play as normal:

Did the terrian not load for you either? 2021-01-02-124922_1920x1080_scrot 2021-01-02-124916_1920x1080_scrot 2021-01-02-125244_1920x1080_scrot Thanks for your help :)

Itai-Nelken commented 3 years ago

@Pythonic456 how did you get it working? and what version of the game?

ptitSeb commented 3 years ago

@Pythonic456 it's not a box86 issue, but a mesa one. Using Mesa 20.2 I get you rendering: I have roads but no landscape. The terrain is absent. Using 20.3 I have terrain (but roads seems to not be drawn all the time).

Pythonic456 commented 3 years ago

@Itai-Nelken I did it in a chroot with schroot, so here you go: sudo debootstrap buster rpios_ksp http://raspbian.raspberrypi.org/raspbian/ Then use schroot -c rpios_ksp -p to get into the chroot and then downgrade mesa to 20.2 or 20.3 https://github.com/ptitSeb/box86/issues/273#issuecomment-753512177 https://github.com/ptitSeb/box86/issues/273#issuecomment-749134365 and then compile and install box86 in the chroot, then run the 1.2.2 KSP.x86 file. Happy to help :)

Itai-Nelken commented 3 years ago

@Pythonic456 thanks a lot!

Botspot commented 3 years ago

@Pythonic456 Amazing! You've got to come to the Pi-Apps repo and make us some install scripts! :)

Botspot commented 3 years ago

@Itai-Nelken I did it in a chroot with schroot, so here you go: sudo debootstrap buster rpios_ksp http://raspbian.raspberrypi.org/raspbian/ Then use schroot -c rpios_ksp -p to get into the chroot and then downgrade mesa to 20.2 or 20.3 #273 (comment) #273 (comment) and then compile and install box86 in the chroot, then run the 1.2.2 KSP.x86 file. Happy to help :)

I'm having trouble... Any ideas?

pi@raspberrypi:~ $ schroot -c rpios_ksp -p
W: No chroots are defined in ‘/etc/schroot/schroot.conf’ or ‘/etc/schroot/chroot.d’
E: rpios_ksp: Chroot not found

And yes, ~/rpios_ksp exists and is full of files.

Itai-Nelken commented 3 years ago

@Itai-Nelken I did it in a chroot with schroot, so here you go: sudo debootstrap buster rpios_ksp http://raspbian.raspberrypi.org/raspbian/ Then use schroot -c rpios_ksp -p to get into the chroot and then downgrade mesa to 20.2 or 20.3 #273 (comment) #273 (comment) and then compile and install box86 in the chroot, then run the 1.2.2 KSP.x86 file. Happy to help :)

I'm having trouble... Any ideas?

pi@raspberrypi:~ $ schroot -c rpios_ksp -p
W: No chroots are defined in ‘/etc/schroot/schroot.conf’ or ‘/etc/schroot/chroot.d’
E: rpios_ksp: Chroot not found

And yes, ~/rpios_ksp exists and is full of files.

I have the same problem.

Pythonic456 commented 3 years ago

Yes, edit /etc/schroot/schroot.conf (you will need to be root), and add this to the end:


[rpios]
type=directory
directory=/home/pi/rpios_ksp/
groups=pi

You will need a newline before and after this. Hope this helps!

Itai-Nelken commented 3 years ago

@Pythonic456 Thanks a lot again!

Itai-Nelken commented 3 years ago

Chroot still isn't working for me, but KSP 1.2.2 does run (box86 compiled on 31/12/2020, mesa 20.2) the terain doesn't load as was already said, but it is playable, especially after you arrive in space. It also randomly crashes sometimes, but otherwise is pretty stable.

20210104_153139.jpg 20210104_152959.jpg 20210104_154424.jpg