Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
The first post of this thread is a WikiPost and can be edited by anyone with the appropiate permissions. Your edits will be public.

Andrew-R

macrumors 6502
Original poster
First I cloned

Code:
https://github.com/macosforge/darwinbuild/

because otherwise darwinbuild-legacy was not installable on Leopard/ppc (10.5.8)

Code:
https://trac.macports.org/ticket/64830#comment:3

I switched branch

git branch -r
git checkout -b darwin_9 origin/Darwin9

then patched build like in ppcports for non-legacy darwinbuild.

attached my local hack, not git patch, just plain patch over darwinbuild git sources (darwin9 branch)
credit to @barracuda156 for figuring out hard part and hosting plists and stuff.

There are two parts of problem, source tarballs/tree and Roots (precompiled binaries libs and headers for chroot env where darwinbuild normally operates).

They used to be on http server but now you need to download them from archive.org and/or https://macos-powerpc.org/darwinbuild/

After installing patched darwinbuild I created directory for 9L30 (10.5.8) as darwinbuild README instruct:

Code:
2.1 Creating the Build Directory

After installation, you must initialize the build directory using darwinbuild.  Assuming you wanted to build projects from 9G55 in your home directory:

  # mkdir ~/9G55
  # cd ~/9G55
  # sudo -s                                                                               
# darwinbuild -init 9G55

I did this and meet fact that darwinbuild loads plists over net, and they still not patched.

fixed this as root by putting my patched plists in

Code:
.build/

directory in my 9L30 folder.

Now I downloaded bunch of release tarballs into Sources Subfolder also in my main 9L30 folder:


Code:
wget -A "*.tar.gz" -i \
https://web.archive.org/web/20110723212952/http://www.opensource.apple.com/release/mac-os-x-1058/

For Roots I used similar wget command, but with this url:

Code:
https://web.archive.org/web/20110226233902/http://src.macosforge.org/Roots/

note that I also downloaded all files from subfolders here, and put them in

Code:
Roots/.DownloadCache/

all in same folder, no subfolders.

Not sure if I did this correctly, from darwinbuild script sources it should accept just plain unpacked source tree in Sources so may be cloning this repo will work too?

Code:
git clone https://github.com/mattl/opensource.apple.com/

but it will take more space on hdd (download size 1.78 Gb for git folder alone, 34 Gb unpacked)

Now as root [be sure you are in your initialized project folder after sudo -s, use pwd and ls if unsure) something like

Code:
darwinbuild network_cmds

should work, but for me it ends up in error:

Code:
...
/usr/bin/cc -arch ppc -arch i386 -g -Os -pipe -mdynamic-no-pic -dead_strip -I/System/Library/Frameworks/System.framework/PrivateHeaders -pipe -no-cpp-precomp -arch ppc -arch i386 -I/private/var/tmp/network_cmds/network_cmds-307.1.1.obj/routed -c -o /private/var/tmp/network_cmds/network_cmds-307.1.1.obj/routed/trace.o trace.c                                                            
In file included from trace.c:65
In file included from trace.c:65:                                  /System/Library/Frameworks/System.framework/PrivateHeaders/sys/stat.h:75:26: error: :              /System/Library/Frameworks/System.framework/PrivateHeaders/sys/stat.h:75:26: error: Availability.h: No such file or directory                                                               
Availability.h: No such file or directory                                                
In file included from trace.c:65:

WIP due to this, need to figure out build order.

Code:
bash-3.2# darwinxref  dependencies -header bootstrap_cmds
 Libc_headers
 Libinfo
architecture                                                                              
gcc
 xnu

For listing all project with versions

Code:
darwinxref version \* | less

For removing BuildRoot (mounted as sparse bundle by darwinbuild) and darwinxref database:

Code:
hdiutil detach /Volumes/BuildRoot_9L30_20260721151829/
rm .build/xref.db
rm BuildRoot

for example. (use your volume name of course, is time dependent as you can see. Use mount command to see what mounted on your system)

I tried to put only files from
Code:
9A581                                                                                    
9B18                                                                                      
9C31                                                                                       
9F33
9G55
9J61

roots folders downloaded from Archive.org (I created folder for downloads, manually created numbered dirs there, cd into each dir in Terminal, click on corresponding link in web browser, use wget -i $url in each folder, so files with same name do not mix; added files into .DownloadCache starting with 9A folder and adding missing pieces from other folders without overwriting earlier files OK, overwriting them seems to lead to better results.) but something still not right,

darwinbuild xnu

ends in same
Code:
/bin/sh: line 1: 85549 Bus error               /usr/bin/dsymutil

Victory!

Editing /usr/bin/arch in chroot like this:

Code:
bash-3.2# cat BuildRoot/usr/bin/arch  
#!/bin/sh                                                                  
#uname -m 
echo ppc

fixed cctools and xmu build!

After installing TargetConfig I get some error about tconf unable to find configuration. Googled myself back to this forum, and implemented this solution:

Code:
cp -p
BuildRoot//usr/local/share/TargetConfigs/MacOSX.plist BuildRoot//usr/local/share/TargetConfigs/Default.plist

fix for diskdev_cmds:

Code:
cp -p /Developer//SDKs/MacOSX10.5.sdk/System/Library/Frameworks/IOKit.framework/Versions/A/Headers/storage/IOBDMedia.h   BuildRoot//System/Library/Frameworks/IOKit.framework/Versions/A/Headers/storage/

