[LLVMdev] OSX 10.6 (Snow Leopard): strip: malformed object: clang malformed object (unknown load command 9)
Charles Davis
cdavis5x at gmail.com
Mon Aug 27 16:44:55 PDT 2012
On Aug 27, 2012, at 10:42 AM, David Blaikie wrote:
> I'm working on bringing up a buildbot in the LLVM lab that would run
> the GCC and GDB DejaGNU tests.
>
> The current problem I'm running into is shown here:
> http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb-gcc/builds/323/steps/install.clang.stage1/logs/stdio
>
> When the buildbot attempts to "make install" the system 'strip' binary
> fails while attempting to strip the clang binary.
>
> I vaguely remember hearing something about the system tools of some
> version(s) of Mac OSX not being suitable for building LLVM/Clang - so
> I assume I need to install updated system tools? Is that correct?
Yes.
> Does
> anyone have instructions for how to do this?
Here's what I did. Download the cctools and ld64 source for the latest Xcode (as of this writing, that would be 4.4) from here:
http://opensource.apple.com
Unpack the tarballs, then build new binaries like so:
$ cd cctools-<version>/libstuff
$ make dynamic
$ cd ../ar
$ make # might need this to ensure new ranlib(1) gets called
$ cd ../misc
$ make libtool.NEW # need this to ranlib(1) archives with new load commands
$ sudo install -c -m 0755 libtool.NEW /usr/local/bin/libtool # 'sudo' because /usr/local isn't world writable by default
$ cd ../ar
$ sudo install -c -m 0755 ar.NEW /usr/local/bin/ar
$ sudo ln -s libtool /usr/local/bin/ranlib # will be invoked by ar(1)
Now we need the prunetrie library from ld64; otherwise, strip(1) won't build. You build it like so:
$ cd ld64-<version>/src/other
# No Makefiles in ld64; need to do it the hard way ;)
# May need to go in and fix sources in ../abstraction not to refer to ARM
# Replace <CXXFLAGS> with whatever flags you might want to pass (like -g, -O, -W options)
# Feel free to compile against libc++, if you have it installed
$ clang++ -c -I../abstraction <CXXFLAGS> PruneTrie.cpp
$ ar cru libprunetrie.a PruneTrie.o # Needs ar(1) and ranlib(1) from before, because I told you to use clang :)
$ sudo install -c -m 0644 libprunetrie.a /usr/local/lib/
$ sudo install -d -m 0755 /usr/local/include/mach-o
$ sudo install -c -m 0644 prune_trie.h /usr/local/include/mach-o/
$ cd ../../../cctools-<version>/misc
# NOTE: If you compiled libprunetrie against libc++, you'll need to make sure strip is linked against libc++, too. You can do that by setting RC_CFLAGS.
$ make strip.NEW
$ sudo install -c -m 0755 strip.NEW /usr/local/bin/strip
I'm sorry about the convoluted build process, but it's been this way for longer than I can remember. (It's one of the reasons the OpenDarwin project bombed so miserably.) I've verified that this works on my own computer, and I even linked against libc++ ;).
> (I may need to provide
> these instructions to Galina if I can't run them myself from the
> command line - though a self service option would be preferred)
>
> Thanks,
> - David
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list