SUMMARY: Compiling free Xware

Date: Thu May 19 1994 - 00:12:41 CDT

Hello Sun-managers;

2 Months ago, I asked the following questions:

|> I have had problems compiling free X software obtained from the net.
|> Usually imake produces a Makefile that is not appropriate for our
|> site since we don't have libraries installed in the standard places.
|> So what I usually do is go in and fix the Makefile by adding
|> the correct paths for include and lib directories.
|> That usually works after several tries.
|> Now to my questions;
|> 1. How do I get imake to produce a correct Makefile.

|> 2. Also, I'm always getting these errors
|> ld: Undefined symbol
|> _get_wmShellWidgetClass
|> _get_applicationShellWidgetClass

|> I'm linking all the libraries that I know of
|> -I/usr/openwin3/include -I/usr/openwin3/include -L/usr/openwin3/lib
   -lX11 -L/usr/openwin3/lib -lXaw -L/usr/openwin3/lib -lXmu
    -L/usr/openwin3/lib -lXt -L/usr/openwin3/lib -lXext -L/usr/lib -lm
|> Am I missing something?
The responses were numerous and mostly accurate, especially to the
second question.
I have included the responses below (as received).
If the responses are broken into 2 parts, it means that the first part
answers the first question, and the second answers the second question.

Now to my SUMMARY:

To have imake produce correct Makefiles, I had to change my site.def
file, in $OPENWINHOME/lib/config.
That file includes defines that tell imake where to look for things.
i.e. include, and lib directories.
If you don't want to do this, all these options can be added to the
command line of imake; i.e. -DIncRoot=$OPENWINHOME/include,
I haven't tried this though.

The second part was easy, and the answer(s) are given in sunsolve.
You either go all the way, and fix the bug for good by patching
Openwin3.0, patch# 100573, that fixes libXmu among other bugs.

The second option is to link libXmu statically by using the
cc option -Bstatic.

Many thanks to the generousity of all those who took the
time and responded, and because of them this list is one
of the most valuable resource to Sun managers and users.


Brett Lymn <>

Edit your site.def file in $OPENWINHOME/lib/config, in this file
#define the things that are set incorrectly. For clues to the names
of the things to #define have a look in Imake.tmpl

You need to link with both the dynamic and static versions of Xmu
(Xaw???) as there are some symbols missing from the dynamic openwin
libraries. I think that there is a patch for this but I do not know
the number.
Todd Kover <>

Try xmkmf. It's a shell script around imake that will tell it to look in
the right places.
Leon Avery <>

imake works by running Imakefile through the C preprocessor. (Please
excuse me if I'm telling you things you already know.) It
automatically includes configuration files from some directory that
was specified when it was built, at least if you run it with xmkmf.
On a standard X11R5 installation, this is /usr/lib/X11/config. On a
Sun, it's probably /usr/openwin/lib/config. Find and modify those
config files

This is fairly bad news. Those are Xt calls that appeared in X11R5,
but weren't available in R4. Openwindows 3.x is R4. (I know that's
true for Solaris 1.x, and I guess it's also true for Solaris 2.x,
though I haven't used that.) So you're trying to built applications
written for R5 with R4 libraries. The best way to fix this is to
fetch X11R5 off the net (millions of anon FTP sites) and build it.
But it's big. If this is impossible, and if you're running Solaris
1.x (SunOS 4.x + Openwin 3.x) I might be able to give you some
Steve_Kilbane <>

There's a bug in the SunOS 4.1.x OpenWindows 3 Xmu dynamic library, but not in the
static version. You can either:
        - contact Sun, and get the patch (don't know the number, offhand)
        - Use the static version: -Bstatic -lXmu -Bdynamic

Ugh - you only need to include -L/usr/openwin3/lib on the line once, giving you this,
assuming static linking of Xmu:
> -I/usr/openwin3/include -I/usr/openwin3/include -L/usr/openwin3/lib \
-lX11 -lXaw -Bstatic -lXmu -Bdynamic -lXt -lXext -lm
Russ Poffenberger <>

You go into the "config" directory in the X11 source tree and modify the
files as appropriate for your site.

I believe you need some of the patches. X11 (R5) is up to PL 26
Sven Heinicke <>

since I started downloading a lot of stuff from the net I found the
nm(1) command to be very helpful. I'd go into the directory where you
got the *.a files are that you think have these function in and do a:

        nm -o *.a | grep wmShellWidget

and if you don't get anything none of the libraries in that directory
have that, or a reference to that, function
Andy Feldt <>

There are two solutions:

Here is the result from sunsolve when searching for get_wmShellWidgetClass:

1. Install patch 100573 for OpenWindows 3.0.

2. Link libXmu statically.

        % cc -o foo foo.c -Bstatic -lXmu -Bdynamic -lXt -lX11
"A. Bryan Curnutt" <>

Install the following patch:

Patch-ID# 100573-04
Keywords: libxmu, jumbo, patch, xstdcmap, fail
Synopsis: OpenWindows 3.0: xstdcmap fails to set XStandardColomap for 24-bit mac
Date: 24/Nov/92
Risto Tolonen <>

Yes. Link with -Bstatic i.e. replace in your Makefile the entry for
John Liberty <>

1)first try running 'imake -DUseInstalled -I$OWH/lib/config'
this tells imake to use the installed versions (as opposed to the versions you
would have if you were actually compiled the X sources) and where the config
files reside...

2)If it is still not right, add '-DIncRoot=$OWH/include' to the line to specify
the correct header location and the maybe 'DUsrLibDir=$OWH/lib' to specifiy
the correct library location.

