Error building Sheepshaver from git on Lubuntu 16.04

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
mark_k
Space Cadet
Posts: 2
Joined: Sat Feb 06, 2016 8:15 pm

Error building Sheepshaver from git on Lubuntu 16.04

Post by mark_k »

Hi,

I'm using Lubuntu 16.04 x86-64 and today downloaded macemu git.

I had previously installed the Ubuntu basilisk2 package, did apt-get build-dep basilisk2 then removed the basilisk2 package.

Building BasiliskII seemed to work fine. At least, I can run the binary and the GUI window appears; I didn't test further than that yet.

However I get an error when trying to build SheepShaver. The last lines output are:

Code: Select all

./dyngen -o basic-dyngen-ops.hpp obj/basic-dyngen-ops.o
dyngen: unexpected external symbol __stack_chk_fail
Makefile:225: recipe for target 'basic-dyngen-ops.hpp' failed
make: *** [basic-dyngen-ops.hpp] Error 1
Is there an easy fix? Maybe I need to install another package before building??? There is no Ubuntu SheepShaver package, so I can't do the apt-get build-dep trick.

Here's a longer extract from the end of the console output:

Code: Select all

../kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp:31:18: note: conflicts with ‘A2’
 register uintptr A##REG asm(REG_T##REG); \
                  ^
../kpx_cpu/src/cpu/jit/basic-dyngen-ops.cpp:35:1: note: in expansion of macro ‘DYNGEN_DEFINE_GLOBAL_REGISTER’
 DYNGEN_DEFINE_GLOBAL_REGISTER(2);
 ^
g++ -xc -I../kpx_cpu/include -I../kpx_cpu/src -DUSE_JIT -I../include -I. -I../CrossPlatform -I../slirp -DHAVE_CONFIG_H -D_REENTRANT -DDATADIR=\"/usr/local/share/SheepShaver\" -g -O2   -c ../kpx_cpu/src/cpu/jit/dyngen.c -o obj/dyngen.dgo
../kpx_cpu/src/cpu/jit/dyngen.c: In function ‘gen_code’:
../kpx_cpu/src/cpu/jit/dyngen.c:2088:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
                         fprintf(outfile, "    label_offsets[%d] = %d + (code_ptr() - gen_code_buf);\n", n, val - start_offset);
                                          ^
