After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 124951 - [patch] NetBSD compile error: foo-canvas-util.c: `M_PI' undeclared
[patch] NetBSD compile error: foo-canvas-util.c: `M_PI' undeclared
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Compilation
1.2.x
Other All
: High major
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2003-10-19 10:21 UTC by Adrian Bunk
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch to fixed this issue (2.03 KB, patch)
2003-10-19 22:17 UTC, Adrian Bunk
none Details | Review

Description Adrian Bunk 2003-10-19 10:21:51 UTC
I got the following compile error in Gnumeric 1.2.1:

<--  snip  -->

...
gcc -DHAVE_CONFIG_H -I. -I. -I../../../.. -I../../../..                   
     
                -I../../../..                                   -Wall
-Wmissing-
prototypes                                              -DORBIT2=1
-D_REENTRANT 
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
-I/usr/local/inc
lude/libgsf-1 -I/usr/local/include/libxml2 -I/usr/local/include/gtk-2.0
-I/usr/l
ocal/lib/gtk-2.0/include -I/usr/local/include/atk-1.0
-I/usr/local/include/pango
-1.0 -I/usr/X11R6/include -I/usr/local/include/libglade-2.0
-I/usr/local/include
/libgnomecanvas-2.0 -I/usr/local/include/libart-2.0 -I/usr/local/include
-I/usr/
local/include/freetype2 -I/usr/local/include/libgnome-2.0
-I/usr/local/include/o
rbit-2.0 -I/usr/local/include/libbonobo-2.0 -I/usr/local/include/gconf/2
-I/usr/
local/include/gnome-vfs-2.0 -I/usr/local/lib/gnome-vfs-2.0/include
-I/usr/local/
include/bonobo-activation-2.0 -I/usr/local/include/libgnomeui-2.0
-I/usr/local/i
nclude/libbonoboui-2.0 -I/usr/local/include/libgnomeprint-2.2
-I/usr/local/inclu
de/libgnomeprintui-2.2   -I../../../../src                             
-DFOOCAN
VASLIBDIR=\""/usr/local/lib"\"                 
-DFOOCANVASDATADIR=\""/usr/local
/share"\"                      
-DFOOCANVASPIXMAPDIR=\""/usr/local/share/pixmaps
"\"             -DFOOCANVASBINDIR=\""/usr/local/bin"\"                 
-DFOOCAN
VASLOCALSTATEDIR=\""/usr/local/var"\"           -DFOOCANVASLOCALEDIR=\"""\"
    
        -DG_LOG_DOMAIN=\"Foocanvas\"                           
-DVERSION=\"1.2.
1\"    -O2 -mcpu=v8 -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
-DGDK
_DISABLE_DEPRECATED -DGDK_MULTIHEAD_SAFE -DGTK_DISABLE_DEPRECATED
-DGNOME_DISABL
E_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DLIBGLADE_DISABLE_DEPRECATED -Wall
-Wmi
ssing-prototypes  -Wsign-compare -Wpointer-arith -Wnested-externs
-Wchar-subscri
pts -Wwrite-strings -D_POSIX_SOURCE -D__EXTENSIONS__ -D_BSD_SOURCE -c
foo-canvas
-util.c
foo-canvas-util.c: In function `foo_canvas_get_miter_points':
foo-canvas-util.c:151: `M_PI' undeclared (first use in this function)
foo-canvas-util.c:151: (Each undeclared identifier is reported only once
foo-canvas-util.c:151: for each function it appears in.)
foo-canvas-util.c:153: `M_PI_2' undeclared (first use in this function)
make[5]: *** [foo-canvas-util.o] Error 1
make[5]: Leaving directory
`/aux/adrian/build/gnumeric-1.2.1/src/cut-n-paste-code/foocanvas/libfoocanvas'

<--  snip  -->

/usr/include/math.h contains:

<--  snip  -->

...
/*
 * XOPEN/SVID
 */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
    defined(_XOPEN_SOURCE)
#define M_E             2.7182818284590452354   /* e */
#define M_LOG2E         1.4426950408889634074   /* log 2e */
#define M_LOG10E        0.43429448190325182765  /* log 10e */
#define M_LN2           0.69314718055994530942  /* log e2 */
#define M_LN10          2.30258509299404568402  /* log e10 */
#define M_PI            3.14159265358979323846  /* pi */
#define M_PI_2          1.57079632679489661923  /* pi/2 */
#define M_PI_4          0.78539816339744830962  /* pi/4 */
#define M_1_PI          0.31830988618379067154  /* 1/pi */
#define M_2_PI          0.63661977236758134308  /* 2/pi */
#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */

#define MAXFLOAT        ((float)3.40282346638528860e+38)
extern int signgam;
#endif /* !_ANSI_SOURCE && !_POSIX_C_SOURCE || _XOPEN_SOURCE */
...

<--  snip  -->
Comment 1 Adrian Bunk 2003-10-19 22:15:29 UTC
I'll attach a patch in a minute.
Comment 2 Adrian Bunk 2003-10-19 22:17:43 UTC
Created attachment 20802 [details] [review]
proposed patch to fixed this issue
Comment 3 Adrian Bunk 2003-10-19 22:23:48 UTC
Description of the patch against configure.in:

On NetBSD/sparc-1.5 -D_XOPEN_SOURCE=500 is needed for M_PI.

If M_PI isn't available try -D_BSD_SOURCE.
If M_PI isn't available with -D_BSD_SOURCE, try -D_XOPEN_SOURCE=500.
If this fails, abort with AC_MSG_ERROR.

If caddr_t isn't available try -D_BSD_SOURCE.
If this fails, abort with AC_MSG_ERROR.



This fixes it for me without affecting the cases where it is available
with or without -D_BSD_SOURCE .

I added the AC_MSG_ERROR since in this case there's a real problem and
it would have saved me some time if configure would have failed with a
clear error message instead of a compile error later.
Comment 4 Morten Welinder 2003-10-20 00:21:20 UTC
I don't want to fix it this way -- mucking with these symbols is going
to cause different problems to pop up elsewhere.  Search for
_POXIS_SOURCE in configure.in to see what I mean.

However, the (foocanvas) function that uses M_PI_2 needs a little
cleanup that will eliminate that symbol's use.  And for M_PI, the
solution is to simply define it when it isn't -- the value is not
a great secret.
Comment 5 Morten Welinder 2003-10-21 16:41:52 UTC
Fixed in cvs.  (The fix relates only to foocanvas; if other places
end up needing some symbol, please refile.)