Making VNC work on FreeBSD/Sparc64

Anders Nordby anders at FreeBSD.org
Mon Jun 30 15:52:38 PDT 2003


Hi,

Attached is a minimal diff to make the vnc port successfully build + run
(Xvnc starts!) on FreeBSD/Sparc64. It doesn't work well yet, however I
thought I'd share my results so far in case someone wanted to help out.
When trying to connect to Xvnc running in 5.1-RELEASE on my Blade 100
from 4.7-STABLE on i386, vncviewer dumps core. Truss log of vncviewer
running on my i386 system when this happens:

(..)
break(0x80de000)                                 = 0 (0x0)
socket(0x2,0x1,0x0)                              = 4 (0x4)
connect(0x4,{ AF_INET 0.0.0.0:0 },16)            = 0 (0x0)
setsockopt(0x4,0x6,0x1,0xbfbff718,0x4)           = 0 (0x0)
getpeername(0x4,{ AF_INET 192.168.78.3:5901 },0xbfbff664) = 0 (0x0)
getsockname(0x4,{ AF_INET 192.168.78.1:2781 },0xbfbff664) = 0 (0x0)
select(0x5,0xbfbff270,0x0,0x0,0xbfbff268)        = 0 (0x0)
poll(0x80cd1e0,0x1,0x0)                          = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfe9fc)                     = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfe9fc)                     = 0 (0x0)
gettimeofday(0xbfbff1ec,0x0)                     = 0 (0x0)
poll(0x80cd1e0,0x2,0xffffffff)                   = 1 (0x1)
ioctl(3,FIONREAD,0xbfbfea4c)                     = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfea4c)                     = 0 (0x0)
poll(0x80cd1e0,0x1,0x0)                          = 0 (0x0)
read(0x4,0x80ce000,0x2000)                       = 12 (0xc)
VNC server supports protocol version 3.3 (viewer 3.3)
write(2,0xbfbfeff8,54)                           = 54 (0x36)
write(4,0x80d0000,12)                            = 12 (0xc)
select(0x5,0xbfbff270,0x0,0x0,0xbfbff268)        = 0 (0x0)
poll(0x80cd1e0,0x1,0x0)                          = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfe9fc)                     = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfe9fc)                     = 0 (0x0)
gettimeofday(0xbfbff1ec,0x0)                     = 0 (0x0)
poll(0x80cd1e0,0x2,0xffffffff)                   = 1 (0x1)
ioctl(3,FIONREAD,0xbfbfea4c)                     = 0 (0x0)
ioctl(3,FIONREAD,0xbfbfea4c)                     = 0 (0x0)
poll(0x80cd1e0,0x1,0x0)                          = 0 (0x0)
read(0x4,0x80ce000,0x2000)                       = 20 (0x14)
break(0xc542d000)                                ERR#12 'Cannot allocate
memory'
SIGNAL 11
SIGNAL 11
Process stopped because of:  16
process exit, rval = 139
Segmentation fault (core dumped)

Trussing Xvnc on the sparc64 system shows this:

