Discussion:
xterm (sometimes) needs -lm
Manuel Bouyer
2014-07-22 13:02:17 UTC
Permalink
Hello,
while building a evbarm release with some specific CPUFLAGS:
-mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -funsafe-math-optimizations

I ran into an error building xterm: undefined references to pow
pow(3) is defined in libm and xterm doesn't reference it explicitely.
But it does some double computations; I suspect some optimisation
comes with calling pow.

Anyone know what could be going on here ? blindly adding -lm in xterm's
Makefile seems wrong ...
--
Manuel Bouyer <***@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
Jean-Yves Migeon
2014-07-22 17:11:07 UTC
Permalink
Post by Manuel Bouyer
Hello,
-mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -funsafe-math-optimizations
I ran into an error building xterm: undefined references to pow
pow(3) is defined in libm and xterm doesn't reference it explicitely.
But it does some double computations; I suspect some optimisation
comes with calling pow.
Anyone know what could be going on here ? blindly adding -lm in xterm's
Makefile seems wrong ...
Squares and such that get replaced by pow()? There are a couple in
xsrc/.../xterm: xb * xb , yb * yb, ...

Bizarre though, multiplication is usually faster than pow().

Or sqrt() with pow(,0.5).
--
Jean-Yves Migeon
Thomas Dickey
2014-07-22 19:21:43 UTC
Permalink
Post by Jean-Yves Migeon
Post by Manuel Bouyer
Hello,
-mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -funsafe-math-optimizations
I ran into an error building xterm: undefined references to pow
pow(3) is defined in libm and xterm doesn't reference it explicitely.
But it does some double computations; I suspect some optimisation
comes with calling pow.
Anyone know what could be going on here ? blindly adding -lm in xterm's
Makefile seems wrong ...
Squares and such that get replaced by pow()? There are a couple in
xsrc/.../xterm: xb * xb , yb * yb, ...
Bizarre though, multiplication is usually faster than pow().
Or sqrt() with pow(,0.5).
Unless it's being configured with the ReGIS optional feature,
it should not depend on the math library.

xterm has its own sqrt function, to (attempt to) eliminate this dependency.
--
Thomas E. Dickey <***@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net
Joerg Sonnenberger
2014-07-22 19:25:15 UTC
Permalink
Post by Manuel Bouyer
-mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -funsafe-math-optimizations
-funsafe-math-optimizations is known to fundamentally break important
code like libm, so any build error with that option is certainly
something I would classify as "works as intended, don't do that".

Joerg
Loading...