When I build Valgrind on Mac OS X 10.11 via: 1. Download Valgrind 3.12.0 source code tarball 2. cd to extracted source directory 3. Run ./configure 4. Run make I get this error (truncated output): link_tool_exe_darwin: /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.6 -o memcheck-amd64-darwin -u __start -e __start -image_base 0x138000000 -stack_addr 0x134000000 -stack_size 0x800000 memcheck_amd64_darwin-mc_leakcheck.o memcheck_amd64_darwin-mc_malloc_wrappers.o memcheck_amd64_darwin-mc_main.o memcheck_amd64_darwin-mc_translate.o memcheck_amd64_darwin-mc_machine.o memcheck_amd64_darwin-mc_errors.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a Undefined symbols for architecture x86_64: "___bzero", referenced from: _hijack_thread_state in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-amd64-darwin.o) _RRegUniverse__init in libvex-amd64-darwin.a(libvex_amd64_darwin_a-host_generic_regs.o) ld: symbol(s) not found for architecture x86_64 make[3]: *** [memcheck-amd64-darwin] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
This problem was already discussed on the user mailing list. The below solution was proposed by John Reiser. > Undefined symbols for architecture x86_64: > > "___bzero", referenced from: > > _hijack_thread_state in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-amd64-darwin.o) > > _RRegUniverse__init in libvex-amd64-darwin.a(libvex_amd64_darwin_a-host_generic_regs.o) $ grep -r __bzero valgrind-3.12 ===== coregrind/m_main.c #if defined(VGO_darwin) && DARWIN_VERS == DARWIN_10_10 /* This might also be needed for > DARWIN_10_10, but I have no way to test for that. Hence '==' rather than '>=' in the version test above. */ void __bzero ( void* s, UWord n ); void __bzero ( void* s, UWord n ) { (void) VG_(memset)( s, 0, n ); } #endif ===== So a timid developer chose "not functional" versus "works, but perhaps a few microseconds slower". Just change it to #if defined(VGO_darwin) omitting the test of DARWIN_VERS.
Note that this was fixed in SVN, effectively by always defining __bzero. So, 3.13../SVN should build out of the box r16103 | rhyskidd | 2016-10-23 23:31:16 +0200 (Sun, 23 Oct 2016) | 1 line bzero is non-POSIX (deprecated), accordingly __bzero template required for all macOS versions. n-i-bz. ------------------------------------------------------------------------
Thanks Philippe! I can confirm it builds and installs using the latest SVN commit.
The issue surfaced on a 2012 Intel Core2 Duo MacBook running OS X 10.9. Working from Master, the issue was resolved on OS X 10.9, also.
*** Bug 377550 has been marked as a duplicate of this bug. ***