Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on postmarketOS (Alpine) on aarch64 hardware #637

Open
Soundtoxin opened this issue Nov 28, 2021 · 21 comments
Open

Building on postmarketOS (Alpine) on aarch64 hardware #637

Soundtoxin opened this issue Nov 28, 2021 · 21 comments

Comments

@Soundtoxin
Copy link

I'm trying to build the game on a Pinebook Pro (ARM 64, RK3399 SoC) running postmarketOS (based on Alpine).
I'm apparently missing libpcre, but I'm not sure which of many pcre packages to install. I've tried a few with no success. Is it possible to build on this setup? Has anyone done it?

user@laptop:~/Downloads/ivan/build/ > cmake ..

*NOTICE*
    Highscore files and Bone files are now stored at "$HOME/.ivan".
    Your HOME directory is "/home/user".

-- Checking for module 'libpcre'
--   Package 'libpcre', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find PCRE (missing: PCRE_LIBRARY PCRE_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindPCRE.cmake:26 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  FeLib/CMakeLists.txt:11 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/user/Downloads/ivan/build/CMakeFiles/CMakeOutput.log".

Here are my options:

user@laptop:~/Downloads/ivan/build/ > s libpcre
libpcre2-32-10.39-r0
pcre-dev-8.45-r1
libpcre2-16-10.39-r0
pcre2-dev-10.39-r0
libpcre16-8.45-r1
libpcre32-8.45-r1
pcre2-10.39-r0
pcre-8.45-r1
libpcrecpp-8.45-r1

I already tried libpcrecpp, libpcre2-32, and pcre (although I think I had plain pcre already). I removed each new one after they didn't fix the build.

I checked the PKGBUILD file for the ivan AUR package, but the only dependencies listed are sdl and sdl2_mixer.
I installed sdl in case I didn't already have it, and that didn't change the error I got.

@Soundtoxin
Copy link
Author

user@laptop:~/Downloads/ivan/build/ > apk info -L pcre
pcre-8.45-r1 contains:
usr/lib/libpcre.so.1
usr/lib/libpcre.so.1.2.13
usr/lib/libpcreposix.so.0
usr/lib/libpcreposix.so.0.0.7

user@laptop:~/Downloads/ivan/build/ > cmake -DPCRE_LIBRARY=/usr/lib/lipcre.so.1 -DPCRE_INCLUDE_DIR=/usr/include ..

*NOTICE*
    Highscore files and Bone files are now stored at "$HOME/.ivan".
    Your HOME directory is "/home/user".

-- Checking for module 'libpcre'
--   Package 'libpcre', required by 'virtual:world', not found
-- Found PCRE: /usr/lib/lipcre.so.1
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR
  SDL2_mixer_LIBRARY SDL2_mixer_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindSDL2.cmake:197 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  FeLib/CMakeLists.txt:29 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/user/Downloads/ivan/build/CMakeFiles/CMakeOutput.log".
user@laptop:~/Downloads/ivan/build/ > apk list --installed | grep -i sdl2
sdl2_ttf-2.0.15-r1 aarch64 {sdl2_ttf} (Zlib) [installed]
sdl2_mixer-2.0.4-r1 aarch64 {sdl2_mixer} (Zlib) [installed]
sdl2-2.0.16-r4 aarch64 {sdl2} (Zlib) [installed]
sdl2_image-2.0.5-r2 aarch64 {sdl2_image} (Zlib) [installed]
user@laptop:~/Downloads/ivan/build/ > apk info -L sdl2
sdl2-2.0.16-r4 contains:
usr/lib/libSDL2-2.0.so.0
usr/lib/libSDL2-2.0.so.0.16.0

I got some help from someone with manually specifying where libpcre is after also finding where it was, then it gets past that but fails on the next lib. I'm not sure how to continue this process exactly, but I get the feeling it's looking in the wrong place on my machine for these libraries. I don't know if my distro is to blame or if ivan / the build script is.

@Soundtoxin
Copy link
Author

I figured out enough to get a couple steps further.

user@laptop:~/Downloads/ivan/build/ > cmake -DPCRE_LIBRARY=/usr/lib/lipcre.so.1 -DPCRE_INCLUDE_DIR=/usr/include -DSDL2_LIBRARY=/usr/lib/libSDL2-2.0.so.0 -DSDL2_mixer_LIBRARY=/usr/lib/libSDL2_mixer-2.0.so.0 ..

*NOTICE*
    Highscore files and Bone files are now stored at "$HOME/.ivan".
    Your HOME directory is "/home/user".

-- Checking for module 'libpcre'
--   Package 'libpcre', required by 'virtual:world', not found
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find SDL2 (missing: SDL2_INCLUDE_DIR SDL2_mixer_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindSDL2.cmake:197 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  FeLib/CMakeLists.txt:29 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/user/Downloads/ivan/build/CMakeFiles/CMakeOutput.log".

Now I need to specify the include_dir for a couple things instead of libraries. Different enough I'm not sure how to guess my way there just yet.

@Soundtoxin
Copy link
Author

Soundtoxin commented Nov 28, 2021

Telling it where files were manually was the wrong approach. I just needed to install -dev versions of several packages and do cmake .. again.

pcre-dev
zlib-dev
libpng-dev
alsa-lib-dev

That was enough to get me past the cmake phase. The make part went okay from what I could tell. Did sudo make install. Now I get an error (and nothing showing up) when I try to launch ivan.

user@laptop:~/ > ivan
ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /dev/snd/seq failed: No such file or directory

MidiOutAlsa::initialize: error creating ALSA sequencer client object.


MidiOutAlsa::initialize: error creating ALSA sequencer client object.

MIDI Out Error

Please submit a bug report on our forum at http://attnam.com
including a brief description of what you did, what version
you are running and which kind of system you are using.

@ryfactor
Copy link
Member

@Soundtoxin awesome you are building on Arm64 on postmarketOS on your Pinebook Pro, truly a beautiful tech trifecta. Never been done before.

It appears as if ivan is looking for a midi sequencer in /dev/snd/seq to play music with. Maybe try installing ALSA.

@ryfactor
Copy link
Member

Actually you could try any alsa compatible software midi synthesizer. The device could even be a hardware synth, if you have any gear available :)

@Soundtoxin
Copy link
Author

I thought I already had alsa. Don't the other sound system still depend on it? I do have working sound, for example, in a browser on youtube.
Here are alsa-related things I have installed.

user@laptop:~/ > apk list --installed | grep -i alsa                                                                                                                                     
alsa-utils-openrc-1.2.5.1-r2 aarch64 {alsa-utils} (GPL-2.0-or-later) [installed]                                                                              
alsa-ucm-conf-1.2.5.1-r1 aarch64 {alsa-ucm-conf} (BSD-3-Clause) [installed]                                                                                   
alsa-lib-dev-1.2.5.1-r1 aarch64 {alsa-lib} (LGPL-2.1-or-later) [installed]                                                                                    
pulseaudio-alsa-15.0-r2 aarch64 {pulseaudio} (LGPL-2.1-or-later) [installed]                                                                                  
alsa-lib-1.2.5.1-r1 aarch64 {alsa-lib} (LGPL-2.1-or-later) [installed]

Here are general search results for alsa in case the thing I may be missing is among them.

user@laptop:~/ > apk search alsa
bluez-alsa-3.1.0-r0
openjdk8-jre-8.302.08-r2
bluez-alsa-openrc-3.1.0-r0
scream-alsa-3.4-r1
alsa-lib-dev-1.2.5.1-r1
pulseaudio-alsa-15.0-r2
alsa-utils-openrc-1.2.5.1-r2
soc-qcom-msm8916-ucm-14-r0
alsa-utils-1.2.5.1-r2
alsaconf-1.2.5.1-r2
qemu-audio-alsa-6.1.0-r2
scream-alsa-openrc-3.4-r1
tinyalsa-dev-2.0.0-r0
openjdk9-jre-9.0.4_p12-r4
pipewire-alsa-0.3.40-r2
tinyalsa-2.0.0-r0
alsa-tools-dev-1.2.5-r1
jack-example-clients-1.9.19-r2
alsa-tools-doc-1.2.5-r1
alsa-plugins-doc-1.2.5-r2
openjdk10-jre-10.0.2_p13-r3
alsa-lib-1.2.5.1-r1
tinyalsa-libs-2.0.0-r0
alsa-topology-conf-1.2.5.1-r1
alsa-tools-gui-1.2.5-r1
py3-pyalsaaudio-0.9.0-r1
alsa-plugins-jack-1.2.5-r2
openjdk7-jre-base-7.311.2.6.27-r1
tinyalsa-static-2.0.0-r0
libcanberra-alsa-0.30-r8
alsa-plugins-a52-1.2.5-r2
asterisk-alsa-18.2.2-r5
alsa-utils-dbg-1.2.5.1-r2
alsa-utils-doc-1.2.5.1-r2
tinyalsa-doc-2.0.0-r0
alsa-plugins-lavrate-1.2.5-r2
alsa-plugins-pulse-1.2.5-r2
gst-plugins-base-1.18.5-r0
alsa-plugins-1.2.5-r2
alsa-lib-dbg-1.2.5.1-r1
alsa-tools-1.2.5-r1

I just tried installing alsa-plugins and that didn't seem to help. Any other specific suggestions?

@ryfactor
Copy link
Member

Hmm. What do you get it you type sudo modprobe snd-seq?

@Soundtoxin
Copy link
Author

Hmm. What do you get it you type sudo modprobe snd-seq?

modprobe: FATAL: Module snd-seq not found in directory /lib/modules/5.14.9

@ryfactor
Copy link
Member

This is getting a bit more tricky.
It could be that something needs to be enabled when the kernel gets compiled, could be as simple as lodging a feature request with postmarketOS and subsequently updating. We don't want to have to compile a custom kernel if we can help it though.
I don't know how much postmarketOS differs from Alpine, but you could try approaching some of the folks in an Alpine forum, they might be in a better position to help figure this one out.
I'm excited you got ivan to compile, that is definitely a big milestone. Be even better to get it running :)

@AquariusPower
Copy link
Contributor

AquariusPower commented Nov 30, 2021

you can try with QSynth
#606
if it is available

if I'm not wrong, you can mute/disable midi until you fix it,
but I think u will need a config file

try these at ~/.ivan/ivan.conf
Volume = 0;
PlaySounds = 0;

I think Volume suffices.

and considering you are on *nix, you can enable the debug messages:
https://github.com/AquariusPower/CppDebugMessages
if there is any debug messages about midi at ivan code, it may output something useful, but if there is nothing there for midi, it wont help.

@Soundtoxin
Copy link
Author

you can try with QSynth #606 if it is available

I don't see QSynth in the pmOS package search results. I did a search for it on another distro just to see a description of it, and Arch says it's a Qt GUI for FluidSynth. FluidSynth is available, but... it looks like it's already installed, so I'm afraid that's a dead end as well. Is FluidSynth needed at build time? I did not have FluidSynth-dev installed when I built ivan, although I didn't seem to need to. As for configuring FluidSynth to make sure Pulseaudio is used, I guess without the Qt GUI I wouldn't know how to do it the same way you did.

try these at ~/.ivan/ivan.conf
Volume = 0;
PlaySounds = 0;

I did not have that directory or file, but I created them and pasted in those lines as suggested. It did not seem to change anything.

and considering you are on linux, you can enable the debug messages:
https://github.com/AquariusPower/CppDebugMessages

Thanks for the suggestions, but how exactly do I do that? How is that link involved? Do I clone and build / make install that? Then do I need to launch ivan with different args or something? The readme there is lacking instructions.

@ryfactor
Copy link
Member

ryfactor commented Dec 1, 2021

@Soundtoxin what's the contents of your /dev/snd?

@Soundtoxin
Copy link
Author

@Soundtoxin what's the contents of your /dev/snd?

@fejoa
I'm missing the all-important seq in there if that's what you're wondering. Here's the ls output.

user@laptop:~/ > ls /dev/snd
by-path/   controlC0  pcmC0D0c   pcmC0D0p   timer

The by-path dir just contains one file, platform-es8316-sound, which appears to be a symlink back to controlC0 in the parent dir.

@Soundtoxin
Copy link
Author

Soundtoxin commented Jan 2, 2022

It's been a while. I rebuilt the postmarketOS kernel with CONFIG_SND_SEQUENCER enabled, then installed the kernel, rebooted, then had to modprobe it before it finally worked (I guess I enabled it as a "module", I think it could've been enabled in another way, but it said something about a thing it depended on being enabled as a module already).

