Bug 327745 - [PATCH] valgrind 3.9.0 build fails on Mac OS X 10.6.8
Summary: [PATCH] valgrind 3.9.0 build fails on Mac OS X 10.6.8
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.9.0
Platform: Compiled Sources macOS
: NOR normal
Target Milestone: ---
Assignee: Rhys Kidd
URL:
Keywords:
: 330984 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-18 05:38 UTC by Mark H
Modified: 2015-07-24 10:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix syscall conditionals OS X 10.6.8 (14.51 KB, patch)
2013-11-18 05:42 UTC, Mark H
Details
Rebased patch against r15443 (14.23 KB, patch)
2015-07-23 21:20 UTC, Rhys Kidd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark H 2013-11-18 05:38:03 UTC
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.
Comment 1 Mark H 2013-11-18 05:42:33 UTC
Created attachment 83614 [details]
Fix syscall conditionals OS X 10.6.8

Corrects #if conditions and 10.6.8 build failure
Comment 2 Julian Seward 2014-09-03 06:59:45 UTC
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?
Comment 3 Mark H 2014-09-05 07:21:53 UTC
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.
Comment 4 Rhys Kidd 2015-06-01 00:00:29 UTC
*** Bug 330984 has been marked as a duplicate of this bug. ***
Comment 5 Rhys Kidd 2015-07-13 01:38:16 UTC
Hello Mark,
I'll take a look at this. Is your attached patch the most current one you have available?
Comment 6 Rhys Kidd 2015-07-23 21:20:01 UTC
Created attachment 93718 [details]
Rebased patch against r15443
Comment 7 Rhys Kidd 2015-07-24 07:09:30 UTC
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.
Comment 8 Rhys Kidd 2015-07-24 10:24:04 UTC
Committed in r15444.