[comp.sources.d] xroach problems.

ramabads@cs.rpi.edu (Shiva ) (03/27/91)

I am having difficulty compiling xroach, which I took off comp.sources.x

It compiles fine, but on trying to run it, I get 

	ld.so: undefined symbol : __XtInherit

Could some turn on the light ?

Thanks,
-shiva
-=-
Shivkumar Ramabadran          (shiva)             ramabads@turing.cs.rpi.edu

"I once wrote a Lisp program.  It wrote back to me."
-=-

simonm@mel.dit.csiro.au (Simon McClenahan) (03/27/91)

In article <+j7f0b+@rpi.edu>, ramabads@cs.rpi.edu (Shiva ) writes:
|> 
|> I am having difficulty compiling xroach, which I took off comp.sources.x
|> 
|> It compiles fine, but on trying to run it, I get 
|> 
|> 	ld.so: undefined symbol : __XtInherit
|> 
|> Could some turn on the light ?
|> 
I can't help you, but I manage to compile it, and it just plain doesn't work!

Does it work with a monochrome monitor?

--
|Simon McClenahan CSIRO, | Cray Supercomputing Support Group             |
|55 Barry St, Carlton,   | (TEL) +61 3 347 8644   (FAX) +61 3 347 8987   |
|VIC 3053, Australia     | Internet:simonm@mel.dit.csiro.au              |
|                     Waste not what I want...                           |

phil@inetg1.ARCO.COM (Phil Meyer) (03/27/91)

In article <1991Mar27.060714.19885@mel.dit.csiro.au>, simonm@mel.dit.csiro.au
(Simon McClenahan) writes:
> 
> In article <+j7f0b+@rpi.edu>, ramabads@cs.rpi.edu (Shiva ) writes:
> |> 
> |> I am having difficulty compiling xroach, which I took off comp.sources.x
> |> 
> |> It compiles fine, but on trying to run it, I get 
> |> 
> |> 	ld.so: undefined symbol : __XtInherit
> |> 
> |> Could some turn on the light ?
> |> 
> I can't help you, but I manage to compile it, and it just plain doesn't
> work!
> 
> Does it work with a monochrome monitor?

When I tried it, it works ok, but the SparkStation 2 is too fast for it.
The little roaches seem to just buzz around so fast that the animated effect is
lost.  I'll probably put some kind of delay in there.

Anyways, it works fine under SUNOS 4.1.1 generic X11R4.
-- 
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
| Phil Meyer         phil@arco.com  Work:(214) 754-6805                      |
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

stumpf@Informatik.TU-Muenchen.DE (Markus Stumpf) (03/27/91)

This is an excerpt from the FAQs of comp.windows.x
----------------------------------------------------------------------
Subject: 58)  What are these problems with "_XtInherit not found" on the Sun?
When I run a X program that I wrote on a SunOS 4.0.3 or 4.1 machine I get the 
error "ld.so: symbol not found _XtInherit".

	What you are seeing is a side-effect of a kludge in the R4 libXt.a to 
get Sun shared libraries working.  Apparently, you can't share a function that 
is both called and compared, as _XtInherit is. This was handled by putting 
_XtInherit in the same file as a function that is always used, thereby 
guaranteeing that it would be loaded -- that is, in Initialize.c, where 
XtToolkitInitialize() and XtInitialize() reside. These routines would normally
be called.

	You are probably seeing this error because your program is not a normal
Xt-based program and does not call XtToolkitInitialize() anywhere. 
	1) it may be a program that uses Xt functions but never opens a 
connection to the X server.  [OSF/Motif's 1.1 UIL has this problem; it calls 
XtMalloc() and other Xt functions.] The solution is to add the call to your 
program; the function does not have to be executed, just linked in.
	2) alternatively, your program doesn't need any Xt functions and is
correct in not calling XtToolkitInitialize() -- it may be an Xlib or XView 
program. In this case, you can remove -lXt from your link command. 

	It should not be necessary to link the shared libraries statically,
although this will certainly solve the problem.
	
[from jordan@morgan.COM (Jordan Hayes) and Danny Backx (db@sunbim.be); 11/90]

----------------------------------------------------------------------

-- 
+- Markus Stumpf                         Technische Universitaet Muenchen   -+
|                            Institut fuer Informatik, Rechnerbetriebsgruppe |
|  stumpf@informatik.tu-muenchen.de              Postfach 202420             |
+-   ...@{unido.uucp,relay.cs.net}        D-8000 Muenchen 2, West Germany   -+

simon@opal.CS.TU-Berlin.DE (Simon Leinen) (03/27/91)

