Page 1 of 1

Compiling PCem for Windows from Windows Subsystem for Linux with Ubuntu

Posted: Sat 27 Jul, 2019 3:24 am
by ruben_balea
In part for fun and in part because MSYS is very slow I tried to compile PCem under the WSL and it's at least 3 times faster than MSYS. Of course I got an executable for Linux.
Now I'm trying to cross compile it for Windows but I get an error about OpenAL:

Code: Select all

root@cp1:~/pcem# ./configure --host=x86_64-w64-mingw32
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc accepts -g... yes
checking for x86_64-w64-mingw32-gcc option to accept ISO C89... none needed
checking whether x86_64-w64-mingw32-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of x86_64-w64-mingw32-gcc... gcc3
checking for x86_64-w64-mingw32-g++... x86_64-w64-mingw32-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-w64-mingw32-g++ accepts -g... yes
checking dependency style of x86_64-w64-mingw32-g++... gcc3
checking whether to build for release... no
checking whether to enable debugging... no
checking whether to enable networking... no
checking whether to use ALSA for MIDI output... no
checking for cpu... x86_64
checking for off64_t x86_64... yes
checking for x86_64-w64-mingw32-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
configure: WARNING: using cross tools not prefixed with host triplet
checking pkg-config is at least version 0.9.0... yes
checking for sdl2 >= 2.0.1... yes
checking for wx-config... /usr/local/bin/wx-config
checking for wxWidgets version >= 3.0.0... yes (version 3.0.5)
checking for wxWidgets static library... no
checking for pthread_create in -lpthread... yes
checking for main in -lopengl32... yes
checking for alGetError in -lopenal... no
You need to install the OpenAL library.
root@cp1:~/pcem#
I found the --host=x86_64-w64-mingw32 thing on some guides to compile bitcoin under WSL.
Before I got a similar error about missing wxWidgets and with a lot of gooling I managed to build and install wxWidgets for x86_64-w64-mingw32 but I couldn't find any hint for OpenAL.

Anyone have any ideas?

Re: Compiling PCem for Windows from Windows Subsystem for Linux with Ubuntu

Posted: Sat 27 Jul, 2019 9:41 pm
by shermanp
You'll probably want OpenAL-Soft. It is a CMAKE project.

OpenAL-Soft seems to provide a toolchain file for cross-compiling with MinGW-w64 at https://github.com/kcat/openal-soft/blo ... ompile.txt.

Does this help?

Re: Compiling PCem for Windows from Windows Subsystem for Linux with Ubuntu

Posted: Sun 28 Jul, 2019 1:47 am
by ruben_balea
Thanks shermanp, that helped but it seems that my setup is missing a lot more things to be able to cross compile...
So I installed VcXsrv to try the Linux executable and it worked up to certain point:
PCem with WSL and VcXsrv.png
PCem with WSL and VcXsrv.png (27.5 KiB) Viewed 5595 times
Then after starting a machine I get some errors in the console about the unimplemented Linux features:

Code: Select all

root@cp1:~/pcem# ./pcem
Set fullspeed - 0 0 0
shared memfd open() failed: Function not implemented
AL lib: (WW) Failed to initialize backend "pulse"
shared memfd open() failed: Function not implemented
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) Could not open playback device 'default': No such file or directory
AL lib: (WW) Error generated on device (nil), code 0xa005
AL lib: (WW) Error generated on device (nil), code 0xa001
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
Menu item not found: 1403
Menu item not found: 1404
Menu item not found: 1403
Menu item not found: 1404
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
Xlib:  extension "MIT-SHM" missing on display ":0.0".
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
Xlib:  extension "MIT-SHM" missing on display ":0.0".
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)
AL lib: (WW) Querying error state on null context (implicitly 0xa004)

and the same repeats again and again...
I guess it will run fine under full Ubuntu, but I don't have it installed and with my satellite internet connection isn't really worth to download a CD image just to test it, I will save bandwith for other things.
Considering that most of my experience with the Linux console was on the few last years to install and configure a few things for the Raspberry Pi from time to time and using readily available instructions I'll leave this experiment for now :sad: