[MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

[MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
--------------------+-----------------------
 Reporter:  akimd   |      Owner:
     Type:  defect  |     Status:  new
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:  2.3.5
 Keywords:          |       Port:  clang-3.9
--------------------+-----------------------
 Hi,

 It seems that clang expects the libraries for C++ to be at another place:

 {{{
 $ cat foo.cc
 12
 int main()
 {
   return 1 << 34;
 }

 $ clang++-mp-3.9 -fsanitize=undefined foo.cc
 foo.cc:3:12: warning: shift count >= width of type [-Wshift-count-
 overflow]
   return 1 << 34;
            ^  ~~
 1 warning generated.
 $ ./a.out
 dyld: Library not loaded:
 /opt/local/libexec/llvm-3.9/lib/libclang_rt.ubsan_osx_dynamic.dylib
   Referenced from: /private/tmp/./a.out
   Reason: image not found
 zsh: abort (core dumped)  ./a.out
 $ ls  /opt/local/libexec/llvm-3.9/lib/libclang_*
 zsh: no matches found: /opt/local/libexec/llvm-3.9/lib/libclang_*
 $ ls /opt/local/libexec/llvm-3.9/lib/clang/3.9.1/lib/darwin
 libclang_rt.10.4.a                      libclang_rt.eprintf.a
 libclang_rt.safestack_osx.a             libclang_rt.tsan_osx_dynamic.dylib
 libclang_rt.asan_osx_dynamic.dylib      libclang_rt.osx.a
 libclang_rt.stats_client_osx.a
 libclang_rt.ubsan_osx_dynamic.dylib
 libclang_rt.cc_kext.a                   libclang_rt.profile_osx.a
 libclang_rt.stats_osx_dynamic.dylib
 $ DYLD_LIBRARY_PATH=/opt/local/libexec/llvm-3.9/lib/clang/3.9.1/lib/darwin
 ./a.out
 foo.cc:3:12: runtime error: shift exponent 34 is too large for 32-bit type
 'int'
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+-------------------
  Reporter:  akimd      |      Owner:
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+-------------------

Comment (by akimd):

 Note that SIP makes this even more troublesome: when running a program
 such as `./configure`, DYLD_ variables are not preserved.  Workaronds
 makes things more complex, and less portable.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------
Changes (by mf2k):

 * status:  new => assigned
 * cc: jeremyhu@…, larryv@… (removed)
 * cc: larryv (added)
 * owner:   => jeremyhu


--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by jeremyhu):

 Yeah, looks like the dylib ID is wrong:

 {{{
 ~ $ otool -D
 /opt/local/libexec/llvm-3.9/lib/clang/3.9.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
 /opt/local/libexec/llvm-3.9/lib/clang/3.9.1/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:
 /opt/local/libexec/llvm-3.9/lib/libclang_rt.asan_osx_dynamic.dylib
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by jeremyhu):

 The executable's LC_RPATH is correct.

 {{{
 Load command 14
           cmd LC_RPATH
       cmdsize 32
          path @executable_path (offset 12)
 Load command 15
           cmd LC_RPATH
       cmdsize 80
          path
 /opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.1/lib/darwin (offset 12)
 }}}

 We just need to figure out:

 1) Why aren't the sanitizer dylibs getting installed with an @rpath-
 relative dylib id.
 2) Optionally, figure out why the fixed path dylib id doesn't match the
 install path either.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by akimd):

 Ping?  Not being able to use any of the sanitizers is disabling.  Thanks!

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by jeremyhu):

 You can use them just fine using DYLD_INSERT_LIBRARIES.

 If you can answer either of those questions above and provide a solution,
 I'll integrate it.  Otherwise, you're going to have to wait until someone
 else has time to look into the issue and provide such a solution.  I
 currently don't have resources for that and won't for at least another
 month.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by hmijail):

 Just wanted to note that, as akimd mentioned already, the DYLD_*
 environment variables getting cleared by SIP make working around this
 issue quite difficult.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by akimd):

 Hi all,

 FWIW, there is an easy workaround (that the package should implement
 imho): install a symlink.  I've been using it successfully for quite a
 while now, with different versions of clang-*.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:8>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by hmijail):

 Issue still present in clang 5.0.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:9>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang-3.9: sanitizer libraries not at the right place

MacPorts
In reply to this post by MacPorts
#53299: clang-3.9: sanitizer libraries not at the right place
------------------------+----------------------
  Reporter:  akimd      |      Owner:  jeremyhu
      Type:  defect     |     Status:  assigned
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.3.5
Resolution:             |   Keywords:
      Port:  clang-3.9  |
------------------------+----------------------