>>>>> On 27 Mar 91 06:07:14 GMT, simonm@mel.dit.csiro.au (Simon
>>>>> McClenahan) said:

SimonM> I can't help you, but I manage to compile it, and it just
SimonM> plain doesn't work!

Do you use tvtwm? Then the ordinary root window (on which the
cockroaches run around) will be covered by the virtual desktop window.
You have to #include "vroot.h" in the `xroach.c' file *after*
<Xlib.h>.  The file `vroot.h' redefines two preprocessor macros
`RootWindow' and `DefaultRootWindow' to do the right thing in the
presence of a virtual desktop.  It was written by Andreas Stolcke of
ICSI and can be FTPed from export.lcs.mit.edu, File /contrib/vroot.h.

SimonM> Does it work with a monochrome monitor?

Yes, it does.
-- 
Simon.

bush@ecs.ox.ac.uk (Mark Bush) (03/28/91)

In article <1991Mar27.083557.15817@Arco.COM> phil@Arco.com writes:
>In article <1991Mar27.060714.19885@mel.dit.csiro.au>, simonm@mel.dit.csiro.au
>(Simon McClenahan) writes:
>> 
>> I can't help you, but I manage to compile it, and it just plain doesn't
>> work!
>> 
>> Does it work with a monochrome monitor?
>
>When I tried it, it works ok, but the SparkStation 2 is too fast for it.
>The little roaches seem to just buzz around so fast that the animated effect is
>lost.  I'll probably put some kind of delay in there.

I've compiled it up on an IPC and a lowly Sun3/50.  It appears that it's not
the speed that ruins it.  If you run with one roach and close all windows,
you'll find that the roach moves at a reasonable speed, but that most of the
time it is un-painted.  It seems to flash on for a brief moment.  At least
that's how it runs on all the Suns I've compiled it on.

Anyone else seen this?  I've had only a quick glance at the source so far
and I can't see yet what the problem is.

Mark

kludge@grissom.larc.nasa.gov ( Scott Dorsey) (03/29/91)

In article <SIMON.91Mar27162454@Lessing.first.gmd.de> simon@opal.CS.TU-Berlin.DE writes:
>>>>>> On 27 Mar 91 06:07:14 GMT, simonm@mel.dit.csiro.au (Simon
>>>>>> McClenahan) said:
>
>SimonM> I can't help you, but I manage to compile it, and it just
>SimonM> plain doesn't work!
>
>Do you use tvtwm? Then the ordinary root window (on which the
>cockroaches run around) will be covered by the virtual desktop window.
>You have to #include "vroot.h" in the `xroach.c' file *after*

We are running dxwm under DecWindows.  And vroot.h seems to give a compiler
warning, which didn't worry me too much, but the roaches still don't appear.
And I know it works on my Sun machines...
--scott

colin@nbc1.ge.com (Colin Rafferty) (03/30/91)

In article <SIMON.91Mar27162454@Lessing.first.gmd.de> simon@opal.CS.TU-Berlin.DE (Simon Leinen) writes:

> >>>>> On 27 Mar 91 06:07:14 GMT, simonm@mel.dit.csiro.au (Simon
> >>>>> McClenahan) said:
> SimonM> I can't help you, but I manage to compile it, and it just
> SimonM> plain doesn't work!
> Do you use tvtwm? Then the ordinary root window (on which the
> cockroaches run around) will be covered by the virtual desktop window.
> You have to #include "vroot.h" in the `xroach.c' file *after*
> <Xlib.h>.  The file `vroot.h' redefines two preprocessor macros
> `RootWindow' and `DefaultRootWindow' to do the right thing in the
> presence of a virtual desktop.  It was written by Andreas Stolcke of
> ICSI and can be FTPed from export.lcs.mit.edu, File /contrib/vroot.h.

Alternatively, you can install this patch that I made.  Note that this
is an unofficial patch to xroach.  I sent it to the author, and he
said that he would be including it with other revisions that he's
making.  So if you don't use tvtwm, don't bother with this.  If you
do, then install this patch, and then uninstall it before you install
the official first patch.

				-Colin

--8<---8<---8<---8<---8<---8<--- cut here --8<---8<---8<---8<---8<---8<---
*** xroach.c.orig	Wed Mar 27 13:02:21 1991
--- xroach.c	Wed Mar 27 14:37:09 1991
***************
*** 5,10 ****
--- 5,14 ----
  
      jta@locus.com
      
