Re: XForms: opengl and shared libraries

Robert S. Mallozzi (mallors@crazyhorse.msfc.nasa.gov)
Wed, 8 Oct 1997 08:27:29 -0500 (CDT)

To subscribers of the xforms list from "Robert S. Mallozzi" <mallors@crazyhorse.msfc.nasa.gov> :

On 8 Oct , Manuel J. Garcia wrote:
> To subscribers of the xforms list from "Manuel J. Garcia" <mgarcia@aero.usyd.edu.au> :
>
>> > 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 ld.so. 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 ( libforms.so.0.87) given the files libforms.so.0.87,
> 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 libforms.so.0.87 -o libforms.so.0.87 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 libforms.so.xxx
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?

-bob

-- 
Dr. Robert S. Mallozzi
University of Alabama in Huntsville
http://cspar.uah.edu/~mallozzir/

_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/