(null)()                                         = 1 (0x1)
select(0x4,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 1 (0x1)
accept(0x3,{ AF_INET 192.168.78.1:2781 },0x7fdfffff4dc) = 5 (0x5)
fcntl(0x5,0x4,0x4)                               = 0 (0x0)
setsockopt(0x5,0x6,0x1,0x7fdfffff4d8,0x4)        = 0 (0x0)
write(2,0x40a7803f,1)                            = 1 (0x1)
gettimeofday(0x7fdfffff230,0x0)                  = 0 (0x0)
write(2,0x7fdffffe870,18)                        = 18 (0x12)
write(2,0x7fdffffe930,40)                        = 40 (0x28)
gettimeofday(0x7fdfffff200,0x0)                  = 0 (0x0)
getpeername(0x5,{ AF_INET 192.168.78.1:2781 },0x7fdfffff3dc) = 0 (0x0)
write(5,0x7fdfffff400,12)                        = 12 (0xc)
select(0x5,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 0 (0x0)
gettimeofday(0x7fdfffff3d0,0x0)                  = 0 (0x0)
select(0x3f,0x35a8a0,0x0,0x0,0x7fdfffff630)      = 1 (0x1)
select(0x6,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 1 (0x1)
read(0x5,0x7fdfffff400,0xc)                      = 12 (0xc)
gettimeofday(0x7fdfffff050,0x0)                  = 0 (0x0)
write(2,0x7fdffffe690,18)                        = 18 (0x12)
write(2,0x7fdffffe750,21)                        = 21 (0x15)
gettimeofday(0x7fdfffff080,0x0)                  = 0 (0x0)
getpid()                                         = 37935 (0x942f)
write(5,0x7fdfffff210,20)                        = 20 (0x14)
select(0x5,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 0 (0x0)
gettimeofday(0x7fdfffff3d0,0x0)                  = 0 (0x0)
select(0x3f,0x35a8a0,0x0,0x0,0x7fdfffff630)      = 1 (0x1)
select(0x6,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 1 (0x1)
read(0x5,0x7fdfffff400,0x10)                     = 0 (0x0)
gettimeofday(0x7fdfffff150,0x0)                  = 0 (0x0)
write(2,0x7fdffffe790,18)                        = 18 (0x12)
write(2,0x7fdffffe850,41)                        = 41 (0x29)
close(5)                                         = 0 (0x0)
gettimeofday(0x7fdffffefd0,0x0)                  = 0 (0x0)
write(2,0x7fdffffe610,18)                        = 18 (0x12)
write(2,0x7fdffffe6d0,25)                        = 25 (0x19)
gettimeofday(0x7fdffffef00,0x0)                  = 0 (0x0)
write(2,0x7fdffffe540,18)                        = 18 (0x12)
write(2,0x7fdffffe600,12)                        = 12 (0xc)
gettimeofday(0x7fdffffef00,0x0)                  = 0 (0x0)
write(2,0x7fdffffe540,18)                        = 18 (0x12)
write(2,0x7fdffffe600,47)                        = 47 (0x2f)
select(0x5,0x7fdfffff500,0x0,0x0,0x7fdfffff4f0)  = 0 (0x0)
gettimeofday(0x7fdfffff3d0,0x0)                  = 0 (0x0)
^C

IMO, running VNC off headless UltraSPARC systems is a practical way to
run and test GUI stuff without connecing a monitor and keyboard.

Oh, BTW, NetBSD has some useful patches in their pkgsrc patches for vnc,
see http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/vnc/.

Cheers,

-- 
Anders.
-------------- next part --------------
Binary files vnc.old/Xvnc.core and vnc/Xvnc.core differ
diff -Nur vnc.old/files/patch-FreeBSD.cf vnc/files/patch-FreeBSD.cf
--- vnc.old/files/patch-FreeBSD.cf	Thu Jan  1 01:00:00 1970
+++ vnc/files/patch-FreeBSD.cf	Mon Jun 30 23:17:45 2003
@@ -0,0 +1,51 @@
+--- Xvnc/config/cf/FreeBSD.cf.orig	Sat May 11 12:57:05 2002
++++ Xvnc/config/cf/FreeBSD.cf	Mon Jun 30 22:50:52 2003
+@@ -26,6 +26,7 @@
+ #define UseGas			YES
+ #define GnuCpp			YES
+ #define HasNdbm         	YES
++#define DBMLibrary              /**/
+ #define HasPutenv       	YES
+ #define HasSnprintf		YES
+ #define HasBSD44Sockets 	YES
+@@ -40,6 +41,7 @@
+ #define AvoidNullMakeCommand	YES
+ #define StripInstalledPrograms	YES
+ #define CompressAllFonts	YES
++#define GzipFontCompression	YES
+ #define Malloc0ReturnsNull	YES
+ #define NeedConstPrototypes	YES
+ #define NeedFunctionPrototypes	YES
+@@ -50,7 +52,7 @@
+ #define MkdirHierCmd		mkdir -p
+ 
+ #define CcCmd			cc
+-#define CppCmd			/usr/libexec/cpp
++#define CppCmd			cpp
+ #define PreProcessCmd		CppCmd
+ #define StandardCppDefines	-traditional
+ #if defined(UseInstalled) && (!defined(XF86LinkKit) || !XF86LinkKit)
+@@ -223,12 +225,22 @@
+ # define GccGasOption /**/
+ #endif
+ 
++#ifndef XFree86ServerDefines
++#define XFree86ServerDefines
++#endif
++#if defined(SparcArchitecture)
++#define ServerExtraDefines GccGasOption
++#else
+ #define ServerExtraDefines GccGasOption XFree86ServerDefines
+-
++#endif
+ #define StandardDefines	-DCSRG_BASED
+ 
+ #if OSMajorVersion > 1
++#ifdef SparcArchitecture
++#define ServerOSDefines		-DDDXOSINIT
++#else
+ #define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
++#endif
+ #define XawI18nDefines		-DUSE_XWCHAR_STRING
+ #define HasMakefileSafeInclude	YES
+ #define IncludeMakefile(file) @@# dependencies are in .depend
diff -Nur vnc.old/files/patch-cf-Imake.cf vnc/files/patch-cf-Imake.cf
--- vnc.old/files/patch-cf-Imake.cf	Thu Jan  1 01:00:00 1970
+++ vnc/files/patch-cf-Imake.cf	Wed Jun 25 23:17:36 2003
@@ -0,0 +1,13 @@
+--- Xvnc/config/cf/Imake.cf.orig	Sat May 11 10:57:05 2002
++++ Xvnc/config/cf/Imake.cf	Fri Jun  6 05:33:03 2003
+@@ -154,6 +154,10 @@
+ #  define i386Architecture
+ #  undef i386
+ # endif
++# ifdef __sparc__
++#  define SparcArchitecture
++#  undef sparc
++# endif
+ #endif /* __FreeBSD__ */
+ 
+ #ifdef AMOEBA
diff -Nur vnc.old/files/patch-cfb-stipsparc.s vnc/files/patch-cfb-stipsparc.s
--- vnc.old/files/patch-cfb-stipsparc.s	Thu Jan  1 01:00:00 1970
+++ vnc/files/patch-cfb-stipsparc.s	Tue Jun 24 23:19:21 2003
@@ -0,0 +1,11 @@
+--- Xvnc/programs/Xserver/cfb/stipsparc.s.orig	Fri Jun  6 08:31:12 2003
++++ Xvnc/programs/Xserver/cfb/stipsparc.s	Fri Jun  6 08:31:53 2003
+@@ -85,7 +85,7 @@
+ #define ForEachBits	LY4
+ #define NextBits	LY5
+ 
+-#ifdef SVR4
++#if defined(SVR4) || defined(__ELF__)
+ #ifdef TETEXT
+ #define	_cfbStippleStack	cfbStippleStackTE
+ #else
diff -Nur vnc.old/files/patch-cfb-stipsprc32.s vnc/files/patch-cfb-stipsprc32.s
--- vnc.old/files/patch-cfb-stipsprc32.s	Thu Jan  1 01:00:00 1970
+++ vnc/files/patch-cfb-stipsprc32.s	Tue Jun 24 23:19:21 2003
@@ -0,0 +1,11 @@
+--- Xvnc/programs/Xserver/cfb/stipsprc32.s.orig	Fri Jun  6 08:41:42 2003
++++ Xvnc/programs/Xserver/cfb/stipsprc32.s	Fri Jun  6 08:42:09 2003
+@@ -81,7 +81,7 @@
+ #define ForEachBits	LY4
+ #define NextBits	LY5
+ 
+-#ifdef SVR4
++#if defined(SVR4) || defined(__ELF__)
+ #ifdef TETEXT
+ #define	_cfb32StippleStack	cfb32StippleStackTE
+ #else


More information about the freebsd-ports mailing list