Hi,
radiance 3.5.0 will not build out of the box on my system (linux system
with glibc version 2.3.1 and gcc version 3.2.2). The problem is that
errno.h is not always #include'ed in every file that uses the global errno
variable. I'm surprised one can get away with this on any system but I
guess some C compilers assume extern int for all unresolved references?
Who knows. Anyway... the following patch adds errno.h where it seems to
be needed and gets radiance building fairly cleanly on my system.
This touches LOTS of files and probably doesn't add the #include's in ways
that make the maintainer(s) of those files happy (blank lines, etc.).
Also, radiance has a bit of a header-file spaghetti thing going on so it's
hard to tell what is actually including what. In the end I got sick of
adding one "#incude <errno.h>" at a time and testing with a rebuild so I
just grepped for files that reference errno but don't have errno.h. I did
try to decide if they might get errno.h through some other header file but
only checked this as far as my own patience could tolerate. SOOO.... this
patch might add a few that aren't really needed.
Good luck, and thanks all for a very fun piece of software!
-Kipp
diff -uNr ray-orig/src/cal/ev.c ray/src/cal/ev.c
--- ray-orig/src/cal/ev.c 2003-02-21 19:07:20.000000000 -0700
+++ ray/src/cal/ev.c 2003-10-05 00:04:09.000000000 -0600
@@ -8,6 +8,7 @@
*/
#include <stdio.h>
+#include <errno.h>
#include "calcomp.h"
diff -uNr ray-orig/src/gen/mkillum2.c ray/src/gen/mkillum2.c
--- ray-orig/src/gen/mkillum2.c 2003-02-21 19:07:24.000000000 -0700
+++ ray/src/gen/mkillum2.c 2003-10-05 00:07:34.000000000 -0600
@@ -5,6 +5,7 @@
* Routines to do the actual calculation for mkillum
*/
+#include <errno.h>
#include "mkillum.h"
#include "face.h"
diff -uNr ray-orig/src/gen/mkillum.c ray/src/gen/mkillum.c
--- ray-orig/src/gen/mkillum.c 2003-03-11 12:29:05.000000000 -0700
+++ ray/src/gen/mkillum.c 2003-10-05 00:06:23.000000000 -0600
@@ -8,7 +8,7 @@
#include "mkillum.h"
#include <signal.h>
···
-
+#include <errno.h>
#include <ctype.h>
/* default parameters */
diff -uNr ray-orig/src/hd/holofile.c ray/src/hd/holofile.c
--- ray-orig/src/hd/holofile.c 2003-02-21 19:07:24.000000000 -0700
+++ ray/src/hd/holofile.c 2003-10-05 00:08:22.000000000 -0600
@@ -7,6 +7,7 @@
* 9/30/97 GWLarson
*/
+#include <errno.h>
#include "holo.h"
#ifndef CACHESIZE
diff -uNr ray-orig/src/hd/rhdisp.c ray/src/hd/rhdisp.c
--- ray-orig/src/hd/rhdisp.c 2003-02-21 19:07:24.000000000 -0700
+++ ray/src/hd/rhdisp.c 2003-10-05 00:08:37.000000000 -0600
@@ -10,6 +10,7 @@
#include "rhdriver.h"
#include "selcall.h"
#include <ctype.h>
+#include <errno.h>
#ifndef VIEWHISTLEN
#define VIEWHISTLEN 4 /* number of remembered views */
diff -uNr ray-orig/src/hd/rholo2l.c ray/src/hd/rholo2l.c
--- ray-orig/src/hd/rholo2l.c 2003-02-21 19:07:25.000000000 -0700
+++ ray/src/hd/rholo2l.c 2003-10-05 00:08:49.000000000 -0600
@@ -9,6 +9,7 @@
#include "random.h"
#include "paths.h"
#include "selcall.h"
+#include <errno.h>
#include <signal.h>
#include <sys/time.h>
diff -uNr ray-orig/src/hd/rholo4.c ray/src/hd/rholo4.c
--- ray-orig/src/hd/rholo4.c 2003-02-21 19:07:25.000000000 -0700
+++ ray/src/hd/rholo4.c 2003-10-05 00:09:02.000000000 -0600
@@ -7,6 +7,7 @@
#include "rholo.h"
#include "rhdisp.h"
+#include <errno.h>
#include <sys/uio.h>
#ifndef HDSUF
diff -uNr ray-orig/src/px/tiff/contrib/mfs/mfs_file.c ray/src/px/tiff/contrib/mfs/mfs_file.c
--- ray-orig/src/px/tiff/contrib/mfs/mfs_file.c 1997-08-29 16:56:40.000000000 -0600
+++ ray/src/px/tiff/contrib/mfs/mfs_file.c 2003-10-05 00:09:37.000000000 -0600
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
/*
--------------------------------------------------------------------------------
diff -uNr ray-orig/src/rt/aniso.c ray/src/rt/aniso.c
--- ray-orig/src/rt/aniso.c 2003-03-12 10:26:58.000000000 -0700
+++ ray/src/rt/aniso.c 2003-10-05 00:10:13.000000000 -0600
@@ -5,6 +5,7 @@
* Shading functions for anisotropic materials.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/m_brdf.c ray/src/rt/m_brdf.c
--- ray-orig/src/rt/m_brdf.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/m_brdf.c 2003-10-05 00:10:37.000000000 -0600
@@ -5,6 +5,7 @@
* Shading for materials with arbitrary BRDF's
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/m_direct.c ray/src/rt/m_direct.c
--- ray-orig/src/rt/m_direct.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/m_direct.c 2003-10-05 00:10:47.000000000 -0600
@@ -6,6 +6,7 @@
* their associated virtual light sources
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/mx_data.c ray/src/rt/mx_data.c
--- ray-orig/src/rt/mx_data.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/mx_data.c 2003-10-05 00:11:01.000000000 -0600
@@ -5,6 +5,7 @@
* mx_data.c - routine for stored mixtures.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/mx_func.c ray/src/rt/mx_func.c
--- ray-orig/src/rt/mx_func.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/mx_func.c 2003-10-05 00:11:10.000000000 -0600
@@ -5,6 +5,7 @@
* mx_func.c - routine for mixture functions.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/p_data.c ray/src/rt/p_data.c
--- ray-orig/src/rt/p_data.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/p_data.c 2003-10-05 00:11:24.000000000 -0600
@@ -5,6 +5,7 @@
* p_data.c - routine for stored patterns.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/p_func.c ray/src/rt/p_func.c
--- ray-orig/src/rt/p_func.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/p_func.c 2003-10-05 00:11:32.000000000 -0600
@@ -5,6 +5,7 @@
* p_func.c - routine for procedural patterns.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/raypcalls.c ray/src/rt/raypcalls.c
--- ray-orig/src/rt/raypcalls.c 2003-02-24 19:47:23.000000000 -0700
+++ ray/src/rt/raypcalls.c 2003-10-05 00:11:48.000000000 -0600
@@ -7,6 +7,7 @@
* External symbols declared in ray.h
*/
+#include <errno.h>
#include "copyright.h"
/*
diff -uNr ray-orig/src/rt/rpict.c ray/src/rt/rpict.c
--- ray-orig/src/rt/rpict.c 2003-03-10 10:26:26.000000000 -0700
+++ ray/src/rt/rpict.c 2003-10-05 00:12:08.000000000 -0600
@@ -9,6 +9,7 @@
#include "ray.h"
+#include <errno.h>
#include <sys/types.h>
#ifndef NIX
diff -uNr ray-orig/src/rt/rpmain.c ray/src/rt/rpmain.c
--- ray-orig/src/rt/rpmain.c 2003-02-24 19:47:23.000000000 -0700
+++ ray/src/rt/rpmain.c 2003-10-05 00:12:29.000000000 -0600
@@ -17,6 +17,7 @@
#include "paths.h"
+#include <errno.h>
#include <sys/types.h>
#include <signal.h>
diff -uNr ray-orig/src/rt/rtmain.c ray/src/rt/rtmain.c
--- ray-orig/src/rt/rtmain.c 2003-02-24 19:47:23.000000000 -0700
+++ ray/src/rt/rtmain.c 2003-10-05 00:12:42.000000000 -0600
@@ -17,6 +17,7 @@
#include "paths.h"
+#include <errno.h>
#include <sys/types.h>
#include <signal.h>
diff -uNr ray-orig/src/rt/rview.c ray/src/rt/rview.c
--- ray-orig/src/rt/rview.c 2003-02-24 19:47:23.000000000 -0700
+++ ray/src/rt/rview.c 2003-10-05 00:12:53.000000000 -0600
@@ -13,6 +13,7 @@
#include "rpaint.h"
+#include <errno.h>
#include <signal.h>
#include <ctype.h>
diff -uNr ray-orig/src/rt/rvmain.c ray/src/rt/rvmain.c
--- ray-orig/src/rt/rvmain.c 2003-02-24 19:47:23.000000000 -0700
+++ ray/src/rt/rvmain.c 2003-10-05 00:13:08.000000000 -0600
@@ -17,6 +17,7 @@
#include "paths.h"
+#include <errno.h>
#include <signal.h>
#include "view.h"
diff -uNr ray-orig/src/rt/t_data.c ray/src/rt/t_data.c
--- ray-orig/src/rt/t_data.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/t_data.c 2003-10-05 00:13:26.000000000 -0600
@@ -5,6 +5,7 @@
* t_data.c - routine for stored textures
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/rt/t_func.c ray/src/rt/t_func.c
--- ray-orig/src/rt/t_func.c 2003-03-05 09:16:53.000000000 -0700
+++ ray/src/rt/t_func.c 2003-10-05 00:13:35.000000000 -0600
@@ -5,6 +5,7 @@
* t_func.c - routine for procedural textures.
*/
+#include <errno.h>
#include "copyright.h"
#include "ray.h"
diff -uNr ray-orig/src/util/ranimate.c ray/src/util/ranimate.c
--- ray-orig/src/util/ranimate.c 2003-02-24 19:47:24.000000000 -0700
+++ ray/src/util/ranimate.c 2003-10-05 00:13:46.000000000 -0600
@@ -16,6 +16,7 @@
#include "copyright.h"
#include "standard.h"
+#include <errno.h>
#include <ctype.h>
#include <sys/stat.h>
#include "view.h"
diff -uNr ray-orig/src/util/rpiece.c ray/src/util/rpiece.c
--- ray-orig/src/util/rpiece.c 2003-02-21 19:07:30.000000000 -0700
+++ ray/src/util/rpiece.c 2003-10-05 00:13:59.000000000 -0600
@@ -5,6 +5,7 @@
* Generate sections of a picture.
*/
+#include <errno.h>
#include "standard.h"
#ifndef F_SETLKW