Re: XForms: opengl and shared libraries

Robert S. Mallozzi (
Wed, 8 Oct 1997 08:27:29 -0500 (CDT)

To subscribers of the xforms list from "Robert S. Mallozzi" <> :

On 8 Oct , Manuel J. Garcia wrote:
> To subscribers of the xforms list from "Manuel J. Garcia" <> :
>> > the readme mentioned something about compiling the included opengl.c and
>> > integrating it into the shared library. i could do the compiling part.. but
>> > how do i put it into the shared library? (i've looked up the gcc faq but
>> > the link to mit doesn't work). better yet, is there a place where i could
>> > find out about this? i'm relatively new to unix (just installed linux).
>> The place to look is in the man page for ld or Also refer to
>> the mkconfig.h file at the root of the XForms distribution. There
>> should be some lines at the bottom which look like
>> #
>> # this is how the shared library is made
>> #
>> MKSHLIB=ld -shared -soname $(SHARED_SO) -o $(SHARED_LIB)\
>> `ls *.o|grep -v gl.o` ulib/*.o ../xpm-3.4g/lib/libXpm.a
> I had the same problem. I wanted to add the file gl.o to the
> shared library ( given the files,
> libforms.a, and gl.o. Notice that I did not had all the *.o files, so I
> could not use
> the command used in the mkconfig.h file.
> by suggestion of Dr. Zhao I try the following command
> ld -shared -soname -o libforms.a gl.o
> but still it didn't work, it seems that the problem is when it tries to
> link a static library with a shared library.
> I still haven't found the solution, in the mean time i'm linking
> statically with the gl.o file.

1. Extract the .o files from the static xforms lib with
ar -x libforms.a
gl.o is already there, at least on linux ELF

2. In the xforms directory, file mkconfig.h gives the command to
to make a shared library. Use it to make a new
Note that xforms links in the Xpm library, so if you skip this
part, you will have to add -lXpm when you compile.

I guess there is a reason that Xpm is linked into Xforms...TC?


Dr. Robert S. Mallozzi
University of Alabama in Huntsville

_________________________________________________ To unsubscribe, send the message "unsubscribe" to or see Xforms Home Page: List Archive: