[comp.sys.sgi] having trouble with shared libraries

jdchrist@watcgl.waterloo.edu (Dan Christensen) (04/26/89)

I have a program that I want to run on both the Personal Iris and the
4D/120GTX without recompiling.  Currently, the program compiles
correctly on both machines with the -Zg option, but the binary is not
compatible between the machines.  The way I interpret the cc man page
is that -Zg is equivalent to -lgl -lm, or if you want the shared
libraries, -gl_s -lm.  When I try compiling on either machine, with
either of these options, the linker tells me that sin and cos are not
defined and aborts.  The funny thing is, I don't call either from my
program, although I do call asin.

Can anyone help me out?

----
Dan Christensen, Computer Graphics Lab,	         jdchrist@watcgl.uwaterloo.ca
University of Waterloo, Waterloo, Ont.	         jdchrist@watcgl.waterloo.edu

jdchrist@watcgl.waterloo.edu (Dan Christensen) (04/27/89)

In article <9395@watcgl.waterloo.edu> jdchrist@watcgl.waterloo.edu (Dan Christensen) writes:
>I have a program that I want to run on both the Personal Iris and the
>4D/120GTX without recompiling.  Currently, the program compiles
>correctly on both machines with the -Zg option, but the binary is not
>compatible between the machines.  The way I interpret the cc man page
>is that -Zg is equivalent to -lgl -lm, or if you want the shared
>libraries, -gl_s -lm.  When I try compiling on either machine, with
>either of these options, the linker tells me that sin and cos are not
>defined and aborts.  The funny thing is, I don't call either from my
>program, although I do call asin.
>
>Can anyone help me out?

I found out the problem.  One of the libraries I linked in did call sin
and cos.  It turns out that all I had to do was specify -lm last on the
command line.

Dan

thant@horus.SGI.COM (Thant Tessman) (04/27/89)

In article <9395@watcgl.waterloo.edu>, jdchrist@watcgl.waterloo.edu (Dan Christensen) writes:
> I have a program that I want to run on both the Personal Iris and the
> 4D/120GTX without recompiling.  Currently, the program compiles
> correctly on both machines with the -Zg option, but the binary is not
> compatible between the machines.  The way I interpret the cc man page
> is that -Zg is equivalent to -lgl -lm, or if you want the shared
> libraries, -gl_s -lm.  When I try compiling on either machine, with
-------------^^^^^^^^^

It's
	-lgl_s -lm

Also, make sure you're including math.h

thant@sgi.com