These two hints should probably get you real close. I also use 'DCcCmd=gcc' to
specify an alternate compiler. There are other defines as well which could be
put into a site.def file in the config directory, Eventually I'll get around
to setting that up.... probably just in time for a new release :->

The thing to remember is imake actually runs the cpp on the files specified,
hence the -I, -D options. Check the man pages...

hope this helps..

Well, this is because the the Xmu shared library does not have these symbols,
you must link in the .a file directly i.e /usr/openwin3/lib/libXmu.a and not
let the linker choose the shared version.
I believe this is a known Sun bug and a patch or fix exists.
Chad Netzer <>

Try using "xmkmf" (should be included with your X-Windows software).
It runs imake with appropriate flags for your setup.

Corvil Howells <>

I can't remember how to get the unresolved symbols to go away, but as far as
getting the Makefiles to be generated properly, I copy the following file
into the directory with the Imakefile before I do a xmkmf:


/* site.def
* Configuration file that will allow Sun's imake to produce a reasonable
* Makefile under OpenWindows 3.
* To use this file, use a command such as:
* imake -DUseInstalled -I. $OPENWINHOME/lib/config
* Do not use xmkmf; it will point at possibly non-existant X11R5
* (not OpenWindows) files.
* This file may not be complete. My aim is not to fix what Sun
* did wrong, but rather to provide something that as least ought to
* work.
* If Sun ever fixes the version of the Imake templates under
* $OPENWINHOME/lib/config to properly build a OW3 Makefile, then
* this file can be scrapped.
#define IncRoot $(OPENWINHOME)/include
#define UsrLibDir $(OPENWINHOME)/lib
#define BinDir $(OPENWINHOME)/bin
#define LibDir $(OPENWINHOME)/lib
Dan Penrod <>

I'm glad to see I'm not the only one that that confused. The problem,
you'll be glad to know, is a bug, specifically with some of the libraries.
The library that you're having trouble linking is Xmu. Your Makefile
may have a line that looks like this...
        XMULIB = -lXmu
or maybe it has a direct cc line like
        cc -o -lXmu ........(etc...)
Either way, you have to specify to link staticly. Apparently the default
is dynamic and the dynamic library doesn't work or isn't there or something.
        XMULIB = -Bstatic -lXmu
        cc -o -Bstatsic -lXmu ....(etc...)
That should do it.

In regard to getting the Makefiles correct in the first place... well,
good luck. Everyone I know patches 'em a little. It's a Sun thing.
If you haven't already, you might want to add the following symbolic

        ln -s /usr/openwin/lib /usr/lib/X11
        ln -s /usr/openwin/include /usr/include/X11

That should help a lot.

One more thing... The imake uses the files in /usr/openwin/lib/config
to figure out how to make Makefiles. These file describe the hardware,
OS, and various machine dependant issues. You can tweek some of these
files, especially site.def to get the Makefiles the way you want. Good
Eckhard Rueggeberg <>

You can simply ignore these two messages. The binary will run fine anyways.
To get rid of them, you could either install a patch (I forgot the number)
or link one of the libraries staically (not recommended).
Jochen Bern <>

Assuming that you use the OpenWindows imake, which searches the Stuff
under $OPENWINHOME, edit your Changes into $OPENWINHOME/lib/config/site.def.

SunAdmin-FAQ #48. Get Patches 100512-02 and 100573-03 to fix your Xmu Lib.
For a quick Workaround, link statically (-Bstatic -lXmu -Bdynamic).

Steven Grevemeyer <>

Change the file Imake.rules and Imake.tmpl (and any others that
need changed). These are the files that Imake uses to create makefiles

I found the following:
Intrinsic.h: (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
Intrinsic.h: (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
Shell.h:externalref WidgetClass wmShellWidgetClass;

Intrinsic.h: (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
Intrinsic.h: (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
Shell.h:externalref WidgetClass wmShellWidgetClass;
Elizabeth Schwartz <>

Order counts! Maybe something in your openwin libraries is getting
in the way. Try stripping it down to the basics:
   -lXm -lXt -lX11
Bruce Thomson <>

I think there is a configuration file in the directory where
imake is found that points to the right directories (not too sure on this)

This is one of the FAQs that I noticed in looking through them.
They suggest you get you have to patch the Xaw library stuff - have
a look in the Sun FAQ

There are some files accessed by the xmkmf program, with that information
set (things like CC, Version, CFLAGS, etc). You could change that file
(I believe it is called config.tmpl), or at the time you run XMKMF, you
can add lines to your Imakefile to hardcode these (CC=gcc, CFLAGS=-g -O,
that sort of thing). These will supersede the settings from config.tmpl.

The get_wm problem has to do with shared libraries. Sun screwed up one
of the shared libraries, libXmt or libXmu, I don't remember which. When
linking it dynamically, it has calls to these functions that nobody uses.
Compiling statically (adding a -Bstatic on your final compilation) will
fix it, but makes for much larger source code. There is a patch for 4.1.3
systems. I'll look around for it, if no one sends it to you.

Compiling with just that one library static also works: for example, if
the problem is with libXmu,
        gcc sourcecode.c -static -lXmu -dynamic -lwhatever....
This makes for considerably smaller binaries.

It's basically a very well known bug.

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:01 CDT