Subject: FVWM: FVWM2.0.39 gcc compilation and linking on Sun-OS 4.1.4

From: [email-masked] (Jan-Erik Borg)
Date: Thu, 1 Feb 96 17:28:16 +0100

Hello!

When linking FVWM2.0.39 using gcc on Sun-OS 4.1.4 with Openwindows 3.0
I get an "Undefined symbol _basename" fatal error message from ld, which 
then exits. (For details see below.)

Question: Does any one have an idea how I can avoid this?

There is a similar problem for module FvwmPrompt, shown at the end.

(I'm more or less a novice in X, C and Unix programming, so the issue
might be silly. I just don't have any more experiended person available
locally.)

Thanks in advance!

Jan-Erik Borg

ABB HAFO AB
Sweden

E-Mail: [email-masked]
Phone:  +46 8 580 24 709
Fax:    +46 8 580 20 190
-----------------------------------------------------------------------------

Here is an extract from the compilation and the complete link command with 
error output:

> make all
:
:
gcc -g -Wall -O   -I/usr/include -I/usr/openwin/include  -I.       -target sun4 -c  fvwm.c
fvwm.c: In function `main':
fvwm.c:163: warning: implicit declaration of function `fprintf'
fvwm.c:251: warning: implicit declaration of function `putenv'
fvwm.c: In function `CatchFatal':
fvwm.c:1010: warning: control reaches end of non-void function
fvwm.c: In function `usage':
fvwm.c:1056: warning: implicit declaration of function `basename'
fvwm.c:1056: warning: format argument is not a pointer (arg 3)
fvwm.c: At top level:
fvwm.c:92: warning: `s_g_bits' defined but not used
:
:
rm -f fvwm2
gcc -g -Wall -o fvwm2 add_window.o  bindings.o  borders.o  builtins.o  colormaps.o  colors.o  complex.o  decorations.o  events.o  focus.o  functions.o  fvwm.o  icons.o  menus.o  misc.o  module.o  move.o  placement.o  read.o  resize.o  style.o  virtual.o  windows.o -O  -lXpm  -lXext -lX11 ../libs/libfvwm2.a   
collect2: ld returned 2 exit status
ld: Undefined symbol 
   _basename 
*** Error code 1
make: Fatal error: Command failed for target `fvwm2'

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

OS:       Sun-OS 4.1.4
X11:      Openwindows 3.0    Which I think is based on X11R5.
                             (We don't have libraries for Motif application 
                             development. We only have the standard 
                             Openwindows installation.)
FVWM:     fvwm2.0.39
XPM:      xpm-3.4a           (libXpm.so.4.1 + libXpm.a +xpm.h)
Compiler: gcc 2.7.2          Used for both FVWM and XPM.

-----------------------------------------------------------------------------
Some notes:

I've noted that there is a call to "basename" (without leading "_") 
in function "usage" in file "fvwm.c". During the compilation I get 
an get warning(s) for it, as show in the listing below.

Using "nm -og" on /usr/openwin/lib/lib* ( and /lib/lib* ) gives the
following information relating to "_basename" :

> nm -og /usr/openwin/lib/lib* |grep -i basename
/usr/openwin/lib/libtt.a:tt_path.o:0000004c T __Tt_basename__FPCci
/usr/openwin/lib/libtt.so.1.1:0006e124 T __Tt_basename__FPCci

Trying to add "/usr/openwin/lib/libtt.a" to the linking does not help.

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

I get a similar error in FvwmPrompt. Does it have the same reason?

gcc -g -Wall -O   -I/usr/include -I/usr/openwin/include  -I.       -target sun4 -c  FvwmPrompt.c
FvwmPrompt.c: In function `main':
FvwmPrompt.c:66: warning: implicit declaration of function `strrchr'
FvwmPrompt.c:66: warning: assignment makes pointer from integer without a cast
FvwmPrompt.c:77: warning: implicit declaration of function `fprintf'
FvwmPrompt.c:78: warning: too many arguments for format
FvwmPrompt.c:163: warning: implicit declaration of function `strtok'
FvwmPrompt.c:57: warning: unused variable `file'
rm -f FvwmPrompt
gcc -g -Wall -o FvwmPrompt FvwmPrompt.o -O  -lXpm -lXaw -lXmu -lXt -lXext -lX11 -lXext -lX11 ../../libs/libfvwm2.a   
collect2: ld returned 2 exit status
ld: Undefined symbol
   _sin
   _cos
   _pow
   _floor
   _get_wmShellWidgetClass
   _get_applicationShellWidgetClass
*** Error code 1
-----------------------------------------------------------------------------
--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: <[email-masked]> (Charles Hines)
Date: Thu, 1 Feb 1996 11:56:11 -0500

>>>>> "Jan-Erik" == Jan-Erik Borg <[email-masked]> writes:

Jan-Erik> Hello!

Jan-Erik> When linking FVWM2.0.39 using gcc on Sun-OS 4.1.4 with
Jan-Erik> Openwindows 3.0 I get an "Undefined symbol _basename" fatal
Jan-Erik> error message from ld, which then exits. (For details see
Jan-Erik> below.)

Jan-Erik> Question: Does any one have an idea how I can avoid this?

Edit fvwm.c and remove the call to basename().  Or pick up 2.0.40
where it's already removed (and deal the missing 'XLoadQuery...'
problem that might happen by applying the patch below).

Jan-Erik> There is a similar problem for module FvwmPrompt, shown at
Jan-Erik> the end.

It looks like -lm is missing from the link line, for some unknown
reason.  I wouldn't worry about it though - use FvwmForm instead.
I'll probably be removing FvwmPrompt in the next release, since
FvwmForm has similiar function, but is more powerful and aesthetically
pleasing.

Jan-Erik> (I'm more or less a novice in X, C and Unix programming, so
Jan-Erik> the issue might be silly. I just don't have any more
Jan-Erik> experiended person available locally.)

Well, that's one reason why this list exists.

Chuck