lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Annotated Patches for MacOS X 10.2 / gcc 3.1


From: Matthias Neeracher
Subject: Annotated Patches for MacOS X 10.2 / gcc 3.1
Date: Sat, 24 Aug 2002 15:57:39 -0700

In case anybody's interested, here are the patches I found necessary to compile on MacOS X 10.2. While some of these also were necessary on 10.1, most of the patches are new and necessitated by the transition to gcc 3.1 (the patch also still works on gcc 2.95.2).

It's not clear to me to what extent these patches are necessary for gcc 3.1 on other platforms, but they might be of interest to other porters.

Matthias

1) if __GNU_LIBRARY__ is not defined, kpathsea/getopt.h prototypes getopt as extern getopt()
to get around parameter incompatibilities. While this works for C, this of course is not a viable
approach for C++ (where the empty parameter list is taken literally). Luckily the declaration
if __GNU_LIBRARY__ *is* defined is compatible with the declaration used by MacOS X.


diff -ru lilypond-1.6.0.orig/lily/kpath.cc lilypond-1.6.0/lily/kpath.cc
--- lilypond-1.6.0.orig/lily/kpath.cc Fri Jul 26 03:26:59 2002
+++ lilypond-1.6.0/lily/kpath.cc Thu Aug 22 14:29:03 2002
@@ -14,6 +14,7 @@
#define popen REALLYUGLYKLUDGE
#define pclose ANOTHERREALLYUGLYKLUDGE
#define getopt YAKLUDGE
+#define __GNU_LIBRARY__


#if HAVE_KPATHSEA_KPATHSEA_H
extern "C" {

2) MacOS X defines isinf and isnan as macros. <cmath>, apparently for compatibility reasons, undefines those macros and only makes these definitions visible under conditions which are
not met on MacOS X. Therefore, we have to pull these definitions into (inline) functions before
including <cmath>.

diff -ru lilypond-1.6.0.orig/lily/lily-guile.cc lilypond-1.6.0/lily/lily-guile.cc
--- lilypond-1.6.0.orig/lily/lily-guile.cc Sun Aug 18 16:12:43 2002
+++ lilypond-1.6.0/lily/lily-guile.cc Thu Aug 22 16:13:12 2002
@@ -23,6 +23,11 @@
#include "interval.hh"
#include "pitch.hh"
#include "dimensions.hh"
+//
+// source-file.hh includes cmath which undefines isinf and isnan
+//
+inline int (isinf)(Real r) { return isinf(r); }
+inline int (isnan)(Real r) { return isnan(r); }
#include "source-file.hh"


// #define TEST_GC

3) This one is both nasty and mysterious: If <iostream.h> is first encountered through an include
from <FlexLexer.h>, gcc 3.1 hundreds of "template has C linkage" errors. If it's first included
from the file to be compiled, everything works fine. The solution is to insert an #include <iostream.h> into any file that directly or indirectly includes <FlexLexer.h>. In the case of the
flex generated lexer itself, this has to be done through a make recipe, since the #include <FlexLexer.h> is placed in the generated file before anything included from the .ll file.

diff -ru lilypond-1.6.0.orig/lily/my-lily-parser.cc lilypond-1.6.0/lily/my-lily-parser.cc
--- lilypond-1.6.0.orig/lily/my-lily-parser.cc Fri Aug 16 18:38:52 2002
+++ lilypond-1.6.0/lily/my-lily-parser.cc Fri Aug 23 14:31:54 2002
@@ -7,6 +7,10 @@
Jan Nieuwenhuizen <address@hidden>
*/


+//
+// Work aroung a gcc 3.1 (?) bug
+//
+#include <iostream.h>
#include "my-lily-parser.hh"
#include "my-lily-lexer.hh"
#include "warn.hh"
diff -ru lilypond-1.6.0.orig/lily/parser.yy lilypond-1.6.0/lily/parser.yy
--- lilypond-1.6.0.orig/lily/parser.yy Sun Aug 18 16:12:43 2002
+++ lilypond-1.6.0/lily/parser.yy Fri Aug 23 18:30:09 2002
@@ -23,6 +23,7 @@


*/


+#include <iostream.h>
#include <ctype.h>


