[MacPorts] #54242: clang-3.8 build fails on 10.5 PPC due to fatal error: lipo: specifed architecture in libclang_rt.10.4.a does not match its cputype -- and workaround that allows build to succeed

MacPorts noreply at macports.org
Sat May 27 17:59:11 UTC 2017


#54242: clang-3.8 build fails on 10.5 PPC due to fatal error: lipo: specifed
architecture in libclang_rt.10.4.a does not match its cputype -- and
workaround that allows build to succeed
------------------------+---------------------
  Reporter:  kencu      |      Owner:
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:             |   Keywords:  powerpc
      Port:  clang-3.8  |
------------------------+---------------------

Comment (by kencu):

 During configuration, this is noted:
 {{{
 CMake Warning at projects/compiler-
 rt/cmake/Modules/CompilerRTDarwinUtils.cmake:33 (message):
   Detecting supported architectures from 'ld -v' failed.  Returning
 default
   set.
 Call Stack (most recent call first):
   projects/compiler-rt/cmake/config-ix.cmake:347
 (darwin_get_toolchain_supported_archs)
   projects/compiler-rt/CMakeLists.txt:206 (include)


 -- Toolchain supported arches: i386;x86_64;ppc;ppc64;armv7;armv7s;arm64
 -- Finding valid architectures for osx...
 -- OSX supported arches:
 -- Finding valid architectures for 10.4...
 -- OSX 10.4 supported arches: i386;x86_64;ppc;ppc64
 -- Compiler-RT supported architectures:
 CMake Warning at projects/compiler-
 rt/cmake/Modules/CompilerRTDarwinUtils.cmake:216 (message):
   Not generating lipo target for clang_rt.cc_kext because no input
 libraries
   exist.
 Call Stack (most recent call first):
   projects/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake:334
 (darwin_lipo_libs)
   projects/compiler-rt/lib/builtins/CMakeLists.txt:364
 (darwin_add_builtin_libraries)


 CMake Warning at projects/compiler-
 rt/cmake/Modules/CompilerRTDarwinUtils.cmake:216 (message):
   Not generating lipo target for clang_rt.osx because no input libraries
   exist.
 }}}

 And this generated file from cmake: `./build/projects/compiler-
 rt/lib/builtins/CMakeFiles/clang_rt.10.4.dir/build.make` contains
 references to i386 and x86_64:
 {{{
 lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a:
 lib/libclang_rt.builtins_i386_10.4.a
 lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a:
 lib/libclang_rt.builtins_x86_64_10.4.a
         @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue
 --bold --progress-
 dir=/opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/CMakeFiles
 --progress-num=$(CMAKE_PROGRESS_1) "Generating
 ../../../../lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a"
         cd
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/projects
 /compiler-rt/lib/builtins && /opt/local/bin/cmake -E make_directory
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin
         cd
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/projects
 /compiler-rt/lib/builtins && lipo -output
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a
 -create -arch i386
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
 -arch x86_64
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_x86_64_10.4.a
 }}}
 which leads to the failure line noted above.

 The first issue is that both of the generated libclang_rt.builtins* files
 are ppc (neither is ppc64), but that's not too important as for now we're
 only after ppc anyway.
 {{{
 $ cd `port work clang-3.8`
 $ lipo -info ./build/lib/libclang_rt.builtins_i386_10.4.a
 input file ./build/lib/libclang_rt.builtins_i386_10.4.a is not a fat file
 Non-fat file: ./build/lib/libclang_rt.builtins_i386_10.4.a is
 architecture: ppc
 $ lipo -info ./build/lib/libclang_rt.builtins_x86_64_10.4.a
 input file ./build/lib/libclang_rt.builtins_x86_64_10.4.a is not a fat
 file
 Non-fat file: ./build/lib/libclang_rt.builtins_x86_64_10.4.a is
 architecture: ppc
 }}}

 The second issue is that the -arch for the
 libclang_rt.builtins_i386_10.4.a has to be `ppc`.

 To generate the libclang_rt.builtins library for ppc, edit the
 `./build/projects/compiler-
 rt/lib/builtins/CMakeFiles/clang_rt.10.4.dir/build.make`

 and change this line:
 {{{
 cd
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/projects
 /compiler-rt/lib/builtins && lipo -output
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a
 -create -arch i386
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
 -arch x86_64
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_x86_64_10.4.a
 }}}

 to this, updating the arch type (leave the name alone, although it's
 incorrect), and deleting the second arch (as it is also ppc):
 {{{
 cd
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/projects
 /compiler-rt/lib/builtins && lipo -output
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/./lib/clang/3.8.1/lib/darwin/libclang_rt.10.4.a
 -create -arch ppc
 /opt/local/var/macports/build/_opt_LeopardPorts_lang_llvm-3.8/clang-3.8/work/build/lib/libclang_rt.builtins_i386_10.4.a
 }}}

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


More information about the macports-tickets mailing list