This weekend I finally tracked down a long-standing build problem affecting
guile 1.3.4 and all recent CVS versions of guile-core on alpha-dec-osf. It
looks like the build problem may be easiest to reproduce when building
--with-threads, but my guess is it may happen in other circumstances too.
The problems manifests as:
Making all in libguile
gmake[1]: Entering directory `/local/src/RPM/BUILD/guile-1.3.4/libguile'
./guile-snarf -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./..
-I/local/src/RPM/BUILD/guile-1.3.4/qt -I../qt -I/local/gnu/include -std1 -O2 -g3 -tune
host -arch host -portable -readonly_strings -pthread -readonly_strings -portable
-msg_disable inlinestoclsmod -I/local/gnu/include alist.c > alist.x \
|| { rm alist.x; false; }
/bin/sh ../libtool --mode=compile cc -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./..
-I/local/src/RPM/BUILD/guile-1.3.4/qt -I../qt -I/local/gnu/include -std1 -O2 -g3
-tune host -arch host -portable -readonly_strings -pthread -readonly_strings -portable
-msg_disable inlinestoclsmod -I/local/gnu/include -c alist.c
mkdir .libs
cc -DHAVE_CONFIG_H -I. -I. -I. -I.. -I./.. -I/local/src/RPM/BUILD/guile-1.3.4/qt
-I../qt -I/local/gnu/include -std1 -O2 -g3 -tune host -arch host -portable
-readonly_strings -pthread -readonly_strings -portable -msg_disable inlinestoclsmod
-I/local/gnu/include -c alist.c -DPIC -o .libs/alist.lo
cc: Error: ./random.h, line 102: Missing ";". (nosemi)
extern SCM scm_c_random_bignum (scm_rstate *, SCM m);
-----------^
cc: Error: ./random.h, line 114: Missing ";". (nosemi)
extern SCM scm_var_random_state;
-----------^
cc: Error: ./random.h, line 115: Missing ";". (nosemi)
extern SCM scm_random (SCM n, SCM state);
-----------^
cc: Error: ./random.h, line 116: Missing ";". (nosemi)
extern SCM scm_copy_random_state (SCM state);
-----------^
cc: Error: ./random.h, line 117: Missing ";". (nosemi)
extern SCM scm_seed_to_random_state (SCM seed);
-----------^
cc: Error: ./random.h, line 118: Missing ";". (nosemi)
extern SCM scm_random_uniform (SCM state);
-----------^
cc: Error: ./random.h, line 119: Missing ";". (nosemi)
extern SCM scm_random_solid_sphere_x (SCM v, SCM state);
-----------^
cc: Error: ./random.h, line 120: Missing ";". (nosemi)
extern SCM scm_random_hollow_sphere_x (SCM v, SCM state);
-----------^
cc: Error: ./random.h, line 121: Missing ";". (nosemi)
extern SCM scm_random_normal (SCM state);
-----------^
cc: Error: ./random.h, line 122: Missing ";". (nosemi)
extern SCM scm_random_normal_vector_x (SCM v, SCM state);
-----------^
cc: Error: ./random.h, line 123: Missing ";". (nosemi)
extern SCM scm_random_exp (SCM state);
-----------^
cc: Error: ../libguile/tags.h, line 55: In this declaration, "SCM" has no linkage and
has a prior declaration in this scope at line number 102 in file ./random.h.
(nolinkage)
typedef long SCM;
-------------^
cc: Error: __scm.h, line 422: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_call_generic_0 (SCM gf);
-------^
cc: Error: __scm.h, line 431: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_call_generic_1 (SCM gf, SCM a1);
-------^
cc: Error: __scm.h, line 440: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_call_generic_2 (SCM gf, SCM a1, SCM a2);
-------^
cc: Error: __scm.h, line 449: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_apply_generic (SCM gf, SCM args);
-------^
cc: Error: error.h, line 62: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_error SCM_P ((SCM key, const char *subr, const char *message,
----------------------^
cc: Error: error.h, line 62: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_error SCM_P ((SCM key, const char *subr, const char *message,
----------------------^
cc: Error: error.h, line 62: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_error SCM_P ((SCM key, const char *subr, const char *message,
----------------------^
cc: Error: error.h, line 64: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_error_scm SCM_P ((SCM key, SCM subr, SCM message,
-------^
cc: Error: error.h, line 66: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_strerror (SCM err);
-------^
cc: Error: error.h, line 68: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_syserror_msg SCM_P ((const char *subr, const char *message,
-----------------------------^
cc: Error: error.h, line 72: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_out_of_range SCM_P ((const char *subr, SCM bad_value))
-----------------------------^
cc: Error: error.h, line 74: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_wrong_num_args SCM_P ((SCM proc)) SCM_NORETURN;
-------------------------------^
cc: Error: error.h, line 75: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_wrong_type_arg SCM_P ((const char *subr, int pos,
-------------------------------^
cc: Error: error.h, line 78: In this declaration, "SCM" does not name a type.
(nottypedef)
extern void scm_misc_error SCM_P ((const char *subr, const char *message,
---------------------------^
cc: Error: error.h, line 80: In this declaration, "SCM" does not name a type.
(nottypedef)
extern SCM scm_wta SCM_P ((SCM arg, const char *pos, const char *s_subr));
-------^
cc: Error: ../libguile/options.h, line 67: In this declaration, "SCM" does not name a
type. (nottypedef)
extern SCM scm_options SCM_P ((SCM new_mode, scm_option options[], int n, const char
*s));
-------^
cc: Error: ../libguile/options.h, line 68: In this declaration, "SCM" does not name a
type. (nottypedef)
extern void scm_init_opts SCM_P ((SCM (*func) (SCM), scm_option options[], int n));
--------------------------^
cc: Error: print.h, line 83: In this declaration, "SCM" does not name a type.
(nottypedef)
SCM handle; /* Struct handle */
--^
cc: Error: print.h, line 89: In this declaration, "SCM" does not name a type.
(nottypedef)
SCM hot_ref; /* Hot reference */
--^
cc: Severe: More than 30 errors were encountered in the course of compilation.
(toomanyerr)
gmake[1]: *** [alist.lo] Error 1
gmake[1]: Leaving directory `/local/src/RPM/BUILD/guile-1.3.4/libguile'
gmake: *** [all-recursive] Error 1
Bad exit status from /var/tmp/rpm-tmp.23976 (%build)
The reason for the build problem is:
1) alist.c includes _scm.h
2) _scm.h includes __scm.h
3) __scm.h does some stuff, and then since STDC_HEADERS is defined, it
includes <stdlib.h> *before* it includes "libguile/tags.h".
4) <stdlib.h> includes random.h. This is where the real problem happens.
stdlib.h is trying to include the system's <random.h>, but because of the
cpp flags passed during the build, it's actually getting the libguile/random.h.
5) libguile/random.h immediately includes __scm.h, but because the header
guard is already defined (we're about halfway through __scm.h in step #3) it
doesn't get anything. The SCM type is then used in random.h, and madness
ensues since libguile/tags.h hasn't been included yet by anything.
One possible fix would be to move the #include "libguile/tags.h" to much
nearer the top of __scm.h, but I think that's just putting the problem off,
rather than really fixing it. It will allow the build to procede, but who
knows if a similar but even harder to trace problem will pop up on some other
system down the road, because of the "include jungle".
My humble suggestion is that `random.h' is an unfortunate name for a local
header file, even one that is referenced as "libguile/random.h".
Looking over the other header files that get installed in libguile, there
are a few others that probably shadow system header files on any number
of systems.
The most bullet-proof solution for the problem would be to rename many of
the header files, especially the ones that will be installed as part of
a `make install', so that they have a unique prefix, e.g. `guile_'. This
would give you things like `guile_random.h', `guile_tags.h', etc. You would
want to rename the header guards (#ifdef RANDOM_H becomes #ifdef
GUILE_RANDOM_H) and you would need to change all the files that include these
header files, but it does have the best chance of fixing the problem once and
for all.
The two concerns are whether the longer filenames will cause problems for
some systems (does guile run on MSDOS? Does it need to?) and whether some
of the header files are "advertised" as part of the guile/libguile API, so
that other programs would need to change.
I would be willing to help with the work if the more invasive option is
chosen (the first option, of moving the include of libguile/tags.h higher
in __scm.h hardly requires help).
Tim
--
Tim Mooney [EMAIL PROTECTED]
Information Technology Services (701) 231-1076 (Voice)
Room 242-J1, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164