vircon32 / ComputerSoftware

General repository for all software (emulators, dev tools, etc) related to Vircon32 but not running on console itself
http://www.vircon32.com
Other
32 stars 3 forks source link

Segmentation Fault #7

Closed Chandler-Kluser closed 11 months ago

Chandler-Kluser commented 11 months ago

I have built linux Desktop Emulator:

git clone https://github.com/vircon32/ComputerSoftware.git
cd ComputerSoftware/DesktopEmulator
mkdir build && cd build
cmake ..
cmake --build .

I have got this error when running emulator:

/home/vircon32/ComputerSoftware/DesktopEmulator/build $ ./Vircon32 
Stopping audio playback thread
Audio thread exiting
[1]    262367 segmentation fault (core dumped)  ./Vircon32

My PC specs:

                   -`                    vircon32@v32
                  .o+`                   ------------------ 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: B450 I AORUS PRO WIFI 
               `+oooooo:                 Kernel: 6.6.7-arch1-1 
               -+oooooo+:                Uptime: 2 days, 12 hours, 18 mins 
             `/:-:++oooo+:               Packages: 1601 (pacman) 
            `/++++/+++++++:              Shell: zsh 5.9 
           `/++++++++++++++:             Resolution: 3840x2160 
          `/+++ooooooooooooo/`           DE: GNOME 45.2 
         ./ooosssso++osssssso+`          WM: Mutter 
        .oossssso-````/ossssss+`         WM Theme: Adwaita 
       -osssssso.      :ssssssso.        Theme: HighContrastInverse [GTK2/3] 
      :osssssss/        osssso+++.       Icons: Adwaita [GTK2/3] 
     /ossssssss/        +ssssooo/-       Terminal: kgx 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz 
  `+sso+:-`                 `.-/+oso:    GPU: AMD ATI Radeon RX 6600/6600 XT/6600M 
 `++:.                           `-/+/   Memory: 5834MiB / 15912MiB 
 .`                                 `/
vircon32 commented 11 months ago

Hello Chandler. I'm not familiar with what cmake --build does, but I notice you did not call cmake --install. Were you trying to run the build executable directly from the build directory? I'm not sure that will work, since that way the needed data files will be missing.

Chandler-Kluser commented 11 months ago

I cannot use --install statement due to a packaging requirement of Arch User Repository (since it requires root priviledges).

I need to set the PATHs into a fakeroot environment for that.

In fact, analysing your CMakeLists.txt file I was able to identify the linux paths you need. But running the Emulator still gets the same segmentation fault before...

Chandler-Kluser commented 11 months ago

Here is a dump of the log text (I got from console instead of DebugLog.txt):

$ /opt/Vircon32/Emulator/Vircon32      
ERROR: Could not open log file "/opt/Vircon32/Emulator/DebugLog.txt". Logging to console.
Performing ABI assertions
Performing I/O port assertions
Initializing global variables
Initializing SDL
Active joysticks: 0
Creating OpenGL window
Creating window
Creating OpenGL context
OpenGL context created successfully
Initializing GLAD
Started OpenGL version 4.6 (Compatibility Profile) Mesa 24.0.0-devel (git-5311d8713d)
OpenGL renderer: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 16.0.6, DRM 3.54, 6.6.7-arch1-1)
GLSL version: 4.60
Activating VSync
Setting 2D viewport
Finished creating OpenGL window
Graphic device vendor: AMD
Graphic device model: AMD Radeon RX 6600 (radeonsi, navi23, LLVM 16.0.6, DRM 3.54, 6.6.7-arch1-1)
Starting ImGui
Initializing rendering
Compiling GLSL shader program
Vertex shader compiled successfully! ID = 1
Fragment shader compiled successfully! ID = 2
Shader program linked successfully! ID = 3
Creating white texture
Finished creating white texture
Finished initializing rendering
Creating Framebuffer
Creating Framebuffer object
glGenFramebuffers: GL_NO_ERROR
glBindFramebuffer: GL_NO_ERROR
Creating a new texture
glGenTextures: GL_NO_ERROR
glBindTexture: GL_NO_ERROR
glTexImage2D: GL_NO_ERROR
glTexParameteri: GL_NO_ERROR
Binding the render buffer to the Framebuffer
glFramebufferTexture: GL_NO_ERROR
Checking status of the created Framebuffer
glCheckFramebufferStatus: GL_NO_ERROR
Framebuffer status OK
glDrawBuffers: GL_NO_ERROR
Finished creating Framebuffer
Enabling alpha blending
Initializing audio
Loaded program icon
Texture -> Load "/opt/Vircon32/Emulator/Images/NoSignal.png"
Loading controls from "/opt/Vircon32/Emulator/Config-Controls.xml"
Loading settings from "/opt/Vircon32/Emulator/Config-Settings.xml"
Initializing GTK
Creating audio playback thread
Loading bios
File path: "/opt/Vircon32/Emulator/Bios/StandardBios.v32"
BIOS title: "Vircon32 standard BIOS"
BIOS texture is 480x328
BIOS sound is 105728 samples
Finished loading BIOS
---------------------------------------------------------------------
    Starting main loop
---------------------------------------------------------------------
Focus gained
Focus gained
[1]    314415 segmentation fault (core dumped)  /opt/Vircon32/Emulator/Vircon32
Chandler-Kluser commented 11 months ago

you will be able to reproduce the steps doing in an Arch based Linux distro:

Have this PKGBUILD file in your cwd:

# Maintainer: Javier Carracedo <https://github.com/vircon32>
# Contributor: DeathKhan <jfoh96@gmail.com>
# Contributor: Chandler Klüser <chandler.kluser@gmail.com>

pkgname=vircon32-desktop-emulator-git
pkgver=9371c42a929cf62e061eca609cbb21e5beed1887
pkgrel=1
epoch=20231217
pkgdesc="Vircon32 Desktop Emulator"
arch=('x86_64')
url="https://github.com/vircon32/ComputerSoftware"
license=('unknown')
depends=('mesa' 'sdl2' 'sdl2_image' 'openal' 'freealut' 'tinyxml2' 'gtk2')
makedepends=('glibc' 'git' 'cmake')
provides=('vircon32-desktop-emulator')
source=("ComputerSoftware::git+$url.git")
sha256sums=('SKIP')

build() {
  cd ComputerSoftware/DesktopEmulator
  mkdir build && cd build
  cmake ..
  cmake --build .
}

package() {
  install -d "${pkgdir}/opt/Vircon32/Emulator"
  install -d "${pkgdir}/opt/Vircon32/Emulator/Bios"
  install -d "${pkgdir}/opt/Vircon32/Emulator/Images"
  install -d "${pkgdir}/usr/share/applications"
  install -d "${pkgdir}/usr/share/pixmaps"
  install -d "${pkgdir}/usr/share/icons/hicolor/scalable/apps/"
  cp -r ComputerSoftware/DesktopEmulator/build/* "${pkgdir}/opt/Vircon32/Emulator"
  cp ComputerSoftware/DesktopEmulator/Data/Config-Controls.xml "${pkgdir}/opt/Vircon32/Emulator"
  cp ComputerSoftware/DesktopEmulator/Data/Config-Settings.xml "${pkgdir}/opt/Vircon32/Emulator"
  cp ComputerSoftware/DesktopEmulator/Data/Bios/StandardBios.v32 "${pkgdir}/opt/Vircon32/Emulator/Bios/StandardBios.v32"
  cp -r ComputerSoftware/DesktopEmulator/Data/Images/* "${pkgdir}/opt/Vircon32/Emulator/Images"
  cp ComputerSoftware/DesktopEmulator/Resources/Linux/Vircon32.desktop "${pkgdir}/usr/share/applications"
  cp ComputerSoftware/DesktopEmulator/Resources/Linux/Vircon32.svg "${pkgdir}/usr/share/pixmaps"
  cp ComputerSoftware/DesktopEmulator/Resources/Linux/Vircon32.svg "${pkgdir}/usr/share/icons/hicolor/scalable/apps/"
}

then run makepkg to build and install the Emulator:

makepkg -si

then open a console terminal and run Vircon32 Emulator:

/opt/Vircon32/Emulator/Vircon32

you will get the same error I mentioned

vircon32 commented 11 months ago

I don't have access to an Arch Linux now, but I have been doing some tests under Ubuntu. I see that, when the font file is missing (GuiFont.ttf) the program generates a core instead of producing some error message. I suspect this may be the cause of the error here, since I don't see that file being copied in your package() block.

Edit: I think you may be missing the readme files as well. The easiest way for this would probably be to recursively copy the whole content of the Data folder.

vircon32 commented 11 months ago

I now pushed a fix that should prevent the crash and instead display a message when the GUI font file is not found. Can you please confirm that the segmentation fault no longer happens? Then I will be able to close this issue. Thank you.

Chandler-Kluser commented 11 months ago

Great, this is it!

image

The AUR package was updated to make it have the Fonts in the correct directory, it is now working as expected!

So now Arch Linux Users can full build and enjoy Desktop Emulator by installing this AUR package.

If user have a helper like yay, running this command is enough to have the emulator:

yay -S vircon32-desktop-emulator-git
vircon32 commented 11 months ago

Thank you @Chandler-Kluser, and nice work on that arch linux port!