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

MacPorts noreply at macports.org
Thu Nov 23 23:26:57 UTC 2017


#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


More information about the macports-tickets mailing list