crosstool-0.28-rc16: compiling linux-2.6.6 on Mac OS X
Martin Schaffner
schaffner@gmx.li
Sun May 23 02:06:00 GMT 2004
Today I sucessfully tested crosstool-0.28-rc16 with the following
command:
export TARBALLS_DIR=/Volumes/ext/src/ RESULT_TOP=/opt/crosstool
GCC_LANGUAGES="c,c++"; eval `cat powerpc-750.dat
gcc-3.4.0-glibc-2.3.2.dat` LINUX_DIR=linux-2.6.6
BINUTILS_DIR=binutils-2.14.90.0.5 sh all.sh --notest
I set BINUTILS_DIR to an old version because of the following issue
when compiling linux:
http://mail.gnu.org/archive/html/bug-binutils/2004-05/msg00064.html
Maybe crosstool should contain a patch against this problem?
I had to apply the following patch to linux-2.6.6 for it to compile on
Mac OS X.
Unfortunately, it is quite OS X-specific, so I won't even try to get it
included into the official tree...
diff -ur linux-2.6.6/Makefile l266mod/Makefile
--- linux-2.6.6/Makefile Mon May 10 03:32:53 2004
+++ l266mod/Makefile Fri May 21 17:07:37 2004
@@ -195,7 +195,7 @@
HOSTCC = gcc
HOSTCXX = g++
-HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-idirafter `$(CC)
-print-file-name=include`/../../../../../?????*/include/ # for elf.h
HOSTCXXFLAGS = -O2
# Decide whether to build built-in, modular, or both.
diff -ur linux-2.6.6/scripts/Makefile.build
l266mod/scripts/Makefile.build
--- linux-2.6.6/scripts/Makefile.build Mon May 10 03:33:13 2004
+++ l266mod/scripts/Makefile.build Fri May 21 16:48:09 2004
@@ -343,15 +343,17 @@
# Compile .c file, create position independent .o file
# host-cshobjs -> .o
-quiet_cmd_host-cshobjs = HOSTCC -fPIC $@
- cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
+quiet_cmd_host-cshobjs = HOSTCC -fPIC -fno-common $@
+ cmd_host-cshobjs = $(HOSTCC) $(hostc_flags) -fPIC -fno-common -c
-o $@ $<
$(host-cshobjs): %.o: %.c FORCE
$(call if_changed_dep,host-cshobjs)
# Link a shared library, based on position independent .o files
# *.o -> .so shared library (host-cshlib)
+SHARED_SWITCH = `if $(HOSTCC) -dM -E - < /dev/null | grep -q APPLE; \
+ then echo "-dynamiclib"; else echo "-shared"; fi`
quiet_cmd_host-cshlib = HOSTLLD -shared $@
- cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
+ cmd_host-cshlib = $(HOSTCC) $(HOSTLDFLAGS) $(SHARED_SWITCH) -o
$@ \
$(addprefix $(obj)/,$($(@F:.so=-objs))) \
$(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F))
$(host-cshlib): %: $(host-cshobjs) FORCE
diff -ur linux-2.6.6/scripts/sumversion.c l266mod/scripts/sumversion.c
--- linux-2.6.6/scripts/sumversion.c Mon May 10 03:32:54 2004
+++ l266mod/scripts/sumversion.c Fri May 21 16:11:28 2004
@@ -1,4 +1,6 @@
+#ifndef __APPLE__
#include <netinet/in.h>
+#endif
#include <stdint.h>
#include <ctype.h>
#include <errno.h>
@@ -374,7 +376,7 @@
break;
/* Terminate line at first space, to get rid of final ' \' */
while (*p) {
- if isspace(*p) {
+ if (isspace(*p)) {
*p = '\0';
break;
}
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list