ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.81k stars 273 forks source link

factorio on RISC-V gives error (string to int) #665

Closed Opvolger closed 9 months ago

Opvolger commented 1 year ago

Hi, First of all, I think this is a top product. I recently got a RISC-V SBC with an external GPU (M2 to PCI-e). And compiled some games:

I have the error below. Looks like a rounding error? 1.1 != 1 ? 1.1 can never be an int.

Can I enable the DEBUG option (with compile, or with starting box64?) so that I can include more information?

As you can see, I have compiled the master branch, not a release tag.

box64 bin/x64/factorio 
Dynarec for RISC-V PageSize:4096 Running on unknown riscv64 cpu with 4 Cores
Params database has 22 entries
Box64 with Dynarec v0.2.3 8ec00e90 built on Apr  3 2023 17:18:41
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 71 Env var
Looking for bin/x64/factorio
Apply RC params for factorio
Applying BOX64_DYNAREC_BIGBLOCK=2
Applying BOX64_DYNAREC_FASTROUND=0
Applying BOX64_DYNAREC_SAFEFLAGS=0
Applying BOX64_DYNAREC_CALLRET=1
Appling BOX64_DYNAREC_FORWARD=1024
Rename process to "factorio"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libresolv.so.2
Using native(wrapped) libX11.so.6
Using native(wrapped) libXext.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libGL.so.1
Using native(wrapped) libXinerama.so.1
Using native(wrapped) libXrandr.so.2
Using native(wrapped) libXrender.so.1
Using native(wrapped) libXcursor.so.1
Using native(wrapped) libasound.so.2
Using native(wrapped) libpulse.so.0
Using native(wrapped) libpulse-simple.so.0
Using native(wrapped) libm.so.6
Look for __res_nquery in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fba8888f0
Look for __dn_expand in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fba88293c
   0.005 2023-04-04 18:28:46; Factorio 1.1.80 (build 60618, linux64, full)
   0.039 Operating system: Linux (Ubuntu 23.04)
   0.046 Program arguments: "/home/ubuntu/factorio/bin/x64/factorio" 
   0.047 Config path: /home/ubuntu/factorio/config/config.ini
   0.048 Read data path: /home/ubuntu/factorio/data
   0.049 Write data path: /home/ubuntu/factorio [58579/75086MB]
   0.049 Binaries path: /home/ubuntu/factorio/bin
   0.589 System info: [CPU:           Box64 on unknown riscv64 cpu @1000 MHz, 4 cores, RAM: 7896 MB]
   0.593 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=plasma XDG_SESSION_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.601 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Using native(wrapped) libXi.so.6
Using native(wrapped) libXfixes.so.3
Using native(wrapped) libXss.so.1
Using native(wrapped) libXxf86vm.so.1
   0.740 Available displays: 1
   0.742  [0]: MD20491 24" - {[0,0], 1920x1080, SDL_PIXELFORMAT_RGB888, 60Hz}
   1.446 Initialised OpenGL:[0] AMD Radeon R9 200 Series (hawaii, LLVM 15.0.7, DRM 3.42, 5.15.0-dirty); driver: 4.6 (Core Profile) Mesa 23.0.1
   1.447   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   1.448   [Version] 4.6
   1.454 Graphics settings preset: very-high
   1.454   Dedicated video memory size 4096 MB
   1.949 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
   1.951                   [Max threads (load/render): 32/4] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
   2.043 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
   3.735 Error Util.cpp:83: Failed to load mod "base": Failed to fully parse string to int: '1.1'
  10.843 Goodbye
ptitSeb commented 1 year ago

Not sure what OS you are using, but on my VisionFive2 with default mini Debian image, I needed to install Locales to have things workings. It might be an issue like that.

I cannot test on my side as I don't have an m2-PCIe bridge, nor any small enough radeon card, and GL4ES is not enough for Factorio (I tried already).

Opvolger commented 1 year ago

I am running Ubuntu 23.04. I get a loading screen and a dialog Error. So graphical output is already working...

ptitSeb commented 1 year ago

There have been a lot of fixes on the float part of stuff, can you retry now?

Opvolger commented 1 year ago

