wiki:npl/games/openmsx

Version 1 (modified by trac, 16 years ago) (diff)

--

Build notities openmsx

Downloaden: http://mesh.dl.sourceforge.net/sourceforge/openmsx/openmsx-0.6.2.tar.gz

Eerste poging met standaard automake buildscripts:

psy openmsx # wget http://mesh.dl.sourceforge.net/sourceforge/openmsx/openmsx-0.6.2.tar.gz
--14:02:05--  http://mesh.dl.sourceforge.net/sourceforge/openmsx/openmsx-0.6.2.tar.gz
           => `openmsx-0.6.2.tar.gz'
Resolving mesh.dl.sourceforge.net... 213.203.218.122
Connecting to mesh.dl.sourceforge.net|213.203.218.122|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,934,469 (1.8M) [application/x-tar]

100%[===============================================================================================================>] 1,934,469    778.80K/s

14:02:08 (778.09 KB/s) - `openmsx-0.6.2.tar.gz' saved [1934469/1934469]

psy openmsx # cp ../../packagename.SlackBuild.example openmsx.SlackBuild
psy openmsx # cd ../..
psy npl # ./rebuildcheck games/openmsx/openmsx.SlackBuild
REBUILD REQUIRED: ./openmsx-0.6.2.tar.gz has changed!
REBUILDING /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild:
...
Probing target system...

Found libraries:
  libpng:          no
  libxml2:         no
  OpenGL:          no
  GLEW:            no
  Jack:            no
  SDL:             no
  SDL_image:       no
  TCL:             no
  zlib:            yes

Found headers:
  libpng:          no
  libxml2:         no
  OpenGL:          no
  GLEW:            no
  Jack:            no
  SDL:             no
  SDL_image:       no
  TCL:             no
  zlib:            yes

Components overview:
  Emulation core:  no
  CassetteJack:    no
  SDLGL renderer:  no

Customisable options:
  Install to:      /opt/openMSX
  (you can edit these in build/custom.mk)

Please install missing libraries and headers and rerun "configure".

21 /tmp/build/openmsx-0.6.2 > make
build/main.mk:442: *** Cannot build openMSX because essential libraries are unavailable. Please install the needed libraries and their header files and rerun "configure".  Stop.
21 /tmp/build/openmsx-0.6.2 > exit 1
57 /tmp/build > exit 1
*** Er ging iets mis tijdens het bakken in de buildroot!

Dependencies als #NEED: in de slackbuild toevoegen.

Toegevoegd aan slackbuild:
#NEED:libpng
#NEED:libmesa
#NEED:libsdl
#NEED:tcl
#NEED:libxml2

Resultaat:
Found libraries:
  libpng:          1.2.16
  libxml2:         2.6.27
  OpenGL:          no
  GLEW:            no
  Jack:            no
  SDL:             no
  SDL_image:       no
  TCL:             8.4
  zlib:            yes

Found headers:
  libpng:          yes
  libxml2:         yes
  OpenGL:          no
  GLEW:            no
  Jack:            no
  SDL:             yes
  SDL_image:       no
  TCL:             yes
  zlib:            yes

Components overview:
  Emulation core:  no
  CassetteJack:    no
  SDLGL renderer:  no

Kijken in documentatie welke packages we nog meer moeten:

psy npl # chroot ../builder/buildroot0/
stderr is not a tty - where are you?
[Syn-3] root@darkstar.example.net /# cd /tmp/build/openmsx-0.6.2
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# lynx doc/manual/compile.html

npl/X/libglew en npl/mediabox/libsdl-image nodig. Jack word niet genoemd.

Deze 2 gaan we eerst fixen.

Na lang klooien met libglew kunnen we eindelijk verder. We zetten libsdl_image en libglew in de NEEDs en proberen het nogmaals:

psy npl # mcedit -dc games/openmsx/openmsx.SlackBuild
#NEED:libpng
#NEED:libglew
#NEED:tcl
#NEED:libxml2
#NEED:libsdl_image