The game now launches, but it seems every other keypress turns the screen black in the menus. The same happens during the name entry screen. Whether I use arrows or backspace or whatever, it'll swap between black and not-black with each press. Once I'm loaded into the world, there is a constant flickering on the game window (without me having to press anything).

@AquariusPower
Copy link
Contributor

It's been a while. I rebuilt the postmarketOS kernel with CONFIG_SND_SEQUENCER enabled, then installed the kernel, rebooted, then had to modprobe it before it finally worked (I guess I enabled it as a "module", I think it could've been enabled in another way, but it said something about a thing it depended on being enabled as a module already).

so the MIDI is playing now? good :)

The game now launches, but it seems every other keypress turns the screen black in the menus. The same happens during the name entry screen. Whether I use arrows or backspace or whatever, it'll swap between black and not-black with each press.

wow... I dont remember well but I think there is no animation in the menus, so there is no frame rate, no FPS, it is just a static image for every keypress.
By what you describe, it seems a to be frame buffer problem? like it is cleaning (to black) at one of the buffers and dumping it black to the screen.
So, at the name if you type: "12345", will it be a black screen at "2" and "4"? is it like that? so you can only read like "1" "123" "12345" ? just to help on hinting on the problem.

Once I'm loaded into the world, there is a constant flickering on the game window (without me having to press anything).