../kpx_cpu/src/cpu/jit/dyngen.c: In function ‘patch_relocations’:
../kpx_cpu/src/cpu/jit/dyngen.c:2379:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
     fprintf(outfile, "    jmp_addr[%d] = code_ptr() + %d;\n",
                      ^
../kpx_cpu/src/cpu/jit/dyngen.c: In function ‘gen_file’:
../kpx_cpu/src/cpu/jit/dyngen.c:2926:22: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘host_ulong {aka long unsigned int}’ [-Wformat=]
     fprintf(outfile, "DEFINE_CST(%s,0x%xL)\n\n", name, *((host_ulong *)(data + sym->st_value)));
                      ^
g++ -I../kpx_cpu/include -I../kpx_cpu/src -DUSE_JIT -I../include -I. -I../CrossPlatform -I../slirp -DHAVE_CONFIG_H -D_REENTRANT -DDATADIR=\"/usr/local/share/SheepShaver\" -g -O2   -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -c ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp -o obj/cxxdemangle.dgo
g++ -o dyngen -Wl,-T,ldscripts/linux-x86_64.ld 	obj/dyngen.dgo obj/cxxdemangle.dgo
./dyngen -o basic-dyngen-ops.hpp obj/basic-dyngen-ops.o
dyngen: unexpected external symbol __stack_chk_fail
Makefile:225: recipe for target 'basic-dyngen-ops.hpp' failed
make: *** [basic-dyngen-ops.hpp] Error 1
mark_k
Space Cadet
Posts: 2
Joined: Sat Feb 06, 2016 8:15 pm

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by mark_k »

Replying to my own post...

I did

Code: Select all

CXXFLAGS="-fno-stack-protector -g -O2" CFLAGS="-fno-stack-protector -O2" ./autogen.sh
after which make worked.

On running the SheepShaver executable and clicking Quit I get an X-related error message. Is that normal or does it suggest a build problem?

Code: Select all

$ ./SheepShaver 
SheepShaver V2.4 by Christian Bauer and Mar"c" Hellwig
The program 'SheepShaver' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 9 error_code 2 request_code 105 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by Cat_7 »

Hi,

As far as I can remember, X-windows builds have always thrown this error.

Best,
Cat_7
qiet72
Space Cadet
Posts: 4
Joined: Thu Jun 30, 2016 6:48 am

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by qiet72 »

Also tried to build SheepShaver via git sources. The solution posted in the thread helped me build it but I get a different error when trying to run it:

Code: Select all

./SheepShaver --disk ~/mac/macos904.dsk
SheepShaver V2.4 by Christian Bauer and Mar"c" Hellwig
Reading ROM file...
Detected CPU features: MMX SSE SSE2 SSE3 SSSE3
PowerPC CPU emulator by Gwenole Beauchesne
SIGSEGV
  pc 0x4010033e0
  ea 0x4010033e0
 r0 00000000   r1 68ffe000   r2 00000000   r3 40b0d000
 r4 68fff000   r5 00000000   r6 00000000   r7 40b16ec0
 r8 68fff000   r9 00002000  r10 00000000  r11 68fff100
r12 40c6e740  r13 68ffead8  r14 00100000  r15 00100000
r16 00000000  r17 00000000  r18 00000000  r19 00000000
r20 00000000  r21 00000000  r22 00000000  r23 00000000
r24 00000000  r25 00000000  r26 00000000  r27 00000000
r28 00000000  r29 00000000  r30 00000000  r31 00000000
 f0 0.00000   f1 0.00000   f2 0.00000   f3 0.00000
 f4 0.00000   f5 0.00000   f6 0.00000   f7 0.00000
 f8 0.00000   f9 0.00000  f10 0.00000  f11 0.00000
f12 0.00000  f13 0.00000  f14 0.00000  f15 0.00000
f16 0.00000  f17 0.00000  f18 0.00000  f19 0.00000
f20 0.00000  f21 0.00000  f22 0.00000  f23 0.00000
f24 0.00000  f25 0.00000  f26 0.00000  f27 0.00000
f28 0.00000  f29 0.00000  f30 0.00000  f31 0.00000
 lr 40b10260  ctr 00000000   cr 40000000  xer 20000000
 pc 40b10214 fpscr 00000000
  0x40b101f4:  bgt+    0x40b101e8
  0x40b101f8:  addi    r11,r1,3424
  0x40b101fc:  li      r10,256
  0x40b10200:  lwz     r1,10244(0)
  0x40b10204:  lis     r13,-8531
  0x40b10208:  lis     r14,16
  0x40b1020c:  lis     r15,16
  0x40b10210:  bl      0x40b162b0
 >0x40b10214:  stw     r0,2332(r1)
  0x40b10218:  stw     r3,1584(r1)
  0x40b1021c:  stw     r7,1456(r1)
  0x40b10220:  addi    r12,r14,1
  0x40b10224:  stw     r12,3116(r1)
  0x40b10228:  addi    r8,r1,4096
  0x40b1022c:  stw     r8,1588(r1)
  0x40b10230:  stw     r13,1592(r1)
  0x40b10234:  add     r12,r13,r15
Also, I would like to compile a new version of the sheep_net.ko driver since the old one is incompatible with kernel 4.4.0. When I try to compile it, I get this error:

Code: Select all

make
make -C /lib/modules/4.4.0-24-generic/build M=$PWD modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-24-generic'
  CC [M]  /tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.o
/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.c: In function ‘sheep_net_ioctl’:
/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.c:590:13: error: too few arguments to function ‘sk_alloc’
    v->skt = sk_alloc(dev_net(v->ether), GFP_USER, 1, &sheep_proto);
             ^
In file included from /tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.c:70:0:
include/net/sock.h:1511:14: note: declared here
 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
              ^
scripts/Makefile.build:264: recipe for target '/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.o' failed
make[2]: *** [/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver/sheep_net.o] Error 1
Makefile:1402: recipe for target '_module_/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver' failed
make[1]: *** [_module_/tmp/t/macemu/SheepShaver/src/Unix/Linux/NetDriver] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-24-generic'
Makefile:14: recipe for target 'sheep_net.ko' failed
make: *** [sheep_net.ko] Error 2
I am not totally without hope. I am currently running a 2010 amd64 version build by someone else, but networking is currently not working - that is why I would like to get a sheep_net.ko driver to work with my kernel 4.4.0 system.

qiet72
qiet72
Space Cadet
Posts: 4
Joined: Thu Jun 30, 2016 6:48 am

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by qiet72 »

Hi,

I narrowed down the compilation problems of sheep_net.ko. It seems as soon as you switch over to the kernel 4.x sources the compilation fails. I have now tried from Ubuntu 12.04 up to Ubuntu 16.04. Under Ubuntu 14.04, I have tried kernels 3.13, 3.16, 3.19, and 4.20. Sheep_net compiles successfully under 3.x kernels but fails as soon as you run under 4.x kernels.

Here is the error messages for 4.20 sources:

Code: Select all

user@user-VirtualBox:~/macemu/BasiliskII/src/Unix/Linux/NetDriver$ make
make -C /lib/modules/4.2.0-41-generic/build M=$PWD modules
make[1]: Entering directory `/usr/src/linux-headers-4.2.0-41-generic'
  CC [M]  /home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver/sheep_net.o
/home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver/sheep_net.c: In function ‘sheep_net_ioctl’:
/home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver/sheep_net.c:590:4: error: too few arguments to function ‘sk_alloc’
    v->skt = sk_alloc(dev_net(v->ether), GFP_USER, 1, &sheep_proto);
    ^
In file included from /home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver/sheep_net.c:70:0:
include/net/sock.h:1532:14: note: declared here
 struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
              ^
make[2]: *** [/home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver/sheep_net.o] Error 1
make[1]: *** [_module_/home/user/macemu/BasiliskII/src/Unix/Linux/NetDriver] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-4.2.0-41-generic'
make: *** [sheep_net.ko] Error 2
Will let you know if I find out more.

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

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by adespoton »

It's looking like you're getting segmentation faults shortly after loading the ROM and detecting ROM capabilities?

Which ROM are you using? Does switching to the ROM that comes with 9.0.4 fix the issue?
qiet72
Space Cadet
Posts: 4
Joined: Thu Jun 30, 2016 6:48 am

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by qiet72 »

Hi,

I am currently using mac-rom-1.6--mac-os-rom-update-1.0.rom. The rom has a md5sum checksum of be65e1c4f04a3f2881d6e8de47d66454. This has worked for me for the last couple of years with the 2010 pre-built version - this version has the following build string:

SheepShaver V2.3-Pre (Apr 25 2010) by Christian Bauer and Mar"c" Hellwig

The rom you describe which has an md5 sum of 3f182e059a60546f93114ed3798d5751 does not work with my current build or with the 2010 build - I just get a "Unsupported ROM type".

Regards,
Qiet72
boomer3200
Space Cadet
Posts: 1
Joined: Sat Aug 13, 2016 12:42 am

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by boomer3200 »

I got sheep_net.ko to compile on Linux by changing line 590 of sheep_net.c to end in "&sheep_proto, 1);". Adding the trailing ", 1" addresses the too few arguments error.

Seems to work correctly in my testing so far. Figured other people with the same question would find this when searching.

edit: added underscore to filename
qiet72
Space Cadet
Posts: 4
Joined: Thu Jun 30, 2016 6:48 am

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by qiet72 »

Hmm, the latest git release seems to have fixed the error. I have now enabled networking via "ether slirp" line in .sheepshaver_prefs.

I can confirm that I get an ip address now in Mac OS but any attempts to actually use the TCP/IP stack crashes the emulator. Here is the dump:

Code: Select all

SheepShaver V2.3-Pre (Apr 25 2010) by Christian Bauer and Mar"c" Hellwig
Reading ROM file...
WARNING: Cannot open /dev/mixer (No such file or directory)
WARNING: Cannot open /dev/dsp (No such file or directory)
WARNING: Cannot open ESD connection
WARNING: No audio device found, audio output will be disabled.
Detected CPU features: MMX SSE SSE2 SSE3 SSE4
PowerPC CPU emulator by Gwenole Beauchesne
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
WARNING: Unknown DiskStatus(6)
SIGSEGV
  pc 0x780af410
  ea 0xf4004160
 r0 00000000   r1 07b853e4   r2 00000000   r3 001d4b34
 r4 00004250   r5 000066f2   r6 0000302f   r7 00000006
 r8 fffffffe   r9 0000a0dd  r10 00000001  r11 073af8f8
r12 0000ff00  r13 0000ffff  r14 07a43e01  r15 00000000
r16 00000000  r17 00000000  r18 00000000  r19 00000000
r20 00000000  r21 00000000  r22 00000000  r23 00000000
r24 40814a9a  r25 00000021  r26 00000000  r27 00000c42
r28 00000000  r29 40c97b80  r30 40c60000  r31 68fff000
 f0 0.00000   f1 0.00000   f2 0.00000   f3 0.00000
 f4 0.00000   f5 100000000000000.00000   f6 100000000000000000000.00000   f7 10000000000000.00000
 f8 1000000000000000000000.00000   f9 1000000.00000  f10 10000000.00000  f11 100000.00000
f12 100000000.00000  f13 0.00000  f14 0.00000  f15 0.00000
f16 0.00000  f17 0.00000  f18 0.00000  f19 0.00000
f20 0.00000  f21 0.00000  f22 0.00000  f23 0.00000
f24 0.00000  f25 0.00000  f26 0.00000  f27 0.00000
f28 0.00000  f29 0.00000  f30 0.00000  f31 0.00000
 lr 40cb3130  ctr 40c6e088   cr 20100300  xer 00000000
 pc 40c6cd44 fpscr 00000000
### Statistics for block compile
Total block compile count : 520306
Total emulation time : 77.0 sec
Total compile time : 0.8 sec (1.0%)

Rank      Count Ratio Name
000:   27922029 43.3% stwcx.
001:   22459833 34.8% lwarx
002:    5602108 8.7% mtfsf
003:    5533005 8.6% mffs
004:     996139 1.5% stswx
005:     992010 1.5% lswx
006:     397934 0.6% icbi
007:     287133 0.4% mftb
008:     255373 0.4% fcmpu
009:      37435 0.1% lswi
010:      37435 0.1% stswi
011:       1175 0.0% fctiwz
012:          2 0.0% fcmpo
013:          0 0.0% invalid
014:          0 0.0% add
015:          0 0.0% addc
016:          0 0.0% adde
017:          0 0.0% addi
018:          0 0.0% addic
019:          0 0.0% addic.
SIGSEGV
  pc 0x10142500
  ea 0x10142500
 r0 000f65ec   r1 073af280   r2 000f620c   r3 072f7098
 r4 68fff740   r5 00000034   r6 000deb30   r7 00911ecc
 r8 00000002   r9 00000001  r10 ffffb8d3  r11 001e8408
r12 40c6dcf0  r13 00000000  r14 00000000  r15 00000000
r16 00000000  r17 00000000  r18 00000000  r19 00000000
r20 07a245f0  r21 00000000  r22 078d41e8  r23 00000001
r24 07a24f70  r25 40833ca0  r26 000000c0  r27 00000000
r28 073af280  r29 002d80b8  r30 002d80ac  r31 68fff740
 f0 39786411494087468539930398002944380220833973915714639212928780406949324869107100688580608.00000   f1 0.00000   f2 0.00000   f3 44145814470434184676817480413825172878896787236763273003218227073441988259449504839622184336604641658134649612521353887435370499477114388200040282876477340452931946825783965007673502791955714063335226124788558292055136289735437065117163874791600786839420089068169897411955533792935936.00000
 f4 0.00000   f5 100000000000000.00000   f6 100000000000000000000.00000   f7 10000000000000.00000
 f8 1000000000000000000000.00000   f9 1000000.00000  f10 10000000.00000  f11 100000.00000
f12 100000000.00000  f13 0.00000  f14 0.00000  f15 0.00000
f16 0.00000  f17 0.00000  f18 0.00000  f19 0.00000
f20 0.00000  f21 0.00000  f22 0.00000  f23 0.00000
f24 0.00000  f25 0.00000  f26 0.00000  f27 0.00000
f28 0.00000  f29 0.00000  f30 0.00000  f31 0.00000
 lr 001e8d44  ctr 001e8408   cr 28000804  xer 20000000
 pc 40c6dcf0 fpscr 02002000
### Statistics for block compile
Total block compile count : 520343
Total emulation time : 77.0 sec
Total compile time : 0.8 sec (1.0%)
Any suggestions here? I will continue experimenting and let you know if I find anything new.
Qiet72
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Error building Sheepshaver from git on Lubuntu 16.04

Post by Ronald P. Regensburg »

Make sure in your .sheepshaver_prefs is the line:

Code: Select all

ignoresegv true
(If ignoresegv happens to appear on two lines, set them both to true.)
Post Reply