+     Modified: Colin Rafferty (colin@nbc1.ge.com) 3/27/91
+               Made it be usable with tvtwm.  Code added taken
+               from ssetroot modified by Tom LaStrange.
+ 
      This program may be freely distributed provided that all
      copyright notices are retained.
  
***************
*** 16,21 ****
--- 20,26 ----
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
  #include <X11/Xos.h>
+ #include <X11/Xatom.h>
  
  #include <stdio.h>
  #include <math.h>
***************
*** 73,78 ****
--- 78,85 ----
  int curRoaches = 0;
  float roachSpeed = 20.0;
  
+ Atom __SWM_VROOT = None;
+ 
  Region rootVisible = NULL;
  
  void Usage();
***************
*** 100,105 ****
--- 107,115 ----
      char *roachColor = "black";
      int nVis;
      int needCalc;
+     Window rootReturn, parentReturn, *children;
+     unsigned int numChildren;
+     int i;
      
      /*
         Process command line options.
***************
*** 145,150 ****
--- 155,181 ----
      rootWin = RootWindow(display, screen);
      black = BlackPixel(display, screen);
      white = WhitePixel(display, screen);
+ 
+     /* go look for a virtual root (stolen from ssetroot) */
+     __SWM_VROOT = XInternAtom(display, "__SWM_VROOT", False);
+     XQueryTree(display, rootWin, &rootReturn, &parentReturn,
+ 	       &children, &numChildren);
+     for (i = 0; i < numChildren; i++) {
+ 	Atom actual_type;
+ 	int actual_format;
+ 	long nitems, bytesafter;
+ 	Window *newRoot = NULL;
+ 
+ 	if (XGetWindowProperty (display, children[i], __SWM_VROOT,0,1,
+ 				False, XA_WINDOW, &actual_type,
+ 				&actual_format, &nitems, &bytesafter,
+ 				(unsigned char **) &newRoot) == Success
+ 	    && newRoot)
+ 	  {
+ 	      rootWin = *newRoot;
+ 	      break;
+ 	  }
+     }
  
      display_width = DisplayWidth(display, screen);
      display_height = DisplayHeight(display, screen);
--8<---8<---8<---8<---8<---8<--- cut here --8<---8<---8<---8<---8<---8<---

-- 
Colin Owen Rafferty              |      I believe in compulsory cannibalism.
colin@nbc1.ge.com                |      If people were forced to eat 
(I don't speak for NBC.          |      what they killed, there would
Watch Tom Brokaw for that.)      |      be no more wars.      -- Abbie Hoffman

Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) (03/30/91)

In article <1509@culhua.prg.ox.ac.uk> bush@ecs.ox.ac.uk (Mark Bush) writes:
[...]
>you'll find that the roach moves at a reasonable speed, but that most of the
>time it is un-painted.  It seems to flash on for a brief moment.  At least
>that's how it runs on all the Suns I've compiled it on.
>
>Anyone else seen this?  I've had only a quick glance at the source so far
>and I can't see yet what the problem is.

The problem seems to be that the roaches are undrawn and then redrawn 
in two separate loops.  First they are *all* deleted then *all* redrawn.  
By merging the loops, so that each roach in turn is deleted then redrawn, 
they appear much more solid.

Diff follows (ie. delete the five lines with minus signs at the front),

Ed.