At this moment there is a frame rate, FPS.
you can try to run ivan like this (see at ivan --help):
IVAN_SHOWFPS=true ivan
but it wont help I guess, it is just to provide more info here.

@Soundtoxin
Copy link
Author

so the MIDI is playing now? good :)

I don't remember hearing any sound, but it wouldn't even appear before, so I'm happy still to make that progress.

So, at the name if you type: "12345", will it be a black screen at "2" and "4"? is it like that? so you can only read like "1" "123" "12345" ? just to help on hinting on the problem.

Yep, exactly like that sort of thing.

At this moment there is a frame rate, FPS. you can try to run ivan like this (see at ivan --help): IVAN_SHOWFPS=true ivan but it wont help I guess, it is just to provide more info here.

Thanks for the tip. Next time I power on the Pinebook Pro I will try turning that option on.

@AquariusPower
Copy link
Contributor

AquariusPower commented Jan 8, 2022

I don't remember hearing any sound, but it wouldn't even appear before, so I'm happy still to make that progress.

so, on FluidSynth you have to install a sound font.
On ubuntu we have: fluid-soundfont-gm
that has this sound font to be configured at fluidsynth: /usr/share/sounds/sf2/FluidR3_GM.sf2
Probably you can extract that package and place that file alone anywhere you want.

