How to compile SheepShaver on RPi4?

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

Hi

Just registered on this forum, as I have a question regarding compilation of SheepShaver for the Raspberry Pi 4.
I have successfully compiled SheepShaver on a Raspberry Pi2+, on the newest version of Raspbian, and it runs and opens in RetroPie 4.7.1 by using xinit.

However I am unable to repeat this success on the RPi4. I DO get SheepShaver to compile, using the same steps, but execution of SheepShaver crashes RetroPie badly, blanking the screen and making it totally unresponsive. I belive that som running memory is being overwritten or something like that.

On the PRi2+ the following procedure works:

git clone https://github.com/cebix/macemu
(I did try the https://github.com/kanjitalk755/macemu fork, but have not had any luck compiling it)
sudo apt-get install build-essential git
sudo apt-get install libgtk2.0-dev x11proto-xf86dga-dev libesd0-dev libxxf86dga-dev libxxf86dga1 libsdl1.2-dev
cd SheepShaver/
make links
cd src/Unix/
NO_CONFIGURE=1 ./autogen.sh
./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-gtk --enable-addressing=direct,0x10000000
make

As I said, this produces a nice running version of SheepShaver on RPi2+ (and most likely on RPi3 as well).

I understand that there are architectural differences between the to Raspberries, as it goes from 32-bit to 64-bit, and there are changes to the addressing-layout. So I suspect the direct addressing option has something to do with the problem, but that is as far as I've come. I haven't done any serious C/C++-programming for 20 years, so I am not really at home in the details of the art anymore.

Suggestions, anyone?

Thank you

Frank Carvalho
User avatar
adespoton
Forum All-Star
Posts: 3235
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: How to compile SheepShaver on RPi4?

Post by adespoton »

Frank Carvalho wrote: Mon Jan 18, 2021 11:40 am Hi

Just registered on this forum, as I have a question regarding compilation of SheepShaver for the Raspberry Pi 4.
I have successfully compiled SheepShaver on a Raspberry Pi2+, on the newest version of Raspbian, and it runs and opens in RetroPie 4.7.1 by using xinit.

However I am unable to repeat this success on the RPi4. I DO get SheepShaver to compile, using the same steps, but execution of SheepShaver crashes RetroPie badly, blanking the screen and making it totally unresponsive. I belive that som running memory is being overwritten or something like that.

On the PRi2+ the following procedure works:

git clone https://github.com/cebix/macemu
(I did try the https://github.com/kanjitalk755/macemu fork, but have not had any luck compiling it)
sudo apt-get install build-essential git
sudo apt-get install libgtk2.0-dev x11proto-xf86dga-dev libesd0-dev libxxf86dga-dev libxxf86dga1 libsdl1.2-dev
cd SheepShaver/
make links
cd src/Unix/
NO_CONFIGURE=1 ./autogen.sh
./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-gtk --enable-addressing=direct,0x10000000
make

As I said, this produces a nice running version of SheepShaver on RPi2+ (and most likely on RPi3 as well).

I understand that there are architectural differences between the to Raspberries, as it goes from 32-bit to 64-bit, and there are changes to the addressing-layout. So I suspect the direct addressing option has something to do with the problem, but that is as far as I've come. I haven't done any serious C/C++-programming for 20 years, so I am not really at home in the details of the art anymore.

Suggestions, anyone?

Thank you

Frank Carvalho
I'd suggest trying further to get the kanjitalk755 fork working; it will require SDL2, but also has better success working with managing "direct" addressing. I'm unsure of how Raspbian handles address allocation though, so it may not be transparently re-allocating calls based at 0 -- which hasn't been an issue under 32-bit systems, but might result in exactly what you're experiencing here.
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

OK, thanks for the response. I'll see if I can figure out how to get the kanjitalk-fork working, once more.
The way I go about this, it to use my RPi2+ as a testing ground, where I can make mistakes and experiment, before I attempt compilation and installation on my Pi400. I only have the one, so I really don't want to mess my installation up. I could get another SD-card of course......
But this is also how I observed the difference between the two versions of the RPi.

/Frank
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

I tried the kanjitalk fork first on the RPi2+, with the standard compile instruction found in the README file. Compile is fine, but when I start, I get the Settings dialog, and upon "Start" the following:

Code: Select all

sudo xinit ./SheepShaver


X.Org X Server 1.20.4
X Protocol Version 11, Revision 0
Build Operating System: Linux 5.4.0-54-generic armv8l Raspbian
Current Operating System: Linux retropie 5.4.72-v7+ #1356 SMP Thu Oct 22 13:56:54 BST 2020 armv7l
Kernel command line: coherent_pool=1M snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 bcm2708_fb.fbwidth=1824 bcm2708_fb.fbheight=984 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyAMA0,115200 console=tty1 root=PARTUUID=1054d210-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait loglevel=3 consoleblank=0 plymouth.enable=0
Build Date: 01 December 2020  05:59:57PM
xorg-server 2:1.20.4-1+rpt2+deb10u2 (https://www.debian.org/support) 
Current version of pixman: 0.36.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Wed Jan 20 19:34:01 2021
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig
ERROR: Cannot map Low Memory Globals: Invalid argument.
xinit: connection to X server lost

waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
I did add:

Code: Select all

echo "vm.mmap_min_addr = 0" >>/etc/sysctl.conf
and even a suggestion I found of adding:

Code: Select all

vm.map=0
So the low memory mapping is an issue on the RPi2+ with the default settings. Now I will try the options of the original instructions I tried.
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

I tried the original recipe for compile, with the

Code: Select all

./configure --enable-sdl-video --enable-sdl-audio --disable-vosf --disable-jit-compiler --with-gtk --enable-addressing=direct,0x10000000
Starting the app behaves the same, only now it fails with :

Code: Select all

SheepShaver V2.5 by Christian Bauer and Mar"c" Hellwig
ERROR: Cannot map first Kernel Data area: Invalid argument.
... instead of the Low Memory message from before.
So I am going back to the vanilla configuration, which BTW outputs this during configure. Not sure if it sheds a light on the issue or not:

Code: Select all

checking how to disable position-independent code... cannot
checking whether __PAGEZERO can be Low Memory area 0x0000-0x3000... no
checking whether we can map Low Memory area 0x0000-0x3000... no
User avatar
Cat_7
Expert User
Posts: 5242
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: How to compile SheepShaver on RPi4?

Post by Cat_7 »

Hi,

Did you try to run SheepShaver as root? On my Fedora machine that gets me past the "cannot map" error.

Best,
Cat_7
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

Yes I did, and it still didn't get me past that error. Had to startx as root, and start SheepShaver from the initial Xterm, but alas, it still fails.
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

I do believe that I solved the problem!
I had to go with the cebix fork to make it work. Once again I followed the recipe above with the direct addressing. But this time I checked the items of

Code: Select all

sysctl -a
and I noticed that the vm.mmap_min_addr = 0 line wasn't there, even though it is in /etc/sysctl.conf. Aha! So after running sysctl -p it appears in the list, and now my PPC emulation finally starts on the RPi 400! So for some reason the /etc/sysctl.conf file is ignored at boot, and this is the real problem.
After doing this, I can now start SheepShaver with 512Mb RAM and boot with the proper disks and ROM in RetroPie 4.7.1, using this line:

Code: Select all

sudo xinit /home/pi/compile/macemu/ .......  /SheepShaver
As expected it runs fast and smooth on the RPi4.

I still haven't had any luck getting the kanjitalk branch to run, but I might now give it just another try.
Last edited by Frank Carvalho on Sat Feb 13, 2021 2:58 pm, edited 1 time in total.
Frank Carvalho
Space Cadet
Posts: 8
Joined: Mon Jan 18, 2021 10:17 am

Re: How to compile SheepShaver on RPi4?

Post by Frank Carvalho »

Dang! This was so much the problem. After compiling the kanjitalk branch with direct addressing, it also boots!
So I will go with this branch in the future, as it is actively developed.
Post Reply