*** xroach.c~   Sat Mar 30 13:51:26 1991
--- xroach.c    Sat Mar 30 13:55:28 1991
***************
*** 407,417 ****
        if (roach->intX >= 0) {
            XClearArea(display, rootWin, roach->intX, roach->intY,
                roach->rp->width, roach->rp->height, False);
-       }
-     }
-
-     for (rx=0; rx<curRoaches; rx++) {
-       roach = &roaches[rx];

        if (!roach->hidden) {
            roach->intX = roach->x;
--- 407,412 ----
-- 
Edmund Stephen-Smith               crunch@comp.vuw.ac.nz   

wjc@hos1cad.ATT.COM (Bill Carpenter) (03/30/91)

>When I tried it, it works ok, but the SparkStation 2 is too fast for
>it.  The little roaches seem to just buzz around so fast that the

bush> that it's not the speed that ruins it.  If you run with one
bush> roach and close all windows, you'll find that the roach moves at
bush> a reasonable speed, but that most of the time it is un-painted.
bush> It seems to flash on for a brief moment.  At least that's how it

I haven't looked at the source at all, but I made a guess at why I was
seeing this.  If you're running something like oneko, etc, you get the
buzzing effect.  Get rid of those other things and xroach becomes more
realistic.  My naive assumption is that xroach is constantly checking
window geometries, and things that run around on your screen (like
that Japanese cat) are constantly changing it.
-- 
  Bill Carpenter         att!hos1cad!wjc  or  attmail!bill
  (908) 949-8392         AT&T Bell Labs,  HO 1L-410

ake@dayton.saic.com (Earle Ake) (03/30/91)

In article <1991Mar30.021403.7505@comp.vuw.ac.nz>, Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) writes:

> Diff follows (ie. delete the five lines with minus signs at the front),
> 
> Ed.
> 
> 
> *** xroach.c~   Sat Mar 30 13:51:26 1991
> --- xroach.c    Sat Mar 30 13:55:28 1991
> ***************
> *** 407,417 ****
>         if (roach->intX >= 0) {
>             XClearArea(display, rootWin, roach->intX, roach->intY,
>                 roach->rp->width, roach->rp->height, False);
> -       }
> -     }
> -
> -     for (rx=0; rx<curRoaches; rx++) {
> -       roach = &roaches[rx];
> 
>         if (!roach->hidden) {
>             roach->intX = roach->x;
> --- 407,412 ----


	I think the patch should have been:


*** xroach.c~   Sat Mar 30 13:51:26 1991
--- xroach.c    Sat Mar 30 13:55:28 1991
***************
*** 407,417 ****
        if (roach->intX >= 0) {
            XClearArea(display, rootWin, roach->intX, roach->intY,
                roach->rp->width, roach->rp->height, False);
        }
-     }
-
-     for (rx=0; rx<curRoaches; rx++) {
-       roach = &roaches[rx];

        if (!roach->hidden) {
            roach->intX = roach->x;
--- 407,413 ----

	You still need the "}" in 410 to close off the if statement above it.

Earle
_____________________________________________________________________________
             ____ ____    ___
Earle Ake   /___ /___/ / /     Science Applications International Corporation
           ____//   / / /__                 Dayton, Ohio
-----------------------------------------------------------------------------
Internet: ake@dayton.saic.com        uucp: dayvb!ake         SPAN: 28284::ake

stevef@bony1.bony.com (Steve Faiwiszewski) (04/02/91)

In article <1991Mar30.021403.7505@comp.vuw.ac.nz> Edmund.Stephen-Smith@comp.vuw.ac.nz (Edmund Stephen-Smith) writes:
>In article <1509@culhua.prg.ox.ac.uk> bush@ecs.ox.ac.uk (Mark Bush) writes:
>[...]
>>you'll find that the roach moves at a reasonable speed, but that most of the
>>time it is un-painted.  It seems to flash on for a brief moment.  At least
>>that's how it runs on all the Suns I've compiled it on...
>
>...Diff follows (ie. delete the five lines with minus signs at the front),

I guess this is truly a "bug fix", eh? ;-)

-- 
=======================================================================
Internet: stevef@bony1.bony.COM  |          The Bank Of New York
                                 |          ~~~~~~~~~~~~~~~~~~~~        
bang : uunet!bony1!stevef        |        Reality is Nobody's Dream

marc@PostImage.COM (Marc Boucher) (04/02/91)

phil@inetg1.ARCO.COM (Phil Meyer) writes:

>In article <1991Mar27.060714.19885@mel.dit.csiro.au>, simonm@mel.dit.csiro.au
>(Simon McClenahan) writes:
>> 
>> In article <+j7f0b+@rpi.edu>, ramabads@cs.rpi.edu (Shiva ) writes:
>> |> 
>> |> I am having difficulty compiling xroach, which I took off comp.sources.x
>> |> 
>> |> It compiles fine, but on trying to run it, I get 
>> |> 
>> |> 	ld.so: undefined symbol : __XtInherit
>> |> 
>> |> Could some turn on the light ?
>> |> 
>> I can't help you, but I manage to compile it, and it just plain doesn't
>> work!
>> 
>> Does it work with a monochrome monitor?

>When I tried it, it works ok, but the SparkStation 2 is too fast for it.
>The little roaches seem to just buzz around so fast that the animated effect is
>lost.  I'll probably put some kind of delay in there.

>Anyways, it works fine under SUNOS 4.1.1 generic X11R4.

The speed can be ajusted with -speed <n> as argument.
On my SS2, 5 is pretty good.

-Marc.

>-- 
>+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
>| Phil Meyer         phil@arco.com  Work:(214) 754-6805                      |
>+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

-- 
Marc Boucher                   Internet: marc@PostImage.COM      BIX: mboucher
Dir., Informatique             Telephone: (514) 489-8989         FAX: 489-0242
(H) PostImage Inc.             6265 St-Jacques O., Montreal QC Canada H4B 1T8