Yep, exactly like that sort of thing.

so it is blitting an empty screen frame buffer.
May the buffer is being cleaned and then it fails to be drawn, the failure is ignored and then blits it all black.
So, this never happened to any other game right? to exclude hardware (or graphics driver) problems. (despite I see no reason for that to happen)
May be something could be coded to help on debugging it, if there is nothing already.
May be a forced white dot being always blitted at a specific location (like 0,0) could hint for the problem and provide a good check to help track, log and fix that.
Mmm... I should add install steps for https://github.com/AquariusPower/CppDebugMessages, if there is some log there already it could help, otherwise you could try debugging with nemiver if you like doing that kind of stuff like me :)

@Soundtoxin
Copy link
Author

At this moment there is a frame rate, FPS. you can try to run ivan like this (see at ivan --help): IVAN_SHOWFPS=true ivan but it wont help I guess, it is just to provide more info here.

ivan --help, and ivan -h just launch the game normally as far as I can tell. man ivan gave no result either.

so, on FluidSynth you have to install a sound font.
On ubuntu we have: fluid-soundfont-gm

I couldn't find any similar package on pmOS, but I think you're saying I could grab that ubuntu package and pull the files needed out of it. I'll explore that option.

New info: the black screen and other flashing went away when launched with the env var to show FPS, but I think it was coincidence probably. I don't think I even saw an FPS counter. Then I quit and re-launched without any special args and it opened fine, no issues. I still don't have sound, but the flashing and stuff is gone. Maybe launching/qutting multiple times or something worked out the flashing issue.

@AquariusPower
Copy link
Contributor

AquariusPower commented Feb 7, 2022

I could grab that ubuntu package and pull the files needed out of it

yes! :)

after starting fluidsynth (it is a server link qsynth right?)
on ivan, start playing a game, go to "settings/sounds/use MIDI soundtrack" (ctrl+f and type midi), something may be written there, mine was "14:0" (dunno what it is)
now, on that option, just press Enter key, it will change to the next available midi device, mine reads now: Fluid Synth 128:0
you may also try to exit settings menu back to game play, that may start playing the music
but if it fails, save and exit to main menu, and load the game again
if it all fails, restart the game

but better be sure if fluidsynth is working at all, but I couldnt find a way to test if mine is working from the command line tho, playmidi did not work here (but ivan did)

I quit and re-launched without any special args and it opened fine, no issues.

could be a hardware problem then

@jakwings
Copy link
Member

jakwings commented Feb 7, 2022

You can try fluidsynth on command line like this:

$ cat config.txt
gain 2.5
load fonts/FatBoy.sf2
load fonts/FluidR3_GM.sf2
fonts
$ ls fonts
FatBoy.sf2 FluidR3_GM.sf2
$ fluidsynth --load-config config.txt  # running at foreground
... debug messages from fluidsynth ...

@AquariusPower
Copy link
Contributor

@iology
for some reason, I did not think it could actually just play!
I have not fluidsynth but qsynth.
I had to stop qsynth (or the command line wont work), and the run run this on command line qsynth Dungeon.mid, the channels wont blink but the music will play.
thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants