[gnu.gcc.bug] problem mixing compilers

davis@groucho.ucar.edu (Glenn P. Davis) (01/05/90)

Environment: sun3, Sun OS 4.O.3, gcc version 1.36

#define HasGcc YES
#define HasSunOSSharedLibraries YES

When attempting to link simple Xaw programs using the sun cc complier,
referencing system X libs built as above, there are unresovled externals
which are not in gcc-gnulib. Linking with gcc is no problem.

Repeat By:

===== simple make file, test.mk ====
INCLUDES =
DEFINES =
CPPFLAGS = $(INCLUDES) $(DEFINES)

LOADLIBS = -lXaw -lXmu -lXt -lX11

xhw : xhw.o
	$(LINK.c) $(LINKOPTS) xhw.o $(LOADLIBS) -o $@
==== end of test.mk ===


Script started on Thu Jan  4 20:01:55 1990
	(groucho) 94 % pwd
	/u3/X11R4/mit/examples/Xaw
	(groucho) 95 % rm xhw ; make -f test.mk
	cc     -sun3  xhw.o  -lXaw -lXmu -lXt -lX11 -o xhw
	(groucho) 96 % xhw
	ld.so: call to undefined procedure __GetHostname from 0xebc073a
	(groucho) 97 % rm xhw ; make CC=gcc -f test.mk
	gcc     -sun3  xhw.o  -lXaw -lXmu -lXt -lX11 -o xhw
	(groucho) 98 % xhw
		# window apprears as it should
	(groucho) 99 % rm xhw ; make LINKOPTS=-Bstatic -f test.mk
	cc     -sun3 -Bstatic xhw.o  -lXaw -lXmu -lXt -lX11 -o xhw
	Undefined:
	_XrmDestroyDatabase
	__GetHostname
	*** Error code 1
	make: Fatal error: Command failed for target `xhw'
	(groucho) 100 % exit
script done on Thu Jan  4 20:05:42 1990

Note: adding the gnu library, gcc-gnulib, to the end of LOADLIBS,
makes no difference.

(Cross Posted to comp.windows.x)

Glenn P. Davis
UCAR / Unidata
PO Box 3000                   1685 38th St.
Boulder, CO 80307-3000        Boulder, CO  80301

(303) 497 8643