Subject: Re: shared library trouble
To: None <mouse@Holo.Rodents.Montreal.QC.CA>
From: James E. Bernard <jbernard@tater.Mines.EDU>
List: current-users
Date: 08/19/1996 07:01:30
Well, I can't say anything about your ld.so problem (which I haven't
encountered), nor can I say what would happen with 1.2_BETA, but I ran into
only a few minor problems compiling X11R6.1p1 on a Sparc 1 with May 3 sources
for NetBSD 1.1B.  Problems with compilation required minor fixes to NetBSD.cf,
Imake.rules, and the xdm Imakefile.  I'll attach my notes on these changes
below.  I submitted bug reports to xbugs on all three; the Imake.rules report
was rejected as a duplicate of another bug report, and the other two have
been entered into the bugs database.  I have no idea when fixes will be
released.  There is also a problem with the key repeat delay (extremely long)
with the XKEYBOARD extension; this can be worked around by starting the
server with -kb to disable the extension.

I normally install the binaries and libraries into a non-system directory,
link /usr/X11 and /usr/X11R6 to that directory, and add to the ldconfig
clause of /etc/rc.local the following:
	if [ -d /usr/X11/lib ]; then
		echo 'adding X shared libraries'
		ldconfig -ms /usr/X11/lib
	fi
which doesn't produce any ld.so anomalies (at least under 1.1B on a sparc).

--Jim Bernard


Here are my notes on the compilation:

Wed May  8 13:49:39 MDT 1996

* The macro GnuMallocLibrary is no longer being used in Imake.tmpl, so the
  NetBSD.cf file needs to be updated to define ExtraLibraries to -lgnumalloc.
  transfig 3.1.2 fails to link because the symbol _cfree is not defined.
  Under NetBSD, cfree is in the gnumalloc library, so -lgnumalloc is needed
  for successful linking.  In the distributed NetBSD.cf GnuMallocLibrary
  is intended to handle the introduction of -lgnumalloc into EXTRA_LIBRARIES.
  While this works under X11R6, the R6.1 distribution has eliminated
  GnuMallocLibrary from the configuration system, but it was not removed from
  NetBSD.cf.  Instead, ExtraLibraries should now be used to provide -lgnumalloc.
  Here's the patch:


--- NetBSD.cf-dist	Sun Jan 28 05:43:27 1996
+++ NetBSD.cf	Wed May  8 13:34:44 1996
@@ -114,14 +114,11 @@
 #define StandardDefines	-DCSRG_BASED
 #define XawI18nDefines	-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
 
-#ifndef ExtraLibraries
-#define ExtraLibraries		/**/
-#endif
 #ifndef UseGnuMalloc
 #define UseGnuMalloc		YES
 #endif
-#ifndef GnuMallocLibrary
-#define GnuMallocLibrary	-lgnumalloc
+#ifndef ExtraLibraries
+#define ExtraLibraries		-lgnumalloc
 #endif
 
 /*


Wed May  8 09:27:57 EDT 1996

* Imake.rules has a bad definition for MakeDirectories.  It results in a
  target containing a single multiline shell command with an embedded "@"
  (make symbol) in addition to the prefixed "@" (also, if DirFailPrefix
  is defined as "-", there will be a "-" embedded just before the embedded
  "@".  Here's a patch to create a sample Imakefile that demonstrates the
  problem:

--- Imakefile-dist	Wed May  8 09:34:19 1996
+++ Imakefile	Wed May  8 09:32:34 1996
@@ -0,0 +1 @@
+MakeDirectories(install,$(LIBDIR)/myprog)

  And here's a patch to fix the problem:
  (remove "DirFailPrefix@" from the embedded "for" command, and add
  "DirFailPrefix" to the first line)

--- Imake.rules-dist	Wed May  1 05:24:38 1996
+++ Imake.rules	Wed May  8 09:23:20 1996
@@ -2195,8 +2195,8 @@
 #ifndef MakeDirectories
 #define MakeDirectories(step,dirs)					@@\
 step::									@@\
-	@MakeFlagsToShellFlags(i,set +e); \				@@\
-	DirFailPrefix@for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \	@@\
+	DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \		@@\
+	for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \		@@\
 		set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \	@@\
 	done
 #endif /* MakeDirectories */


Tue Apr 30 19:08:14 MDT 1996

* NetBSD.cf (and some others) define HasLibCrypt, but it has no effect
  on xdm (where it's needed) unless XFree86Version is also defined,
  which is, at least in principle, inappropriate for NetBSD/sparc.
  Linking of xdm fails because of the lack of -lcrypt.  The fix is to
  modify the xdm Imakefile to use only HasLibCrypt or to test for
  some other variable than XFree86Version (e.g., something specific to
  the BSD variants or, perhaps better, define a new variable, such as
  NeedsLibCrypt to take care of it.

  Here's the patch:

--- Imakefile-dist	Sun Jan 14 16:36:57 1996
+++ Imakefile	Tue Apr 30 20:11:19 1996
@@ -59,7 +59,7 @@
 SYS_LIBRARIES = -ls
 #endif
 
-#if defined(XFree86Version) && HasLibCrypt
+#if HasLibCrypt
 SYS_LIBRARIES = -lcrypt
 #endif