#include "translator-def.hh"
diff -ru lilypond-1.6.0.orig/stepmake/stepmake/c++-rules.make lilypond-1.6.0/stepmake/stepmake/c++-rules.make
--- lilypond-1.6.0.orig/stepmake/stepmake/c++-rules.make Wed Jul 17 17:08:20 2002
+++ lilypond-1.6.0/stepmake/stepmake/c++-rules.make Fri Aug 23 17:37:11 2002
@@ -24,4 +24,5 @@
rm -f $(*F).tab.c $(*F).tab.cc # if this happens in the wrong order it triggers recompile of the .cc file


$(outdir)/%.cc: %.ll
- $(FLEX) -Cfe -p -p -t $< > $@
+ echo '#include <iostream.h>' > $@
+ $(FLEX) -Cfe -p -p -t $< >> $@

4) This one, I think, is a Linuxism (At least I see it frequently in ports from Linux). <malloc.h> is
a nonstandard header that does not exist on MacOS X and many other platforms. malloc() is properly defined in <stdlib.h>.

diff -ru lilypond-1.6.0.orig/lily/parser.yy lilypond-1.6.0/lily/parser.yy
--- lilypond-1.6.0.orig/lily/parser.yy Sun Aug 18 16:12:43 2002
+++ lilypond-1.6.0/lily/parser.yy Fri Aug 23 18:30:09 2002
@@ -111,7 +112,6 @@


// needed for bison.simple's malloc () and free ()


-#include <malloc.h>
#include <stdlib.h>


5) Not sure whether this is a MacOS X bug or a bug in the source, but on MacOS X, <sys/resource.h> needs <sys/time.h> to work.

diff -ru lilypond-1.6.0.orig/lily/score.cc lilypond-1.6.0/lily/score.cc
--- lilypond-1.6.0.orig/lily/score.cc Thu Aug 15 05:52:19 2002
+++ lilypond-1.6.0/lily/score.cc Fri Aug 23 14:54:49 2002
@@ -77,6 +77,7 @@
#define PARANOIA


#ifdef PARANOIA
+#include <sys/time.h>
#include <sys/resource.h>
#endif

6) Fink likes to install its headers outside the default compiler include path, so $(CPPFLAGS)
is necessary to propagate the fink include directory into build recipes.

diff -ru lilypond-1.6.0.orig/stepmake/stepmake/c-vars.make lilypond-1.6.0/stepmake/stepmake/c-vars.make
--- lilypond-1.6.0.orig/stepmake/stepmake/c-vars.make Wed Jul 17 17:08:20 2002
+++ lilypond-1.6.0/stepmake/stepmake/c-vars.make Thu Aug 22 13:38:36 2002
@@ -13,4 +13,4 @@


ALL_C_SOURCES += $(H_FILES) $(C_FILES) $(Y_FILES) $(L_FILES)


-ALL_CFLAGS = $(CFLAGS) $(ICFLAGS) $(DEFINES) $(addprefix -I,$(INCLUDES)) $(USER_CFLAGS) $(EXTRA_CFLAGS) $(MODULE_CFLAGS)
+ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(ICFLAGS) $(DEFINES) $(addprefix -I,$(INCLUDES)) $(USER_CFLAGS) $(EXTRA_CFLAGS) $(MODULE_CFLAGS)

7) A MacOSXism.

diff -ru lilypond-1.6.0.orig/stepmake/stepmake/compile-vars.make lilypond-1.6.0/stepmake/stepmake/compile-vars.make
--- lilypond-1.6.0.orig/stepmake/stepmake/compile-vars.make Wed Jul 17 17:36:15 2002
+++ lilypond-1.6.0/stepmake/stepmake/compile-vars.make Fri Aug 23 18:50:41 2002
@@ -3,7 +3,7 @@
ALL_LDFLAGS = $(LDFLAGS) $(ILDFLAGS) $(EXTRA_LDFLAGS) $($(PACKAGE)_LDFLAGS) $(MODULE_LDFLAGS) $(USER_LDFLAGS)


PIC_FLAGS = -fpic -fPIC
-SHARED_FLAGS = -shared
+SHARED_FLAGS = -shared -flat_namespace -undefined suppress


o-dep-out = $(outdir)/$(subst .o,.dep,$(notdir $@))#
DO_O_DEP = rm -f $(o-dep-out); DEPENDENCIES_OUTPUT="$(o-dep-out) $(outdir)/$(notdir $@)"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]