psy npl # ./rebuildcheck openmsx
...
21 /tmp/build/openmsx-0.6.2 > make
cc1plus: error: invalid option `tune=pentium3'
cc1plus: error: invalid option `tune=pentium3'
make: *** [derived/x86-linux-i686/obj/Autofire.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [derived/x86-linux-i686/obj/CLIOption.o] Error 1
cc1plus: error: invalid option `tune=pentium3'
cc1plus: error: invalid option `tune=pentium3'
make: *** [derived/x86-linux-i686/obj/CartridgeSlotManager.o] Error 1
make: *** [derived/x86-linux-i686/obj/CircularBuffer.o] Error 1
21 /tmp/build/openmsx-0.6.2 > exit 1
63 /tmp/build > exit 1
*** Er ging iets mis tijdens het bakken in de buildroot!
Error while rebuilding /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild!

De configure gaat nu wel goed, maar blijkbaar word er een gcc parameter meegegeven dat niet ondersteund word. We duiken de buildroot in:

psy npl # chroot ../builder/buildroot0/
stderr is not a tty - where are you?
[Syn-3] root@darkstar.example.net /# cd /tmp/build/openmsx-0.6.2
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# grep -R tune=pentium3 .
./build/flavour-win32.mk:       -mtune=pentium3 -march=pentium-mmx -mmmx \
./build/flavour-i686.mk:CXXFLAGS+=-march=i686 -mtune=pentium3

Ik heb wat verder rond gekeken, maar er is maar 1 flavour voor de pc en die gebruikt tune optie. (waarschijnlijk voor een nieuwere gcc)

We halen de tune optie er uit en proberen handmatig te compilen:

[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# sed -i 's/-mtune=pentium3//g' build/flavour-i686.mk
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# make
Build configuration:
  Platform: x86-linux
  Flavour:  i686
  Profile:  false
  Subset:   full build
Compiling Autofire.cc...
Compiling CLIOption.cc...
Compiling CartridgeSlotManager.cc...
...

Dit lijkt goed te gaan, we breken af en passen de slackbuild aan met deze sed regel:

#Unpack source
#(uncomment if not needed)
syn3_unpack $SRC_ARC || exit 1

#apply patches
#patch -p1 -d $SRC_DIR < fluxkiosk.patch || exit 1
#haal illegale tune= optie weg!
sed -i 's/-mtune=pentium3//g' $SRC_DIR/build/flavour-i686.mk || exit 1

We doen nogmaals een rebuild:

...
35 /tmp/build/openmsx-0.6.2 > make pkgconfigdir=/usr/lib/pkgconfig install_prefix=/tmp/pkg DESTDIR=/tmp/pkg INSTALL_ROOT=/tmp/pkg install_root=/tmp/pkg install
37 /tmp/build/openmsx-0.6.2 > exit 0
68 /tmp/build > syn3_strip /tmp/pkg
71 /tmp/build > syn3_move_dev /tmp/pkg /tmp/pkgdev
72 /tmp/build > syn3_makepkg /tmp/pkgdev openmsx_dev 0.6.2 i586
Not creating empty pacakge
75 /tmp/build > syn3_makepkg /tmp/pkg openmsx 0.6.2 i586
Not creating empty pacakge
*** Build gelukt.
* Packages terugmoven naar originele directory..
/home/psy/syn3/builder/buildroot0/tmp/build/*.arch ...
mv: cannot stat `/home/psy/syn3/builder/buildroot0/tmp/build/*.arch': No such file or directory
Error while rebuilding /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild!

We zien dat het maken goed gaat, maar nu worden er empty packages gemaakt. Dit betekend dat er geen files in /tmp/pkg komen en dat dus de make install niet goed gaat. We gaan weer de buildroot in:

[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# grep install build/*
build/3rdparty.mk:INSTALL_DIR:=$(BUILD_PATH)/install
build/3rdparty.mk:INSTALL_TARGETS:=$(foreach PACKAGE,$(PACKAGES),$(TIMESTAMP_DIR)/install-$(PACKAGE_$(PACKAGE)))
build/3rdparty.mk:$(INSTALL_TARGETS): $(TIMESTAMP_DIR)/install-%: $(TIMESTAMP_DIR)/build-%
build/3rdparty.mk:      make -C $(BUILD_DIR)/$* install $(INSTALL_PARAMS_$(call findpackage,PACKAGE,$*))
build/3rdparty.mk:$(PNG_CONFIG_SCRIPT): $(TIMESTAMP_DIR)/install-$(PACKAGE_PNG)
build/3rdparty.mk:$(SDL_CONFIG_SCRIPT): $(TIMESTAMP_DIR)/install-$(PACKAGE_SDL)
build/config.guess:     # is probably installed.
build/custom.mk:# Directory to install to.
build/custom.mk:# openMSX is always installed into a single self-contained directory.
build/custom.mk:# Create a symbolic link to the installed binary?
build/custom.mk:# /usr/local/bin for system-wide installs and ~/bin for personal installs.
build/install-recursive.sh:# $Id: install-recursive.sh 6095 2007-02-18 23:23:46Z mthuurne $
build/install-recursive.sh:             install -m 0755 -d "$dst/$dir"
build/install-recursive.sh:             install -m $mode "$path" "$dst/$dir"
build/main.mk:DEPEND_TARGETS:=all default install run bindist
build/main.mk:STATIC_INSTALL_DIR:=$(BUILD_BASE)/$(OPENMSX_TARGET_CPU)-$(OPENMSX_TARGET_OS)-$(OPENMSX_FLAVOUR)/3rdparty/install
build/main.mk:Please install the needed libraries and their header files and rerun "configure")
build/main.mk:#       To change installation dir for actual installations, edit "custom.mk".
build/main.mk:install: all
build/main.mk:  @install -d $(INSTALL_BINARY_DIR)
build/main.mk:  @install $(BINARY_FULL) $(INSTALL_BINARY_DIR)/$(BINARY_FILE)
build/main.mk:  @sh build/install-recursive.sh share . $(INSTALL_SHARE_DIR)
build/main.mk:  @install -d  $(INSTALL_DOC_DIR)
...
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# less build/main.mk
...
# Note: Use OPENMSX_INSTALL only to create binary packages.
#       To change installation dir for actual installations, edit "custom.mk".
OPENMSX_INSTALL?=$(INSTALL_BASE)
# Allow full customization of locations, used by Debian packaging.
INSTALL_BINARY_DIR?=$(OPENMSX_INSTALL)/bin
INSTALL_SHARE_DIR?=$(OPENMSX_INSTALL)/share
INSTALL_DOC_DIR?=$(OPENMSX_INSTALL)/doc
INSTALL_VERBOSE?=true
...
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# make INSTALL_BASE=/tmp/pkg/usr install
Build configuration:
  Platform: x86-linux
  Flavour:  i686
  Profile:  false
  Subset:   full build
Installing openMSX:
  Executable...
  Data files...
  Documentation...
  C-BIOS...
  Creating symlinks...
Installation complete... have fun!
Notice: if you want to emulate real MSX systems and not only the free C-BIOS machines, put the system ROMs in one of the following directories: /tmp/pkg/usr/share/systemroms or ~/.openMSX/share/systemroms
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# ls /tmp/pkg
usr/
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# ls /tmp/pkg/usr/
bin    doc    share
[Syn-3] root@darkstar.example.net /tmp/build/openmsx-0.6.2# ls /tmp/pkg/usr/
bin/  doc/  share/

We vogelen uit dat in build/main.mk de variabelle INSTALL_BASE bepaald waar het pakketje terecht komt. Vervolgens passen we in het buildscript de MAKE_OPTS aan naar:

export MAKE_OPTS="INSTALL_BASE=/tmp/pkg/usr"

Alles lijkt goed te gaan, we controleren het package met tar -tzf:

*** Build gelukt.
* Packages terugmoven naar originele directory..
/home/psy/syn3/builder/buildroot0/tmp/build/openmsx.arch ...
/home/psy/syn3/builder/buildroot0/tmp/build/openmsx.version ...
/home/psy/syn3/builder/buildroot0/tmp/build/openmsx.pkg ...

* Klaar ja!
Updating md5 for /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild...
Updating dependency information for /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild...
All rebuilds completed.
psy npl # tar -tzf games/openmsx/openmsx.pkg
./
install/
install/doinst.sh
usr/
usr/doc/
usr/doc/cbios.txt
usr/doc/manual/
...

De package lijkt goed te zijn, maar voordat we hem committen testen we hem eerst uit door de package en dependencies te installen op een bak. Deze bak heeft de meeste dependencies al, maar in andere gevallen zul alle X packages en zo moeten remoteinstallen:

psy npl # ./remoteinstall libsdl_image 192.168.13.1
* Package libsdl_image zoeken:/home/psy/syn3/npl/.tmp/D/libsdl_image-1.2.6-i586-3431.tgz
* install:
Checking ssh key on 192.168.13.1...OK
192.168.13.1: Uploading and installing
192.168.13.1: Running installpkg /tmp/libsdl_image-1.2.6-i586-3431.tgz
192.168.13.1: Installing package libsdl_image-1.2.6-i586-3431...
192.168.13.1: PACKAGE DESCRIPTION:
192.168.13.1: Executing install script for libsdl_image-1.2.6-i586-3431...
192.168.13.1:
192.168.13.1: Running etc-update...
192.168.13.1: Running ldconfig...DONE
192.168.13.1: Syncing changes to disk...DONE
192.168.13.1: Postinstall check...
192.168.13.1: Installed /tmp/libsdl_image-1.2.6-i586-3431.tgz.
192.168.13.1: Install on 192.168.13.1 OK
All installs done
psy npl # ./remoteinstall openmsx 192.168.13.1
* Package openmsx zoeken:svn: '/home/psy/syn3/npl/games/openmsx/openmsx.pkg' is not a working copy

We zien dat remoteinstall mekkert, dit komt omdat je openmsx nog niet aan je lokale SVN tree hebt geadd. Dat doen we dus eerst. (de games directory is ook nieuw)

psy npl # svn add games
A         games
A         games/openmsx
A  (bin)  games/openmsx/openmsx-0.6.2.tar.gz
A         games/openmsx/openmsx.SlackBuild
A         games/openmsx/openmsx.arch
A         games/openmsx/openmsx.version
A  (bin)  games/openmsx/openmsx.pkg
A         games/openmsx/openmsx.md5
psy npl # ./remoteinstall openmsx 192.168.13.1
* Package openmsx zoeken:/home/psy/syn3/npl/.tmp/D/openmsx-0.6.2-i586-?mod.tgz
* install:
Checking ssh key on 192.168.13.1...OK
192.168.13.1: Uploading and installing
192.168.13.1: Running installpkg /tmp/openmsx-0.6.2-i586-?mod.tgz
192.168.13.1: Installing package openmsx-0.6.2-i586-?mod...
192.168.13.1: PACKAGE DESCRIPTION:
192.168.13.1: Executing install script for openmsx-0.6.2-i586-?mod...
192.168.13.1:
192.168.13.1: Running etc-update...
192.168.13.1: Running ldconfig...DONE
192.168.13.1: Syncing changes to disk...DONE
192.168.13.1: Postinstall check...
192.168.13.1: Installed /tmp/openmsx-0.6.2-i586-?mod.tgz.
192.168.13.1: Install on 192.168.13.1 OK
All installs done

Testen en aanpassen

Nu op de machine waar je het geinstalleerd hebt kijken of het werkt:

[Syn-3] root@psy.datux.nl /var/log# openmsx
info: Using default machine: C-BIOS_MSX2+
info: Failed to initialize default machine: Machine "C-BIOS_MSX2+" not found: machines/C-BIOS_MSX2+/hardwareconfig.xml not found in this context
info: Using fallback machine: C-BIOS_MSX2+
Fatal error: Machine "C-BIOS_MSX2+" not found: machines/C-BIOS_MSX2+/hardwareconfig.xml not found in this context
[Syn-3] root@psy.datux.nl /var/log# strings /usr/bin/openmsx |grep machines
machines
[Syn-3] root@psy.datux.nl /var/log# strings /usr/bin/openmsx |grep hardwareconfig
/hardwareconfig.xml
[Syn-3] root@psy.datux.nl /var/log# strings /usr/bin/openmsx |grep c
[Syn-3] root@psy.datux.nl /var/log# strace -f openmsx  2>&1|grep hardwareconfig
[pid  7467] stat64("/root/.openMSX/share/machines/C-BIOS_MSX2+/hardwareconfig.xml", 0xbfae5370) = -1 ENOENT (No such file or directory)
[pid  7467] stat64("/tmp/pkg/usr/share/machines/C-BIOS_MSX2+/hardwareconfig.xml", 0xbfae5370) = -1 ENOENT (No such file or directory)
[pid  7467] write(1, "info: Failed to initialize defau"..., 145info: Failed to initialize default machine: Machine "C-BIOS_MSX2+" not found: machines/C-BIOS_MSX2+/hardwareconfig.xml not found in this context
[pid  7467] stat64("/root/.openMSX/share/machines/C-BIOS_MSX2+/hardwareconfig.xml", 0xbfae5370) = -1 ENOENT (No such file or directory)
[pid  7467] stat64("/tmp/pkg/usr/share/machines/C-BIOS_MSX2+/hardwareconfig.xml", 0xbfae5370) = -1 ENOENT (No such file or directory)

Na een beetje kutten met strace zien we dat de openmsx binary nu verwijzingen heeft naar /tmp/pkg en daardoor dingen niet kan vinden. We hebben dus de verkeerde parameters gebruikt bij make. We moeten opnieuw op onderzoek uit in sources en makesfiles en komen dit tegen in main.mk:

# Note: Use OPENMSX_INSTALL only to create binary packages.
#       To change installation dir for actual installations, edit "custom.mk".
OPENMSX_INSTALL?=$(INSTALL_BASE)
# Allow full customization of locations, used by Debian packaging.
INSTALL_BINARY_DIR?=$(OPENMSX_INSTALL)/bin
INSTALL_SHARE_DIR?=$(OPENMSX_INSTALL)/share
INSTALL_DOC_DIR?=$(OPENMSX_INSTALL)/doc
INSTALL_VERBOSE?=true

Waarschijnlijk moeten we OPENMSX_INSTALL gebruiken in plaats van INSTALL_BASE. We passen de boel aan en remoteinstallen met een rebuilt. Maar goed dat we nog niet gecommit hadden ;)

psy npl # mcedit -dc games/openmsx/openmsx.SlackBuild

psy npl # ./remoteinstall openmsx 192.168.13.1 rebuild
* Build check:
|REBUILD REQUIRED: ./openmsx.SlackBuild has changed!
|REBUILDING /home/psy/syn3/npl/games/openmsx/openmsx.SlackBuild:
...

Dit geeft nog steeds hetzelfde probleem. :(

Aanpassing Syn-3 nodig aan het build systeem

Na nog wat meer prutsen blijkt dat je INSTALL_BASE tijden het maken op /usr moet zetten, en tijdens de make install op /tmp/pkg/usr. Standaard staat de INSTALL_BASE op /opt/openMSX, en dat willen we niet. Normaal kon je voor syn3_build_automake alleen MAKE_OPTS meegegeven voor zowel de make als de make install.

Dus heb ik besloten het syn3_build aan te passen zodat je nu ook INSTALL_OPTS kan zetten, voor de extra make install opties. Dus:

psy npl # mcedit -dc syn3/syn3_build/src/syn3_build_automake

psy npl # ./rebuildcheck syn3_build
REBUILD REQUIRED: ./src/syn3_build_automake has changed!
REBUILDING /home/psy/syn3/npl/syn3/syn3_build/syn3_build.SlackBuild:
Building package without buildroot!
tar-1.13: syn3_build.pkg.tar is the archive; not dumped
Updating md5 for /home/psy/syn3/npl/syn3/syn3_build/syn3_build.SlackBuild...
Updating dependency information for /home/psy/syn3/npl/syn3/syn3_build/syn3_build.SlackBuild...
All rebuilds completed.
psy npl # mcedit packagename.SlackBuild.example

Het voorbeeld script heb ik ook aangepast.

Aanpassing openmsx buildscript

Hierna heb ik het buildscript van openmsx aangepast en deze nieuwe INSTALL_OPTS instelling gebruikt. Het buildscript ziet er nu zo uit:

#haal illegale tune= optie weg!
sed -i 's/-mtune=pentium3//g' $SRC_DIR/build/flavour-i686.mk || exit 1

#build and install sourcefiles
#(use one of the other syn3_build_* scripts when needed)
export CONFIGURE_OPTS=""
export MAKE_OPTS="INSTALL_BASE=/usr"
export INSTALL_OPTS="INSTALL_BASE=/tmp/pkg/usr"
#export NOTEST=1
syn3_build_automake $SRC_DIR /tmp/pkg || exit 1

Na een rebuild/remoteinstall nog eens testen op de testserver:

[Syn-3] root@psy.datux.nl /home/media# /usr/bin/openmsx
info: Using default machine: C-BIOS_MSX2+
warning: Couldn't load SRAM cbios-msx2+.cmos (Error opening file "/root/.openMSX/persistent/C-BIOS_MSX2+/untitled1/cbios-msx2+.cmos").
Segmentation fault
[Syn-3] root@psy.datux.nl /home/media# svc -u /service/X/
[Syn-3] root@psy.datux.nl /home/media# DISPLAY=:0 /usr/bin/openmsx
info: Using default machine: C-BIOS_MSX2+
warning: Couldn't load SRAM cbios-msx2+.cmos (Error opening file "/root/.openMSX/persistent/C-BIOS_MSX2+/untitled1/cbios-msx2+.cmos").

Nu komen we verder, maar krijgen we een segfault. We starten de X server en geven het display op in de hoop dat het hier wat mee te maken heeft. Dit helpt inderdaad en openmsx start op!

Games werken nu, maar als je 'set' doet in openmsx krijg je nog steeds een segfault. Het is dus nodig om dit nader te onderzoeken.

Dit doe later

Debuggen segfault

Roms en settings

Er zijn nog wat dingen nodig zoals originele Boost roms etc. en een pack met .roms om te spelen. Dit fix ik andere keer.