Tried it, the demo load (untill 30%, it was crash on start (segment error). So it is much inprovement!) but the full version still crash with the smae error.

ubuntu@ubuntu:~/factorio$ box64 bin/x64/factorio
Dynarec for RISC-V PageSize:4096 Running on unknown riscv64 cpu with 4 Cores
Params database has 22 entries
Box64 with Dynarec v0.2.3 14bcdee7 built on Apr  9 2023 22:29:04
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 71 Env var
Looking for bin/x64/factorio
Apply RC params for factorio
Applying BOX64_DYNAREC_BIGBLOCK=2
Applying BOX64_DYNAREC_FASTROUND=0
Applying BOX64_DYNAREC_SAFEFLAGS=0
Applying BOX64_DYNAREC_CALLRET=1
Appling BOX64_DYNAREC_FORWARD=1024
Rename process to "factorio"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libresolv.so.2
Using native(wrapped) libX11.so.6
Using native(wrapped) libXext.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libGL.so.1
Using native(wrapped) libXinerama.so.1
Using native(wrapped) libXrandr.so.2
Using native(wrapped) libXrender.so.1
Using native(wrapped) libXcursor.so.1
Using native(wrapped) libasound.so.2
Using native(wrapped) libpulse.so.0
Using native(wrapped) libpulse-simple.so.0
Using native(wrapped) libm.so.6
Look for __res_nquery in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3f9d4f08f0
Look for __dn_expand in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3f9d4ea93c
   0.016 2023-04-10 20:52:52; Factorio 1.1.80 (build 60618, linux64, full)
   0.069 Operating system: Linux (Ubuntu 23.04)
   0.076 Program arguments: "/home/ubuntu/factorio/bin/x64/factorio"
   0.076 Config path: /home/ubuntu/factorio/config/config.ini
   0.078 Read data path: /home/ubuntu/factorio/data
   0.080 Write data path: /home/ubuntu/factorio [55220/76424MB]
   0.080 Binaries path: /home/ubuntu/factorio/bin
   1.160 System info: [CPU:           Box64 on unknown riscv64 cpu @1000 MHz, 4 cores, RAM: 7921 MB]
   1.167 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=plasma XDG_SESSION_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   1.186 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Using native(wrapped) libXi.so.6
Using native(wrapped) libXfixes.so.3
Using native(wrapped) libXss.so.1
Using native(wrapped) libXxf86vm.so.1
   1.440 Available displays: 1
   1.443  [0]: MD20491 24" - {[0,0], 1920x1080, SDL_PIXELFORMAT_RGB888, 60Hz}
   2.718 Initialised OpenGL:[0] AMD Radeon R9 200 Series (hawaii, LLVM 15.0.7, DRM 3.42, 5.15.0+); driver: 4.6 (Core Profile) Mesa 23.0.1
   2.720   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   2.720   [Version] 4.6
   2.739 Graphics settings preset: very-high
   2.739   Dedicated video memory size 4096 MB
   3.733 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
   3.737                   [Max threads (load/render): 32/4] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
   3.964 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
   9.912 Error Util.cpp:83: Failed to load mod "base": Failed to fully parse string to int: '1.1'
  16.137 Goodbye
