[darwinbuild-dev] Building AppleFan.kext

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Feb 18 10:35:58 PST 2009


Jonas Maebe wrote on ma, 16 feb 2009:

> On 16 Feb 2009, at 17:07, William Siegrist wrote:
>
>> xnu comes with the 2 files (*.defs) you need in   
>> /usr/include/device. So make sure you load xnu and the files are   
>> there:
>>
>> $ darwinbuild -load xnu
>> $ ls -1 BuildRoot/usr/include/device/
>> device.defs
>> device_port.h
>> device_types.defs
>> device_types.h
>>
>> The source files get generated during the DeviceMIG target of   
>> IOKitUser.  If you are building with -nochroot, you need to copy   
>> the .defs files from BuildRoot to /usr/include/device/.
>
> Thanks, I missed the "-load". I've also created /usr/include/device and
> copied the .defs files there. However, still no dice (same error as
> before). I did  notice the following in the build log though:
>
> (NOTE: project IOKitUser was written by a newer Xcode version (45) --
> temporarily downgrading it (without modifying project file))
>
> I'll try downloading and installing Xcode 3.1.2 and see whether that
> solves it.

I discovered that the def files are not getting translated in case you  
build with -nochroot (the shell script of the target that should build  
that is simply empty in that case for some reason). Since -nochroot  
was required for my hfs+ disk image, I've restarted from scratch  
(thanks for the updated instructions in the README). I've also  
installed Xcode 3.1.2 (first, I ran  
/Developer/Library/uninstall-devtools).

I'm still not getting anywhere, though.

First of all, I got many errors about missing "as" binaries (this also  
happened previously). E.g., when asking to build AppleFan without  
-nochroot:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BUILDING AppleFan-110.3.1~2 on Sat Feb 14 08:43:25 PST 2009
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Build configuration:
     Build host:           bigmac.elis.UGent.be
     Build tool:           xcodebuild
     Build action:         install
     Build number:         9G55
     Host kernel version:  Darwin Kernel Version 9.6.0: Mon Nov 24  
17:39:01 PST 2008; root:xnu-1228.9.59~1/RELEASE_PPC
     cc version:           gcc version 4.0.1 (Apple Inc. build 5465)
     cctools version:      Fan/build-AppleFan-110.3.1~2.sh: line 13:  
as: command not found

(see the last line -- this also resulted in compilation failures while  
building AppleFan itself). So I copied /usr/bin/as and  
/usr/libexec/gcc/darwin/ppc/as to the buildroot.

Next, I got the errors about the missing headers, so I tried to build  
IOKitUser. As explained at the start of this reply, the translation of  
the def files by mig does not work with -nochroot for some reason, so  
I left it out. That however results in another problem:

     /bin/sh -c  
/private/var/tmp/IOKitUser/IOKitUser-388.50.obj/IOKitUser.build/DeviceMIG.build/Script-2DCEADC108DB8EA700B0CBEA.sh
/usr/bin/mig -DIOKIT -D__MigTypeCheck=1 -fconstant-cfstrings -server  
/dev/null -header  
/private/var/tmp/IOKitUser/IOKitUser-388.50.obj/IOKitUser.build/DerivedSources/iokitmig32.h -user /private/var/tmp/IOKitUser/IOKitUser-388.50.obj/IOKitUser.build/DerivedSources/iokitmig32.c  
/usr/include/device/device.defs
dyld: Library not loaded:  
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
   Referenced from: /usr/bin/arch
   Reason: image not found


