[distcc] Re: How split c++ passes for MacOS X CrossCompiler
Markus Biermaier
mbier at office-m.at
Tue Dec 2 19:41:24 GMT 2003
Am Dienstag den, 2. Dezember 2003, um 18:24, schrieb Dara Hazeghi:
> P.S. BTW, how did you manage to build a cross-compiler
> to darwin? I've never gotten the process to work fully.
Strange, it was YOUR thread on the list:
"[distcc] distcc with cc1", that helped me to figure out the scheme.
Anyway, here is my receipt:
--- Begin of LinuxPC-stuff ---
host=i686-pc-linux-gnu
target=powerpc-apple-darwin
prefix=/usr/local/$target
1. Build of gcc-3.3.2 on LinuxPC (i686-pc-linux-gnu). No probs.
2. Build of binutils-2.14 on LinuxPC. No Probs.
$ ../binutils/configure --target=$target --prefix=$prefix
$ make
$ make install
3. Copy "/usr/include" from MacOS X to LinuxPC as
"/usr/local/powerpc-apple-darwin/"
but take care:
$ dir /usr/include/gcc/darwin/2.95.2/g++/
total 1232
-r--r--r-- 1 root wheel 1049 Sep 2 2001 typeinfo
-r--r--r-- 1 root wheel 161 Sep 2 2001 new.h
-r--r--r-- 1 root wheel 1207 Sep 2 2001 new
...
-r--r--r-- 1 root wheel 13509 Sep 2 2001 bastring.cc
-r--r--r-- 1 root wheel 4314 Sep 2 2001 strstream.h
lrwxr-xr-x 1 root wheel 1 Sep 2 2001
std -> . <--- !!! ATTENTION !!! gets recursiv!
-r--r--r-- 1 root wheel 2230 Sep 2 2001 _G_config.h
drwxr-xr-x 127 root wheel 4274 Sep 2 2001 .
drwxr-xr-x 12 root wheel 364 Sep 2 2001 ..
Before copying / archiving you have to remove "std".
Before your next compile on the Mac you have to re-link "std" again...
4. Build of gcc-3.3.2 CrossCompiler on LinuxPC. Lots of troubles.
$ ../gcc/configure --target=$target --prefix=$prefix
*** This configuration is not supported in the following
subdirectories:
target-libffi target-boehm-gc target-zlib target-libjava
(Any other directories should still work fine.)
$ make -k
$ make install -k
The "-k" was the trick. From YOUR thread I learned, that there is no
darwin-assembler in gcc.
5. Copy the not installed "cc1", "cc1plus" "by hand".
cd ~/YOUR-BUILD-WORKING-DIR/build-gcc-powerpc-apple-darwin/gcc
sudo cp -p cc1 /usr/local/powerpc-apple-darwin/lib/gcc-
lib/powerpc-apple-darwin/3.3.2/
sudo cp -p cc1plus /usr/local/powerpc-apple-darwin/lib/gcc-
lib/powerpc-apple-darwin/3.3.2/
--- End of LinuxPC-stuff ---
--- Begin of MacOS X-stuff ---
6. I used a wrapper-script for "cc" on MacOS X.
It is a perl-script with the following core:
# Output CompilerCmds
#--------------------------------------------------
Command ("/usr/bin/cc -E $NoOutParameters $Name.$Extension >
$Name.i\n"); # LOCAL
Command ("powerpc-apple-darwin-gcc $NoOutParameters -S $Name.i -o
$Name.s\n"); # DISTANT
Command ("/usr/bin/cc $Name.s $TheParameters
\n"); # LOCAL
Command ("rm $Name.i
$Name.s\n"); # LOCAL
#--------------------------------------------------
# Output CompilerCmds
Quick Description:
$TheParameters: All parameters.
$NoOutParameters: All parameters except "-o file".
$Name: Source-file-name.
The script also handles a problem with quoting of parameters.
My test-case was the "readline-4.3" library. The Makefile generates
lines like:
... -DRL_LIBRARY_VERSION='"4.3"' ...
This is handled by the perl-script.
If someone is interested I can post the complete script.
7. Create the necessary links.
$ dir /usr/lib/distcc/bin
total 64
drwxr-xr-x 3 root wheel 58 Nov 25 14:58 ..
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-jv-scan -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-jcf-dump -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-gcjh -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-gcj -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-gcc-3.3.2 -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-gcc -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-g77 -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-g++ -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-cpp -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10
powerpc-apple-darwin-c++ -> /usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10 jar ->
/usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10 grepjar ->
/usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 21 Nov 29 12:10 gcc ->
/usr/local/bin/distcc
lrwxr-xr-x 1 root wheel 28 Nov 29 12:10 cc ->
/Users/markus/Src/CC-Dist.pm <--- SCRIPT SEE ABOVE
drwxr-xr-x 18 root wheel 568 Nov 29 12:10 .
8. For me with MacOS X 10.1.5
DISTCC_MMAP=0 is essential.
9. Time the success:
Local:
(G3 / 350 MHz)
real 1m6.498s
user 0m48.330s
sys 0m8.440s
Distccd (tcp) -j 5, no "localhost"
(Intel SuSE-Linux / 900 MHz)
real 0m39.759s
user 0m21.170s
sys 0m11.380s
--- End of MacOS X-stuff ---
HTH
Markus
----------------------------------------------------------------------
M. Biermaier
Wiesengasse 15
3011 Untertullnerbach E-Mail: mbier AT office-m.at
Austria / Europe Web Site: http://www.office-m.at
More information about the distcc
mailing list