ubuntu@ubuntu:~/factorio$ cd ../factorio_demo/
ubuntu@ubuntu:~/factorio_demo$ box64 bin/x64/factorio
Dynarec for RISC-V PageSize:4096 Running on unknown riscv64 cpu with 4 Cores
Params database has 22 entries
Box64 with Dynarec v0.2.3 14bcdee7 built on Apr  9 2023 22:29:04
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 71 Env var
Looking for bin/x64/factorio
Apply RC params for factorio
Applying BOX64_DYNAREC_BIGBLOCK=2
Applying BOX64_DYNAREC_FASTROUND=0
Applying BOX64_DYNAREC_SAFEFLAGS=0
Applying BOX64_DYNAREC_CALLRET=1
Appling BOX64_DYNAREC_FORWARD=1024
Rename process to "factorio"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libresolv.so.2
Using native(wrapped) libX11.so.6
Using native(wrapped) libXext.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libGL.so.1
Using native(wrapped) libXinerama.so.1
Using native(wrapped) libXrandr.so.2
Using native(wrapped) libXrender.so.1
Using native(wrapped) libXcursor.so.1
Using native(wrapped) libasound.so.2
Using native(wrapped) libpulse.so.0
Using native(wrapped) libpulse-simple.so.0
Using native(wrapped) libm.so.6
Look for __res_nquery in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fa6f4f8f0
Look for __dn_expand in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fa6f4993c
   0.012 2023-04-10 20:53:30; Factorio 1.1.76 (build 60350, linux64, demo)
   0.054 Operating system: Linux (Ubuntu 23.04)
   0.061 Program arguments: "/home/ubuntu/factorio_demo/bin/x64/factorio"
   0.062 Config path: /home/ubuntu/factorio_demo/config/config.ini
   0.063 Read data path: /home/ubuntu/factorio_demo/data
   0.065 Write data path: /home/ubuntu/factorio_demo [55220/76424MB]
   0.066 Binaries path: /home/ubuntu/factorio_demo/bin
   1.091 System info: [CPU:           Box64 on unknown riscv64 cpu @1000 MHz, 4 cores, RAM: 7921 MB]
   1.096 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=plasma XDG_SESSION_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   1.118 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Using native(wrapped) libXi.so.6
Using native(wrapped) libXfixes.so.3
Using native(wrapped) libXss.so.1
Using native(wrapped) libXxf86vm.so.1
   1.372 Available displays: 1
   1.376  [0]: MD20491 24" - {[0,0], 1920x1080, SDL_PIXELFORMAT_RGB888, 60Hz}
   2.753 Initialised OpenGL:[0] AMD Radeon R9 200 Series (hawaii, LLVM 15.0.7, DRM 3.42, 5.15.0+); driver: 4.6 (Core Profile) Mesa 23.0.1
   2.754   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   2.755   [Version] 4.6
   2.779 Graphics settings preset: very-high
   2.780   Dedicated video memory size 4096 MB
   3.699 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
   3.703                   [Max threads (load/render): 32/4] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
   3.856 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
   9.180 Loading mod core 0.0.0 (data.lua)
  14.816 Loading mod base 1.1.76 (data.lua)
  27.505 Loading mod base 1.1.76 (data-updates.lua)
  39.590 Checksum for core: 870127790
  39.591 Checksum of base: 3784111176
  62.391 Error SDLWindow.cpp:508: SDL_CreateColorCursor(selection-tool-cursor) failed: Unknown pixel format
  92.608 Prototype list checksum: 3034860339
  95.790 Loading sounds...
  98.990 Info PlayerData.cpp:73: Local player-data.json unavailable
  98.991 Info PlayerData.cpp:78: Cloud player-data.json unavailable
 111.957 Crop bitmaps.
 153.868 Parallel Sprite Loader initialized (threads: 3)
malloc(): invalid size (unsorted)
malloc(): invalid size (unsorted)
Opvolger commented 1 year ago

We're a lot further along. Game now loads completely, but after 100% it comes with the following error

$ box64 bin/x64/factorio 
Dynarec for RISC-V With extension: I M A F D C Zba Zbb PageSize:4096 Running on unknown riscv64 cpu with 4 Cores
Params database has 25 entries
Box64 with Dynarec v0.2.3 61f14ffb built on May 12 2023 18:47:13
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 71 Env var
Looking for bin/x64/factorio
Apply RC params for factorio
Applying BOX64_DYNAREC_BIGBLOCK=2
Applying BOX64_DYNAREC_FASTROUND=0
Applying BOX64_DYNAREC_SAFEFLAGS=0
Applying BOX64_DYNAREC_CALLRET=1
Appling BOX64_DYNAREC_FORWARD=1024
Rename process to "factorio"
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libresolv.so.2
Using native(wrapped) libX11.so.6
Using native(wrapped) libXext.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libGL.so.1
Using native(wrapped) libXinerama.so.1
Using native(wrapped) libXrandr.so.2
Using native(wrapped) libXrender.so.1
Using native(wrapped) libXcursor.so.1
Using native(wrapped) libasound.so.2
Using native(wrapped) libpulse.so.0
Using native(wrapped) libpulse-simple.so.0
Using native(wrapped) libm.so.6
Look for __res_nquery in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fb21de8f0
Look for __dn_expand in loaded elfs
Found symbol with version GLIBC_2.27, value = 0x3fb21d893c
   0.016 2023-05-12 19:07:55; Factorio 1.1.80 (build 60618, linux64, full)
   0.068 Operating system: Linux (Ubuntu 23.04)
   0.074 Program arguments: "/home/ubuntu/factorio/bin/x64/factorio" 
   0.075 Config path: /home/ubuntu/factorio/config/config.ini
   0.077 Read data path: /home/ubuntu/factorio/data
   0.078 Write data path: /home/ubuntu/factorio [42968/76424MB]
   0.079 Binaries path: /home/ubuntu/factorio/bin
   1.147 System info: [CPU:           Box64 on unknown riscv64 cpu @1000 MHz, 4 cores, RAM: 7903 MB]
   1.153 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=plasma XDG_SESSION_DESKTOP=KDE XDG_CURRENT_DESKTOP=KDE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   1.172 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
