[MacPorts] #64088: cargo-c fails to build on 10.13

MacPorts noreply at macports.org
Sat Dec 4 09:10:05 UTC 2021


#64088: cargo-c fails to build on 10.13
-----------------------+---------------------------------
  Reporter:  bK4gYuRo  |      Owner:  MarcusCalhoun-Lopez
      Type:  defect    |     Status:  assigned
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.7.1
Resolution:            |   Keywords:  cargo-c
      Port:  cargo-c   |
-----------------------+---------------------------------

Comment (by tomio-arisaka):

 My understanding of the issue is as follows:

 When building "cargo-c" with MacPorts on macOS High Sierra, the error
 occurs.\\

 Extracts from the error log:

 {{{
 :info:build      Running `/opt/local/bin/rustc --crate-name cargo_cinstall
 --edition=2021 src/bin/cinstall.rs ...
   ...
   ... -C linker=/opt/local/bin/clang-mp-13 -L
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin ...
   ...
 :info:build error: linking with `/opt/local/bin/clang-mp-13` failed: exit
 status: 1
 :info:build   |
 :info:build   = note: "/opt/local/bin/clang-mp-13" "-m64" "-arch" "x86_64"
 ...
   ...
   ...  "-L"
 "/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin" ...
   ...
   ...  "-lclang_rt.osx" ...
   ...
 :info:build   = note: ...
   ...
 :info:build           Undefined symbols for architecture x86_64:
 :info:build             "___isPlatformVersionAtLeast", referenced from:
   ...
 :info:build error: linking with `/opt/local/bin/clang-mp-13` failed: exit
 status: 1
 }}}


 It seems that the error occurs when the options of "/opt/local/bin/rustc"
 include "-C linker=/opt/local/bin/clang-mp-13 -L
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin".

 I guess that\\

 "clang-mp-13" searches the
 "/Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin"
 directory for the "libclang_rt.osx" library,\\

 and\\

 "clang-mp-13" searches the "libclang_rt.osx" library for the
 "isPlatformVersionAtLeast" symbol.\\

 But, cannot find it.


 "Apple clang" includes the "libclang_rt.osx" library:\\

 ( It has been installed with the "xcode-select --install" command. Of
 course, it is not for "clang-mp-13" )


 {{{
 $ ls -lt
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/ |
 grep 'libclang_rt.osx'
 -rw-r--r--  1 root  admin   104360  9 26  2018 libclang_rt.osx.a
 $
 $ otool -L
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
 | grep 'os_version_check'
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a(os_version_check.c.o):
 $
 $ strings
 /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
 | grep '___is'
 ___isOSVersionAtLeast
 ___isTargetPlatformNative
 ___isTargetVariantOSVersionAtLeast
 $
 }}}


 So the "libclang_rt.osx" library does not include the
 "isPlatformVersionAtLeast" symbol.
 Then "clang-mp-13" cannot find it.\\



 On the other hand,
 when the options of "/opt/local/bin/rustc" include "-C
 linker=/opt/local/bin/clang-mp-13 -L
 /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin", the phase of
 building succeeds.\\

 This case happens with the following commands:

 {{{
 $ sudo port select --set clang mp-clang-13
 $ sudo port install cargo-c
 }}}

 "clang-13" includes the "libclang_rt.osx" library:


 {{{
 $ port contents clang-13 | grep 'libclang_rt.osx'
   /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a
 $
 $ ls -lt /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/ | grep
 'libclang_rt.osx'
 -rw-r--r--  1 root  wheel   405024 10 25 06:17 libclang_rt.osx.a
 $
 $ otool -L
 /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a |
 grep 'os_version_check'
 /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a(os_version_check.c.o):
 $
 $ strings
 /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a |
 less
 $
 $ strings
 /opt/local/libexec/llvm-13/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a |
 grep '___is'
 ___isOSVersionAtLeast
 ___isPlatformVersionAtLeast
 $
 }}}


 So the "libclang_rt.osx" library includes the "isPlatformVersionAtLeast"
 symbol.
 Then "clang-mp-13" can find it.

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


More information about the macports-tickets mailing list