[comp.lang.eiffel] Bug Report: math library link order.

paj@hic.uucp (Paul Johnson) (02/16/90)

SYMPTOMS:

When compiling a program which uses the math functions in SINGLE_MATH
or DOUBLE_MATH (these are the trancendental functions), es fails
during the link phase.  ln(1) generates error messages stating that
the math functions cannot be found.  This is despite placing "-lm" in
the "EXTERNAL:" field of the SDF.


CAUSE:

"es" generates a linker command with "-lm" ahead of
"/usr/local/Eiffel/files/_run_time.a" which references the C library
math functions.  Since the linker processes libraries in command line
order, it fails to pick up the appropriate functions from libm.a.  Use
"es -e" to see this command line.


WORKAROUND:

Place the following line in your SDF (change pathnames to suit your
local installation):

	EXTERNAL:       /usr/local/Eiffel/files/_run_time.a -lm

This will ensure that the linker knows what functions it needs from
libm.a.


N.B.  The viewer library _db_vw.a seems to define the same functions
as _run_time.a.  This has caused "rinfinite: defined twice" messages
to emerge from the linker.  The workaround appears to be the same, but
I am not sure exactly what is happening here, so your milage may vary.

Paul.

---
Paul Johnson | Internet: paj@uk.co.gec-mrc | Phone: +44 245 73331 ext 3216
-------------!------------------.----------!-------------------------------
GEC-Marconi Research is not 	| Don't worry: Baldrick has a Cunning Plan!
responsible for my opinions.	| (Graffiti on East side of Berlin Wall)