Using native(wrapped) libXi.so.6
Using native(wrapped) libXfixes.so.3
Using native(wrapped) libXss.so.1
Using native(wrapped) libXxf86vm.so.1
   1.416 Available displays: 1
   1.418  [0]: MD20491 24" - {[0,0], 1920x1080, SDL_PIXELFORMAT_RGB888, 60Hz}
   2.731 Initialised OpenGL:[0] AMD Radeon R9 200 Series (hawaii, LLVM 15.0.7, DRM 3.42, 5.15.0+); driver: 4.6 (Core Profile) Mesa 23.0.2
   2.732   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   2.733   [Version] 4.6
   2.751 Graphics settings preset: very-high
   2.752   Dedicated video memory size 4096 MB
  10.207 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
  10.210                   [Max threads (load/render): 32/4] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
  10.410 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
  15.091 Loading mod core 0.0.0 (data.lua)
  20.626 Loading mod base 1.1.80 (data.lua)
  32.458 Loading mod base 1.1.80 (data-updates.lua)
  44.808 Checksum for core: 3955387189
  44.811 Checksum of base: 434889501
  85.591 Prototype list checksum: 3034860339
  88.751 Loading sounds...
  92.308 Info PlayerData.cpp:71: Local player-data.json available, timestamp 1680615954
  92.309 Info PlayerData.cpp:78: Cloud player-data.json unavailable
 111.407 Crop bitmaps.
 124.892 Parallel Sprite Loader initialized (threads: 3)
 127.759 Error AtlasSystem.cpp:1550: The given sprite rectangle (left_top=0x0, right_bottom=553x1017) is outside the actual sprite size (left_top=0x0, right_bottom=553x753).
See the log file for more information.: __base__/graphics/decorative/red-desert-decal/hr-red-desert-decal-01.png; mods: ?
Prototypes using sprite:
red-desert-decal
 128.393 Initial atlas bitmap size is 16384
 128.415 Created atlas bitmap 2048x640 [icon, not-compressed, mipmap, linear-minification, linear-magnification, linear-mip-level]
 128.593 Texture processor created (2048). GPU accelerated compression Supported: yes, Enabled: yes/yes. Test passed. YCoCgDXT PSNR: 35.83, BC3 PSNR: 33.82
 128.807 Parallel Sprite Loader initialized (threads: 3)
 130.534 Sprites loaded
 130.549 Generated mipmaps (5) for atlas [0] of size 2048x640   
 130.550 Custom mipmaps uploaded.
 131.295 Factorio initialised
 182.981 Info AppManager.cpp:1374: Restarting Factorio
 182.981 Restarting for reason other than update. Setting execute permission skipped.
 182.982 Info AppManager.cpp:1408: Executable path: /home/ubuntu/factorio/bin/x64/factorio
 186.390 Goodbye
ksco commented 1 year ago

With above PR, factorio demo can load into the menu, that's some progress.

ksco commented 9 months ago

Oh I think I forgot to mention here, but Factorio Linux x64 demo is working fine on RISC-V now.

Opvolger commented 9 months ago

It's true, I can now play it on my VisionFive 2 with external GPU!