Subject: Re: xforms and undefined reference to `fl_initialize'
To: None <netbsd-help@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 02/03/2001 13:22:27
I was able to work-around my problem by manually extracting the
libforms.so.0.88 (which the NetBSD package doesn't use) and creating
symlinks for libforms.so.0 and libforms.so.

(I still don't know how to use the .a library archive of the libxforms.)

At first I received:

 rainier:~/projects/homebsd$ gcc -I/usr/X11R6/include/X11
 -I/usr/X11R6/include -L/usr/X11R6/lib -lforms -lXpm -lX11 -lm test2.c
 /usr/X11R6/lib/libforms.so: undefined reference to `glXQueryExtension'
 /usr/X11R6/lib/libforms.so: undefined reference to `glXMakeCurrent'
 /usr/X11R6/lib/libforms.so: undefined reference to `glXChooseVisual'
 /usr/X11R6/lib/libforms.so: undefined reference to `glXDestroyContext'
 /usr/X11R6/lib/libforms.so: undefined reference to `glXCreateContext'
 collect2: ld returned 1 exit status

(I am not sure why libGL is needed.) So I added "-lGL" and it works. I now
have a working demo from http://world.std.com/~xforms/examples/yesno.html.

On Fri, 2 Feb 2001, Jeremy C. Reed wrote:

> I am trying to link an .a library archive file, but it doesn't seem to be
> used:
> 
>  gcc -I/usr/X11R6/include/X11 -I/usr/X11R6/include -L/usr/X11R6/lib
>  -lxforms -lXpm -lX11 -lm test2.c
>  /tmp/ccOm4ILA.o: In function `main':
>  /tmp/ccOm4ILA.o(.text+0x12): undefined reference to `fl_initialize'
>  collect2: ld returned 1 exit status
...
> I can not figure out how to get a simple C program to use this library. I
> don't have an .o shared library. I tried looking at the Makefiles and
> build output for lyx and dap which both use xforms for examples (and both
> build successfully on my system), but I can't figure it out.
> 
> It is interesting to note that the NetBSD pkgsrc Makefile says:
> "Run-time link editor tries to resolve libGL.so symbols when linking with
> shared libxforms, but all the packages that requre xforms seem to work OK
> without -lGL, so for now, remove the shared lib."

   Jeremy C. Reed
   http://www.reedmedia.net/