So for now I have this list of compiled projects:

Csu
SystemStubs
OpenSSL
adv_cmds
bsdmake
text_cmds
libutil
bzip2
zlib
jam
zip
system_config
misc_cmds
man
bootstrap_cmds
developer_cmds
doc_cmds
file_cmds
shell_cmds
files
passwordserver_sasl
mDNSResponderSystemLibraries
autoconf
architecture
CoreOSMakefiles
Libc_headers
pb_makefiles
tcp_wrappers
pbx_jamfiles
netcat
TargetConfig
extenTools
keymgr
Librpcsvc
Libstreams
CF
crontabs
automake
basic_cmds
expat
file
flex
bc
apr
bison
bash
cscope
glibtool
gm4
gnudiff
uucp
pdisk
removefile
srm
patch_cmds
neon
ncurses
nasm
nano
lsof
libiconv
libmd
less
gpt
gperf
gnumake
gcc_select
Liby
pam
bsm
libresolv
libpcap
texi2html
xelf
vim
texinfo
tcsh
sudo
BootX
<--- here I fixed /usr/bin/arch -->
cctools
xnu
cctools_ofiles
hfs
pdisk
xar
diskdev_cmds
zsh
rsync
portmap
notify
mail_cmds
libfs
cron
ld64
awk
Libnotify
Libmx
Libm
Libcpp_kext
libstdcxx
openmpi
 

Attachments

Last edited:
  • Like
Reactions: barracuda156
Progress:

Code:
DSYMUTIL mach_kernel.sys   
                                                                    
    if [ 1  -eq  1 ]; then \         
                                                                                 
 /usr/bin/dsymutil --arch=ppc /private/var/tmp/xnu/xnu-1228.15.4.obj/RELEASE_PPC/./mach_kernel.sys -o /private/var/tmp/xnu/xnu-1228.15.4.obj/RELEASE_PPC/./mach_kernel.sys.dSYM > /dev/null; \                                                                                                    fi;                                                                                        

/bin/sh: line 1:  3514 Bus error               /usr/bin/dsymutil --arch=ppc /private/var/tmp/xnu/xnu-1228.15.4.obj/RELEASE_PPC/./mach_kernel.sys -o /private/var/tmp/xnu/xnu-1228.15.4.obj/RELEASE_PPC/./mach_kernel.sys.dSYM > /dev/null                                                                
make[2]: *** [do_build_mach_kernel] Error 138

Also as far as I can see by default this xnu builds with MAXCPUS=1 so not SMP capable?
 
Copied few files to BuildRoot

Code:
cp -p /Developer/SDKs/MacOSX10.5.sdk/usr/include/Availability.h BuildRoot/usr/include/

cp -p /Developer/SDKs/MacOSX10.5.sdk/usr/include/AvailabilityInternal.h BuildRoot/usr/include/

cp -p /usr/lib/libcrypto.0.9.7.dylib BuildRoot/usr/lib/

edit

Code:
darwinbuild OpenSSL

fixed libcrypto error.

Now more cmds can be built.
 
Last edited:
There is also promising

Code:
darwinxref loadDeps adv_cmds BuildRoot

or in more generic form

Code:
darwinxref [-f db] [-b build] loadDeps <project> <buildroot>

but not sure if it work, it does something but not finished yet.

Edit: nope, it seem to just hang.

I did build this much (hopefully sorted by build order):

Code:
ls -rt1 Roots/                                                                                    
architecture                                                                
SystemStubs                                                                       
bsdmake                                                                                   
libutil                                                                            
autoconf                                                                              
Libc_headers                                                                       
CoreOSMakefiles                                                                                    
Libmx
pb_makefiles                                                                                
OpenSSL                                                                                   
file_cmds                              
text_cmds                                                  
zip                                                
system_config                                        
tcp_wrappers
pbx_jamfiles
netcat                                                    
cctools                                                                     
basic_cmds                                                         
doc_cmds                                           
misc_cmds                                       
developer_cmds                                          
bzip2                            
TargetConfig                                    
cctools_ofiles                                             
libdyld                                        
mDNSResponderSystemLibraries                                  
project_makefiles                                                        
extenTools                      
keymgr

but I think I populated Roots not completely correctly, because many things fail to produce debug symbols, or even configure.

Repopulated Roots, but still errors, including weird ones.

After I installed bootstrap_cmds I can't build cctools or Libnotify

Code:
/usr/bin/mig -user /private/var/tmp/Libnotify/Libnotify-36.obj/notify/notify_ipc_user.c -header /private/var/tmp/Libnotify/Libnotify-36.obj/notify/notify_ipc.h -server /dev/null -sheader /dev/null notify_ipc.defs
gcc-4.0: Invalid arch name : Power
mig: fatal: "<no name yet>", line -1: no SubSystem declaration

mig is Mach Interface Generator if memory serves.

But why it fails now?

May be because output of "uname -m" is Power Macintosh, and not just ppc?
 
Last edited:
Interesting writeup on using datwinbuild to patch gdb ... (in 2009)



random rant about increasingly closed-everything nature of Darwin project, from 2006

Darwinbuild troubleshooting archive page:


yay, my /usr/bin/arch workaround listed there!
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.