[comp.windows.x.motif] Shared Motif libraries on RISC System/6000

sja@sirius.hut.fi (Sakari Jalovaara) (03/22/91)

Has anyone made shared Motif 1.1.1 libraries on an IBM RS/6000?

I don't seem to be able to make them work.  If Motif programs are
linked statically they work but if any or all of Mrm, Xm or Xt are
shared libraries some programs give errors like

Warning:
    Name: work_area
    Class: XmForm
    Null font list (no vendor shell default)

some die with "Error: Unresolved inheritance operation" and keyboard
input kills all programs.  Does this sound familiar to anyone?

(IBM RISC System/6000 540, AIX 3.1 patch 3003, Motif 1.1.1, MIT X11R4
patch 18 with rs-6000.fix1 and rs-6000.fix2 from export.lcs.mit.edu
and a partridge in a pear tree.)
									++sja

dan@IBM.COM (Walt Daniels) (03/23/91)

>Has anyone made shared Motif 1.1.1 libraries on an IBM RS/6000?
>Jalovaara

It is a known problem and being worked on. The problem appears
to be that there is a Vendor.c in both Xt and Xm and the wrong one
is used because of the shared library implementation.

I am not enough of an expert on Xt to be sure but roughly what has to
be done is similar to what SUN has done to solve their shared library
problems.  You have to hook Vendor.c in Xt and create an additional
pointer to the pointer to the vendor class stuff.  You also have to
hook XtToolkitInitialize to put the right address in that pointer.
You then need to build a shared Xt that has sharedlib.c marked as
unshared. If this hint is enough to get it working let me know.
If it is flawed I would also be interested.

I will in fact try to generate and test such a solution sometime after
next week.  If I solve the problem I will give the solution to the
product people.  Meanwhile the "real" product people are also working
on the problem.

You should report the problem though your normal problem reporting
process, 1-800-237-5511 (you need to know your customer number).
That way you should get notified when a fix is available.

Walt Daniels
IBM Research (not part of the product division)

sja@sirius.hut.fi (Sakari Jalovaara) (03/24/91)

I wrote:
> Has anyone made shared Motif 1.1.1 libraries on an IBM RS/6000?
>
> I don't seem to be able to make them work.  If Motif programs are
> linked statically they work but if any or all of Mrm, Xm or Xt are
> shared libraries some programs give errors [...]

Two people, Kaleb Keithley at JPL and Kee Hinckley at Alfalfa Software
Inc, knew what was happening: Xm redefines VendorShell and the AIX
linker put _both_ Xm's and Xt's VendorShell into programs.


When an AIX shared library is created as many references inside the
library are resolved as possible.  If the symbol vendorShellClassRec
is defined in libXt and referenced, say, from a function XtFoo() also
in libXt, the "ld" run that creates the shared library resolves the
reference:

	XtFoo() -> vendorShellClassRec

Then I create the Motif library that has its own vendorShellClassRec
and an XmBar() function that uses it; libXm will also contain a
resolved reference to vendorShellClassRec:

	XmBar() -> vendorShellClassRec

Finally, I link a program that uses both XtFoo() and XmBar() and the
program will end up with _two_ independent "vendorShellClassRec"s:

	XtFoo() -> vendorShellClassRec [Xt version]
	XmBar() -> vendorShellClassRec [Xm version]

Instand schizo zaphod mode.  In reality, vendorShellClassRec is not
referenced from functions but from other widget class records.


I can't just pull Vendor.o out from the shared Xt (Vendor.o appears to
define the only external symbols redefined by libXm) because AIX
shared libraries apparently can't contain unresolved external
references.  If I take out Vendor.o I have to take out every other
file that uses symbols defined there - and then files that need those
files, etc.  I tried it and ended up with three or four object files
in libXt and the res non-sharable.

I kludged around this by putting all of libXt (minus Vendor.o) into
the shared libXm.  It isn't a pretty solution but it works - and beats
having a statically linked two-megabyte "periodic" demo...
									++sja