Modifying build dependencies, + more questions
Hi, I have a darwinbuild derived project that crashes at the first usage of the C++ standard lib on 10.6.x if not compiled with darwinbuild. (on 10.5 it works fine). It's pretty stomping as the build options for the Xcode and darwinbuild compiles are identical. I pimped the darwinbuild Tokend project to include my tokend. I have three associated questions, the most important one is how to extend the build dependencies: Q1: I extended the 10A432.plist with the additional dependency, but it does not seem the get read with a simple "darwinbuild Tokend". I need additionally CoreServices.framework. How can I force re-reading of the 10A432.plist? darwinxref? Q2: the header <dlfcn.h> is missing in the darwinbuild environment. However, the project is dependent from the "dyld" root, which contains the header. Bug or oversight on my part? I tried to force addition of the headers with "darwinbuild -header dyld" and "darwinbuild -header libdyld" but both fail. Q3: How can I build a certain target of an project? "darwinbuild -target=PIV Tokend" did not work. TIA, Thomas
On Jan 6, 2010, at 10:29 AM, Thomas Engelmeier wrote:
Hi,
I have a darwinbuild derived project that crashes at the first usage of the C++ standard lib on 10.6.x if not compiled with darwinbuild. (on 10.5 it works fine). It's pretty stomping as the build options for the Xcode and darwinbuild compiles are identical.
I pimped the darwinbuild Tokend project to include my tokend. I have three associated questions, the most important one is how to extend the build dependencies:
Q1: I extended the 10A432.plist with the additional dependency, but it does not seem the get read with a simple "darwinbuild Tokend". I need additionally CoreServices.framework. How can I force re-reading of the 10A432.plist? darwinxref?
You should create a new plist that inherits from one of the provided plists (see 10B504.plist for how it inherits fro 10A432.plist). Then just add the differences to your plist. In order to see CoreServices.framework during the build, you need to pass the "-nochroot" option to darwinbuild (which means nothing in BuildRoot will be used) or copy CoreServices.framework into your BuildRoot/ (this is the best approach). If you need to reload a plist, use "darwinxref loadIndex <path-to-plist>".
Q2: the header <dlfcn.h> is missing in the darwinbuild environment. However, the project is dependent from the "dyld" root, which contains the header. Bug or oversight on my part? I tried to force addition of the headers with "darwinbuild -header dyld" and "darwinbuild -header libdyld" but both fail.
That header is provided by libdyld. Try "darwinbuild -load libdyld" to load the full libdyld root. Doing "darwinbuild -header libdyld" says "build the installhdrs phase". Using both "-load" and "-header" says to "load the headers root", which would look like "darwinbuild -header -load libdyld".
Q3: How can I build a certain target of an project? "darwinbuild -target=PIV Tokend" did not work.
This works for me, note that xcodebuild is passed a -target option: # darwinbuild -target=PIV Tokend ...snip... zlib -> bf9a63cca042bf6656be18a883ac0edd1f33fc35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ xcodebuild install -sdk Darwinbuild_10C540_20091207070452 -target "PIV" "SRCROOT=/Users/wms/darwin/10C540/BuildRoot/Sour... -Bill
Am 06.01.2010 um 20:13 schrieb William Siegrist: Hi Bill, thanks for your help. The Tokend build process works far better than last year.
Q1: I extended the 10A432.plist with the additional dependency, but it does not seem the get read with a simple "darwinbuild Tokend". I need additionally CoreServices.framework. How can I force re-reading of the 10A432.plist? darwinxref?
You should create a new plist that inherits from one of the provided plists (see 10B504.plist for how it inherits fro 10A432.plist). Then just add the differences to your plist. In order to see CoreServices.framework during the build, you need to pass the "-nochroot" option to darwinbuild (which means nothing in BuildRoot will be used) or copy CoreServices.framework into your BuildRoot/ (this is the best approach). If you need to reload a plist, use "darwinxref loadIndex <path-to-plist>".
OK, do I understand correctly that there is no root for CoreServices.framework? And copying to BuildRoot means (in the case of an "default" inited build-system copying to /Volumes/BuildRoot_10A432_{someHash}/System/Library/Frameworks/ ? If my perception is right, BuildRoot is some kind of volatile disk that gets nuked at reboot time - which I have to do a lot. A broken Tokend brings down Securityd, and then there is not much left you can do then without rebooting. I am not confident -nochroot would work. Based on the crashes I see there is a chance libstdc++ differs between the 10.6 SDK and darwinbuild.
That header is provided by libdyld. Try "darwinbuild -load libdyld" to load the full libdyld root. Doing "darwinbuild -header libdyld" says "build the installhdrs phase". Using both "-load" and "-header" says to "load the headers root", which would look like "darwinbuild -header -load libdyld".
Perfect, thanks.
Q3: How can I build a certain target of an project? "darwinbuild -target=PIV Tokend" did not work. This works for me, note that xcodebuild is passed a -target option:
Now it works also for me. Sorry for the noise. Best regards, Thomas
On Jan 6, 2010, at 1:12 PM, Thomas Engelmeier wrote:
Am 06.01.2010 um 20:13 schrieb William Siegrist:
Hi Bill,
thanks for your help. The Tokend build process works far better than last year.
Q1: I extended the 10A432.plist with the additional dependency, but it does not seem the get read with a simple "darwinbuild Tokend". I need additionally CoreServices.framework. How can I force re-reading of the 10A432.plist? darwinxref?
You should create a new plist that inherits from one of the provided plists (see 10B504.plist for how it inherits fro 10A432.plist). Then just add the differences to your plist. In order to see CoreServices.framework during the build, you need to pass the "-nochroot" option to darwinbuild (which means nothing in BuildRoot will be used) or copy CoreServices.framework into your BuildRoot/ (this is the best approach). If you need to reload a plist, use "darwinxref loadIndex <path-to-plist>".
OK, do I understand correctly that there is no root for CoreServices.framework? And copying to BuildRoot means (in the case of an "default" inited build-system copying to /Volumes/BuildRoot_10A432_{someHash}/System/Library/Frameworks/ ?
CoreServices is not open source, so you have to copy it from your own copy of Mac OS X. As far as where darwinbuild puts things, the directory you run "darwinbuild -init" in is usually referred to as your "darwinbuild environment". It has several subdirectories for storing roots, tarballs, etc. The metadata is under the .build/ directory if you want to dig into the internals. When you build a project, the build process happens in the "build root", which is the BuildRoot/ directory. That root is analogous to "/" of a Mac OS X system, so you'll find /System and /Applications there, etc. The source you build from is copied from a tarball in Sources/ into BuildRoot/SourceCache/ and the working root directories (OBJROOT, SYMROOT, etc) are under BuildRoot/var/tmp/. Now, depending on options you passed to "darwinbuild -init", you have 1 of three storage types for the BuildRoot. If you passed no options, you get the default "sparse disk image" storage, which means there is a .build/buildroot.sparsebundle disk image that gets mounted on demand. The name of the volume when it mounts is what you mentioned, BuildRoot_<build>_<timestamp>. We then add a symlink from BuildRoot/ to this volume. If you reboot, the disk image will need to be remounted, but running any darwinbuild command should trigger the on-demand remount. If it doesn't, or you find it is not sufficient, file a bug. The next storage option is "nfs loopback" (darwinbuild -init -nfs) for people who don't want to use a diskimage, which sets up an NFS export and mounts it from localhost. And finally, if you use the "-nodmg" option, BuildRoot/ is just a regular directory. The reason why the sparse disk image is the default is it used to work around a bug in Xcode, but we kept it as the default since having things neatly packaged in a disk image was deemed useful. So bottom line, I recommend you copy CoreServices.framework into BuildRoot/System/Library/Framework. For extra safely and sanity, I recommend you use darwinup to install it so you can easily track and uninstall it later. Once you successfully build your new tokend, use "/usr/local/share/darwinbuild/packageRoots" to generate a tarball of the Tokend root. Then you can use darwinup to install that tarball onto your real system. If you get into trouble, boot onto another partition and use darwinup to uninstall your Tokend. Look for the "-p" option in darwinup. -Bill
On 06.01.2010, at 22:50, William Siegrist wrote: Hi Bill,
The metadata is under the .build/ directory if you want to dig into the internals.
OK, I didn't spot the build sparsebundle because the directory is hidden...
So bottom line, I recommend you copy CoreServices.framework into BuildRoot/System/Library/Framework. For extra safely and sanity, I recommend you use darwinup to install it so you can easily track and uninstall it later. Once you successfully build your new tokend, use "/usr/local/share/darwinbuild/packageRoots" to generate a tarball of the Tokend root. Then you can use darwinup to install that tarball onto your real system. If you get into trouble, boot onto another partition and use darwinup to uninstall your Tokend. Look for the "-p" option in darwinup.
Awesome. Thanks for your extensive mail. Finally it cleared up _a lot_ I did not understand yet. Best regards, Thomas
participants (2)
-
Thomas Engelmeier
-
William Siegrist