Bug 195287 - build failure mac os x : ld: in ../VEX/libvex-x86-darwin.a, archive has no table of contents
Summary: build failure mac os x : ld: in ../VEX/libvex-x86-darwin.a, archive has no ta...
Status: VERIFIED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Other
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-05 02:38 UTC by Bob Clary [:bc]
Modified: 2012-08-09 04:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
configure output (9.99 KB, text/plain)
2009-06-05 03:51 UTC, Bob Clary [:bc]
Details
make output (95.36 KB, text/plain)
2009-06-05 03:52 UTC, Bob Clary [:bc]
Details
patch (338 bytes, patch)
2009-06-05 06:12 UTC, Nicholas Nethercote
Details
ar man page (9.75 KB, text/plain)
2009-06-05 12:13 UTC, Bob Clary [:bc]
Details
patch (339 bytes, patch)
2009-06-05 12:14 UTC, Bob Clary [:bc]
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob Clary [:bc] 2009-06-05 02:38:27 UTC
Version:            (using Devel)
Compiler:          i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5465) 
OS:                OS X
Installed from:    Compiled sources

uname -a
Darwin cathy.bclary.com 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1/RELEASE_I386 i386 i386

1.  svn co svn://svn.valgrind.org/valgrind/trunk valgrind
2.  cd valgrind
3. ./autogen.sh
4. ./configure
5. make
...

gcc  -arch i386 -O2 -g -Wmissing-prototypes -Wall -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -mmacosx-version-min=10.5 -fno-stack-protector -mdynamic-no-pic -O2 -Wno-long-long -Wno-pointer-sign -Wdeclaration-after-statement -fno-stack-protector -nodefaultlibs -nostartfiles -Wl,-u,__start -Wl,-e,__start -Wl,-bind_at_load /usr/lib/dyld -arch i386 -Wl,-seg1addr,0xf0080000 -Wl,-stack_addr,0xf0080000 -Wl,-stack_size,0x80000 -Wl,-pagezero_size,0xf0000000  -o memcheck-x86-darwin memcheck_x86_darwin-mc_leakcheck.o memcheck_x86_darwin-mc_malloc_wrappers.o memcheck_x86_darwin-mc_main.o memcheck_x86_darwin-mc_translate.o memcheck_x86_darwin-mc_machine.o memcheck_x86_darwin-mc_errors.o ../coregrind/libcoregrind-x86-darwin.a ../VEX/libvex-x86-darwin.a -lgcc 
ld: in ../VEX/libvex-x86-darwin.a, archive has no table of contents
collect2: ld returned 1 exit status
make[3]: *** [memcheck-x86-darwin] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

$ svn info
Path: .
URL: svn://svn.valgrind.org/valgrind/trunk
Repository Root: svn://svn.valgrind.org/valgrind
Repository UUID: a5019735-40e9-0310-863c-91ae7b9d1cf9
Revision: 10248
Node Kind: directory
Schedule: normal
Last Changed Author: njn
Last Changed Rev: 10248
Last Changed Date: 2009-06-04 16:17:12 -0700 (Thu, 04 Jun 2009)
Comment 1 Nicholas Nethercote 2009-06-05 03:26:41 UTC
Bob, can you attach a file containing the full output of 'configure' and 'make'?
Hopefully seeing the make output for the building of libvex-x86-darwin.a will indicate something.
Comment 2 Bob Clary [:bc] 2009-06-05 03:51:30 UTC
Created attachment 34272 [details]
configure output
Comment 3 Bob Clary [:bc] 2009-06-05 03:52:23 UTC
Created attachment 34273 [details]
make output
Comment 4 Nicholas Nethercote 2009-06-05 04:58:39 UTC
It's a mystery to me, but Googling came up with some suggestions.

- Try running 'ranlib' on libvex-x86-darwin.a and then rerunning 'make'.

- Does the path containing Valgrind have any spaces?  If so, try removing them.

http://www.haskell.org/pipermail/glasgow-haskell-users/2007-October/013322.html
http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg16863.html

If 'ranlib' fixes it, the above pages suggest that adding -s to our invocation of 'ar' might fix the problem.
Comment 5 Bob Clary [:bc] 2009-06-05 05:10:52 UTC
ranlib "fixed" it. Thanks!
Comment 6 Nicholas Nethercote 2009-06-05 06:12:17 UTC
Created attachment 34277 [details]
patch

So the question now is: why the problem on Bob's machine?  On my Mac, 'ar' unbelievably doesn't support -h or --help or -v or --version so I can't work out what version number it is.

Anyway, it seems that we use "ar cru" in most of Valgrind, but "ar clq" for libvex.a.  I barely understand all that stuff, but Bob, can you try the attached patch in the VEX/ directory/?  You'll need to run 'make clean' and then 'make'.  Thanks.
Comment 7 Bob Clary [:bc] 2009-06-05 12:13:30 UTC
Created attachment 34289 [details]
ar man page

No, it didn't work. I think on my system at least it requires the -s option to write the object index into the archive. See attached ar.man
Comment 8 Bob Clary [:bc] 2009-06-05 12:14:21 UTC
Created attachment 34290 [details]
patch

this works for me.
Comment 9 Nicholas Nethercote 2009-06-06 04:07:48 UTC
I was wondering why 'ar cru' was working for the other .a files built (eg. libcoregrind-x86-darwin) but now I realise that ranlib (which is equivalent to 'ar s') is run on them subsequently, but not for libvex-x86-darwin.a, because libvex-x86-darwin.a is generated via a hand-written Makefile rather than an autotool-generated one.
Comment 10 Nicholas Nethercote 2009-06-10 03:09:13 UTC
Fixed in Vex r1900.  Thanks for the report.
Comment 11 Bob Clary [:bc] 2009-06-10 10:50:19 UTC
svn up works. thanks. verified.