On Mac OS X 10.6.8, a build of valgrind 3.9.0 (or current svn) produces several undefined symbols, due to inconsistent "#if" conditions in the valgrind source code. Reproducible: Always Steps to Reproduce: 1../configure 2.make 3. Actual Results: $ make ... link_tool_exe_darwin: /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.5 -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: "_vgSysWrap_darwin_psynch_cvclrprepost_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_rw_unlock_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvclrprepost_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_arap-darwin.o) "_vgSysWrap_darwin_psynch_rw_wrlock_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_mutexwait_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvwait_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvsignal_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvbroad_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_rw_wrlock_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvsignal_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_mutexdrop_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_mutexwait_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_rw_rdlock_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvbroad_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_mutexdrop_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_cvwait_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_rw_rdlock_before", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) "_vgSysWrap_darwin_psynch_rw_unlock_after", referenced from: _vgModuleLocal_syscall_table in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-darwin.o) ld: symbol(s) not found make[3]: *** [memcheck-amd64-darwin] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 $ Expected Results: successful build valgrind 3.9.0 places several system call related definitions within "#if DARWIN_VERS >= DARWIN_10_6" or "#if DARWIN_VERS >= DARWIN_10_7". However, these do not always reflect the actual version where the call was introduced; sometimes the checked version is later and sometimes earlier than it should be. In fact different parts of the valgrind source code sometimes use a different DARWIN_VERS for the same system call, leading to undefined symbols when building valgrind.
Created attachment 83614 [details] Fix syscall conditionals OS X 10.6.8 Corrects #if conditions and 10.6.8 build failure
Can you re-try with the trunk? I do remember making some of these versioning ifdefs a bit tidier a couple of months back. That said .. 10.6.8 is a bit old. The trunk supports 10.8 and 10.9 reasonably well. Can you use those instead?
I tried the trunk (r14461) and also valgrind-3.10.0.BETA1 on my OS X 10.6.8 system. However, both produced the exact same undefined symbol errors as 3.9.0, shown in the bug description. OS X 10.8 and 10.9 do not run on this hardware.
*** Bug 330984 has been marked as a duplicate of this bug. ***
Hello Mark, I'll take a look at this. Is your attached patch the most current one you have available?
Created attachment 93718 [details] Rebased patch against r15443
Hello Mark, I've rebased your patch and completing some final testing before merging in the next few days. Two main issues: * Clarifying gettid (syscall 286), which was a merge conflict. Based on xnu sources this was in fact present in OS X 10.6, which will need to be amended in SVN trunk. * Don't have any actual 10.6 system to test with, but provided there are no regressions on OS X 10.7+ will be happy to merge if it is going to fix build issues for you.
Committed in r15444.