I initially started by first copying Foundation.framework into the  
BuildRoot, then CoreFoundation, then /usr/lib/libicucore.A.dylib, and  
then I gave up. I renamed BuildRoot/usr/bin/arch and put in its place  
a bash script simply containing "echo ppc" (I know arch does more than  
that, but I guess that's not needed here).

Next, I got consecutive errors about missing assemblers for ppc64 and  
x86_64, which I also copied to  
BuildRoot/ibexec/gcc/darwin/$respective_arch, along with the i386 one  
since I guessed that one would error next.

The next error was that /usr/bin/strip was not found, so I copied it as well.

Then everything finally built successfully, but:

The following build commands failed:
ShadowExternalHeaders:
	PBXCp  
/private/var/tmp/IOKitUser/IOKitUser-388.50.sym/BuiltProducts/include/IOKit/graphics/IODisplayProductIDs.h  
/System/Library/Frameworks/IOKit.framework/Versions/A/PrivateHeaders/graphics/IODisplayProductIDs.h
	PBXCp  
/private/var/tmp/IOKitUser/IOKitUser-388.50.sym/BuiltProducts/include/IOKit/graphics/IOAccelSurfaceControl.h  
/System/Library/Frameworks/IOKit.framework/Versions/A/PrivateHeaders/graphics/IOAccelSurfaceControl.h
	PBXCp  
/private/var/tmp/IOKitUser/IOKitUser-388.50.sym/BuiltProducts/include/IOKit/graphics/IOGraphicsLibPrivate.h  
/System/Library/Frameworks/IOKit.framework/Versions/A/PrivateHeaders/graphics/IOGraphicsLibPrivate.h
(3 failures)


I googled one of those and discovered it was part of the AppleDisplays  
project:

bash-3.2# darwinbuild AppleDisplays
*** Fetching Sources ...
Found AppleDisplays-170.0.1.tar.gz in /Volumes/Builds/9G55/Sources
[snip]
Build log begins here:

Makefile:5: /Developer/Makefiles/pb_makefiles/platform.make: No such  
file or directory
make: *** No rule to make target  
`/Developer/Makefiles/pb_makefiles/platform.make'.  Stop.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  BUILD TIME: 0h 0m 0s
EXIT STATUS: 2

So I copied /Developer/Makefiles/pb_makefiles into the BuildRoot, then:

     /XCD/loper/usr/bin/g++-4.0  -o  
/private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.root//System/Library/Extensions/AppleOnboardDisplay.kext/Contents/MacOS/AppleOnboardDisplay   "-L/private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.sym/BuiltProducts"  "-F/private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.sym/BuiltProducts"  -filelist /private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.obj/AppleOnboardDisplay.build/AppleOnboardDisplay.build/Objects-normal/LinkFileList   "-arch" "i386" "-arch" "ppc" "-static" "-nostdlib" "-r" "-lkmodc++" "-lkmod" "-lcc_kext"  
"-lcpp_kext"

DynamicLibrary.LinkUsingFileList  
/private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.root//System/Library/Extensions/AppleOnboardDisplay.kext/Contents/MacOS/AppleOnboardDisplay
collect2: cannot find 'ld'
collect2: cannot find 'ld'
g++-4.0: installation problem, cannot exec 'lipo': No such file or directory
...failed DynamicLibrary.LinkUsingFileList  
/private/var/tmp/AppleDisplays/AppleDisplays-170.0.1.root//System/Library/Extensions/AppleOnboardDisplay.kext/Contents/MacOS/AppleOnboardDisplay  
...

So I copied /usr/bin/ld and /usr/bin/lipo into the BuildRoot. During  
next try ld_classic was missing, so I also copied it.

And then I almost fell out of my chair, as the first project finally  
built successfully :)

Two IOKitUSer header problems remained, which I solved with the help  
of  
http://www.puredarwin.org/developers/darwinbuild/troubleshooting#TOC-IOKitUser  
(third and fourth problem mentioned there, adjusting the version  
numbers in the solution for the 9G55 build).

Next, I got an error about a missing CoreFoundation/CoreFoundation.h  
error, so I did a darwinbuild CF.

This one actually downloaded cctools and ld64 tarballs, so I guess I  
could/should have installed those instead of manually copying the  
assemblers/linkers/strip into my buildroot.

Anyway, the CF build failed because of a missing AvailabilityMacros.h,  
and I did not manage to install CarbonHeaders to fix that:

# darwinbuild CarbonHeaders
*** Fetching Sources ...
Downloading http://src.macosforge.org/Projects//CarbonHeaders-9G55.tar.gz ...
*** Copying Sources ...
tar (child): /Volumes/Builds/9G55/Sources/CarbonHeaders-9G55.tar.gz:  
Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
*** Installing Roots ...
*** Installing Headers ...
*** Mounting special filesystems ...
Mounting devfs ...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BUILDING CarbonHeaders-9G55~3 on Wed Feb 18 10:33:53 PST 2009
[snip]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
make install  "SRCROOT=/SourceCache/CarbonHeaders/CarbonHeaders-9G55"  
"OBJROOT=/private/var/tmp/CarbonHeaders/CarbonHeaders-9G55.obj"  
"SYMROOT=/private/var/tmp/CarbonHeaders/CarbonHeaders-9G55.sym"  
"DSTROOT=/private/var/tmp/CarbonHeaders/CarbonHeaders-9G55.root"  
"RC_ProjectName=CarbonHeaders" "RC_ProjectSourceVersion=9G55"  
"RC_ProjectNameAndSourceVersion=CarbonHeaders-9G55"  
"RC_ProjectBuildVersion=3" "INSTALLED_PRODUCT_ASIDES=YES"  
"MACOSX_DEPLOYMENT_TARGET=10.5" "NEXT_ROOT=" "RC_ARCHS=ppc i386"  
"RC_CFLAGS=-pipe -no-cpp-precomp -arch ppc -arch i386" "RC_JASPER=YES"  
"RC_NONARCH_CFLAGS=-pipe -no-cpp-precomp" "RC_OS=macos"  
"RC_PRIVATE=/private" "RC_RELEASE=Leopard" "RC_XBS=YES" "RC_i386=YES"  
"RC_ppc=YES" "SEPARATE_STRIP=YES" "UNAME_RELEASE=9.0"  
"UNAME_SYSNAME=Darwin" < /dev/null
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Build log begins here:

make: *** No rule to make target `install'.  Stop.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  BUILD TIME: 0h 0m 0s
EXIT STATUS: 2


Jonas

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the darwinbuild-dev mailing list