Comment (by jeremyhu):

 Yes, and I unfortunately don't see having time to get around to this issue
 any time soon, but if someone is able to provide a patch or can answer my
 points in comment #4, that would help.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:10>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries not at the right place (was: clang-3.9: sanitizer libraries not at the right place)

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries not at the right place
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------
Changes (by kencu):

 * port:  clang-3.9 => clang-3.9 clang-4.0 clang-5.0


--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:12>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id (was: clang sanitizer libraries not at the right place)

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:13>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 I think the broken logic is in this cmake file `llvm-5.0.0.src/projects
 /compiler-rt/cmake/Modules/AddCompilerRT.cmake`, presumably in the install
 directory sorting. CMake is hard to decipher with so many included
 modules. Needs a debugger or something.

 I note most of the compiler_rt modules are installed as STATIC, and only a
 few are SHARED. I don't know yet if the other SHARED ones are broken too.

 Shared ones I found are:
 {{{
 clang_rt.asan
 clang_rt.lsan
 clang_rt.tsan
 clang_rt.ubsan
 clang_rt.stats
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:14>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 If I'm understanding it correctly, the broken install names wind up here:
 {{{
 build/projects/compiler-
 rt/lib/asan/CMakeFiles/clang_rt.asan_osx_dynamic.dir/link.txt
 build/projects/compiler-
 rt/lib/lsan/CMakeFiles/clang_rt.lsan_osx_dynamic.dir/link.txt
 build/projects/compiler-
 rt/lib/tsan/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/link.txt
 build/projects/compiler-
 rt/lib/ubsan/CMakeFiles/clang_rt.ubsan_osx_dynamic.dir/link.txt
 build/projects/compiler-
 rt/lib/stats/CMakeFiles/clang_rt.stats_osx_dynamic.dir/link.txt
 }}}
 eg
 {{{
 /usr/bin/clang++ -pipe -Os -std=c++11 -stdlib=libc++ -fPIC -fvisibility-
 inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter
 -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-
 long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-
 virtual-dtor -Wstring-conversion -Wall -std=c++11 -Wno-unused-parameter
 -DNDEBUG -arch x86_64 -arch x86_64h -dynamiclib
 -Wl,-headerpad_max_install_names  -stdlib=libc++ -lc++ -lc++abi
 -fapplication-extension -mmacosx-version-min=10.9 -isysroot
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
 -Wl,-U,___ubsan_default_options -Wl,-U,___sanitizer_free_hook
 -Wl,-U,___sanitizer_malloc_hook -Wl,-U,___sanitizer_report_error_summary
 -Wl,-U,___sanitizer_sandbox_on_notify -Wl,-U,___sanitizer_symbolize_code
 -Wl,-U,___sanitizer_symbolize_data -Wl,-U,___sanitizer_symbolize_demangle
 -Wl,-U,___sanitizer_symbolize_flush -L/opt/local/lib
 -Wl,-headerpad_max_install_names -o
 ../../../../lib/clang/5.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib
 -install_name
 /opt/local/libexec/llvm-5.0/lib/libclang_rt.tsan_osx_dynamic.dylib
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_clock.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_debugging.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_external.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_fd.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_flags.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_ignoreset.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interceptors.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interface.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interface_ann.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interface_atomic.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interface_java.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_malloc_mac.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_md5.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_mman.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_mutex.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_mutexset.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_preinit.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_report.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_mutex.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_proc.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_report.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_thread.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_stack_trace.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_stat.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_suppressions.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_symbolize.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_sync.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_interceptors_mac.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_libdispatch_mac.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_platform_mac.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_platform_posix.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_new_delete.cc.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_amd64.S.o
 CMakeFiles/clang_rt.tsan_osx_dynamic.dir/rtl/tsan_rtl_aarch64.S.o
 ../interception/CMakeFiles/RTInterception.osx.dir/interception_linux.cc.o
 ../interception/CMakeFiles/RTInterception.osx.dir/interception_mac.cc.o
 ../interception/CMakeFiles/RTInterception.osx.dir/interception_win.cc.o
 ../interception/CMakeFiles/RTInterception.osx.dir/interception_type_test.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_allocator.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_common.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_deadlock_detector1.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_deadlock_detector2.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_errno.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_flags.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_flag_parser.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_libc.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_libignore.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_linux.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_linux_s390.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_mac.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_persistent_allocator.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_linux.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_posix.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_printf.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_procmaps_common.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_procmaps_freebsd.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_procmaps_linux.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_procmaps_mac.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_stackdepot.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_stacktrace.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_stacktrace_printer.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_stoptheworld_mac.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_suppressions.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_symbolizer.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_symbolizer_libbacktrace.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_symbolizer_mac.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_symbolizer_win.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_tls_get_addr.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_thread_registry.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_win.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_termination.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_common_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sancov_flags.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_coverage_libcdep_new.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_coverage_win_sections.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_linux_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_mac_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_posix_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_stacktrace_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_stoptheworld_linux_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_symbolizer_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_symbolizer_posix_libcdep.cc.o
 ../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.osx.dir/sanitizer_unwind_linux_libcdep.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_diag.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_init.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_flags.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_handlers.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_value.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_handlers_cxx.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_type_hash.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_type_hash_itanium.cc.o
 ../ubsan/CMakeFiles/RTUbsan.osx.dir/ubsan_type_hash_win.cc.o
 -Wl,-rpath,/opt/local/libexec/llvm-5.0/lib
 }}}

 with the install names set like this:
 {{{
 -install_name
 /opt/local/libexec/llvm-5.0/lib/libclang_rt.tsan_osx_dynamic.dylib
 }}}
 and the rpaths like this:
 {{{
 -Wl,-rpath,/opt/local/libexec/llvm-5.0/lib
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:15>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 One could probably hack in a reinplace fix for the portfile while Apple
 sorts our the cmake error.

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:16>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 Oh oh. I think we might be making this happen by setting the install name
 dir and the rpath in the portfile:
 {{{
 cmake.install_prefix ${sub_prefix}

 # Adjust this once cmake-1.0.tcl is fixed:
 #     https://github.com/macports/macports-ports/pull/103
 # Also see:
 #     https://llvm.org/bugs/show_bug.cgi?id=31425
 configure.args-delete \
     -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib \
     -DCMAKE_INSTALL_RPATH=${prefix}/lib \
     -DCMAKE_SYSTEM_PREFIX_PATH="${prefix}\;/usr"
 configure.args-append \
     -DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
     -DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib \
     -DCMAKE_SYSTEM_PREFIX_PATH="${cmake.install_prefix}\;${prefix}\;/usr"
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:17>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 Some useful references for this twice-a-year how-does-it-work-again issue:

 <http://log.zyxar.com/blog/2012/03/10/install-name-on-os-x/>

 <https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath>

 <https://www.mikeash.com/pyblog/friday-qa-2009-11-06-linking-and-install-
 names.html>

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:18>
MacPorts <https://www.macports.org/>
Ports system for macOS
Reply | Threaded
Open this post in threaded view
|

Re: [MacPorts] #53299: clang sanitizer libraries have incorrect dylib id

MacPorts
In reply to this post by MacPorts
#53299: clang sanitizer libraries have incorrect dylib id
--------------------------------------------+----------------------
  Reporter:  akimd                          |      Owner:  jeremyhu
      Type:  defect                         |     Status:  assigned
  Priority:  Normal                         |  Milestone:
 Component:  ports                          |    Version:  2.3.5
Resolution:                                 |   Keywords:
      Port:  clang-3.9 clang-4.0 clang-5.0  |
--------------------------------------------+----------------------

Comment (by kencu):

 OK. Rebuilt clang-5.0, stripping out these two Portfile commands
 {{{
     -DCMAKE_INSTALL_NAME_DIR=${cmake.install_prefix}/lib \
     -DCMAKE_INSTALL_RPATH=${cmake.install_prefix}/lib \
 }}}
 with that, clang-5.0 builds through to completion without any trouble.
 Running the example of the original poster, everything works as it should.
 {{{
 $ cat foo.cc
 int main()
 {
   return 1 << 34;
 }


 $ clang++-mp-5.0 -fsanitize=undefined foo.cc
 foo.cc:3:12: warning: shift count >= width of type [-Wshift-count-
 overflow]
   return 1 << 34;
            ^  ~~
 1 warning generated.

 $ ./a.out
 foo.cc:3:12: runtime error: shift exponent 34 is too large for 32-bit type
 'int'
 }}}
 checking the executable shows the expected linking:
 {{{
 $ otool -L a.out
 a.out:
         /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
 version 400.9.0)
         @rpath/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version
 0.0.0, current version 0.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1252.0.0)
 }}}

 The sanitizer dylibs now have the proper names:
 {{{
 $ otool -D libclang_rt.asan_osx_dynamic.dylib
 libclang_rt.asan_osx_dynamic.dylib:
 @rpath/libclang_rt.asan_osx_dynamic.dylib
 }}}

 Now back to the original issue that led to this CMAKE_INSTALL_NAME in the
 first place:

 {{{
 $ otool -D libclang.dylib
 libclang.dylib:
 @rpath/libclang.dylib

 $ otool -D libLLVM.dylib
 libLLVM.dylib:
 /opt/local/libexec/llvm-5.0/lib/libLLVM.dylib

 $ otool -D libLTO.dylib
 libLTO.dylib:
 /opt/local/libexec/llvm-5.0/lib/libLTO.dylib
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53299#comment:19>
MacPorts <https://www.macports.org/>
Ports system for macOS