<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/54905>54905</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            14.0.1 does not build with LLVM_ENABLE_RUNTIMES if 14.0.0 is installed
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          q66
      </td>
    </tr>
</table>

<pre>
    When trying to build 14.0.1 with 14.0.0 already in the system, it will attempt to re-link some of the runtime stuff, e.g. libc++. This will fail:

```
[ 92%] Linking CXX shared library /builddir/llvm-14.0.1/build/lib/libc++.so
cd /builddir/llvm-14.0.1/build/runtimes/runtimes-bins/libcxx/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/cxx_shared.dir/link.txt --verbose=1
/builddir/llvm-14.0.1/build/./bin/clang++ --target=powerpc64le-chimera-linux-musl -fPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -mtune=power9 -O2 -fdebug-prefix-map=/builddir/llvm-14.0.1=. -flto=thin -fPIC -g1 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -Wmisleading-indentation -ffunction-sections -fdata-sections --target=powerpc64le-chimera-linux-musl -O3  --target=powerpc64le-chimera-linux-musl -Wl,--as-needed -Wl,-z,now -Wl,-z,relro -flto=thin -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -shared -Wl,-soname,libc++.so.1 -o /builddir/llvm-14.0.1/build/lib/libc++.so.1.0 CMakeFiles/cxx_shared.dir/algorithm.cpp.o CMakeFiles/cxx_shared.dir/any.cpp.o CMakeFiles/cxx_shared.dir/atomic.cpp.o CMakeFiles/cxx_shared.dir/barrier.cpp.o CMakeFiles/cxx_shared.dir/bind.cpp.o CMakeFiles/cxx_shared.dir/charconv.cpp.o CMakeFiles/cxx_shared.dir/chrono.cpp.o CMakeFiles/cxx_shared.dir/condition_variable.cpp.o CMakeFiles/cxx_shared.dir/condition_variable_destructor.cpp.o CMakeFiles/cxx_shared.dir/exception.cpp.o CMakeFiles/cxx_shared.dir/functional.cpp.o CMakeFiles/cxx_shared.dir/future.cpp.o CMakeFiles/cxx_shared.dir/hash.cpp.o CMakeFiles/cxx_shared.dir/legacy_pointer_safety.cpp.o CMakeFiles/cxx_shared.dir/memory.cpp.o CMakeFiles/cxx_shared.dir/mutex.cpp.o CMakeFiles/cxx_shared.dir/mutex_destructor.cpp.o CMakeFiles/cxx_shared.dir/new.cpp.o CMakeFiles/cxx_shared.dir/optional.cpp.o CMakeFiles/cxx_shared.dir/random_shuffle.cpp.o CMakeFiles/cxx_shared.dir/ryu/d2fixed.cpp.o CMakeFiles/cxx_shared.dir/ryu/d2s.cpp.o CMakeFiles/cxx_shared.dir/ryu/f2s.cpp.o CMakeFiles/cxx_shared.dir/shared_mutex.cpp.o CMakeFiles/cxx_shared.dir/stdexcept.cpp.o CMakeFiles/cxx_shared.dir/string.cpp.o CMakeFiles/cxx_shared.dir/system_error.cpp.o CMakeFiles/cxx_shared.dir/thread.cpp.o CMakeFiles/cxx_shared.dir/typeinfo.cpp.o CMakeFiles/cxx_shared.dir/utility.cpp.o CMakeFiles/cxx_shared.dir/valarray.cpp.o CMakeFiles/cxx_shared.dir/variant.cpp.o CMakeFiles/cxx_shared.dir/vector.cpp.o CMakeFiles/cxx_shared.dir/debug.cpp.o CMakeFiles/cxx_shared.dir/random.cpp.o CMakeFiles/cxx_shared.dir/ios.cpp.o CMakeFiles/cxx_shared.dir/ios.instantiations.cpp.o CMakeFiles/cxx_shared.dir/iostream.cpp.o CMakeFiles/cxx_shared.dir/locale.cpp.o CMakeFiles/cxx_shared.dir/regex.cpp.o CMakeFiles/cxx_shared.dir/strstream.cpp.o CMakeFiles/cxx_shared.dir/filesystem/operations.cpp.o CMakeFiles/cxx_shared.dir/filesystem/directory_iterator.cpp.o  -nostdlib++ --unwindlib=none -lpthread -lc -lm -lrt /builddir/llvm-14.0.1/build/lib/clang/14.0.1/lib/powerpc64le-chimera-linux-musl/libclang_rt.builtins.a -fno-lto -rtlib=compiler-rt -Wl,--whole-archive,-Bstatic /builddir/llvm-14.0.1/build/lib/libc++abi.a -Wl,-Bdynamic,--no-whole-archive -lpthread -lc 
ld.lld: error: cannot open crtbeginS.o: No such file or directory
ld.lld: error: cannot open /builddir/llvm-14.0.1/build/lib/clang/14.0.0/lib/linux/libclang_rt.builtins-powerpc64le.a: No such file or directory
ld.lld: error: cannot open /builddir/llvm-14.0.1/build/lib/clang/14.0.0/lib/linux/libclang_rt.builtins-powerpc64le.a: No such file or directory
```

This is because even though it invokes the right clang binary, the `libclang` it uses is actually wrong, from the system. Therefore, it think it's actually clang 14.0.0, and will look for runtime in the wrong place. This does not happen during build, I assume because rpath is used.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzdWEtz4ygQ_jX2hUJly3bGOfiQ2ElVqjKTrXnszJ5cWCCJDQINIDueX78fSM5jameW5LhVsozg6wfdTdOwM_y4-loLTbw9Sl0Rb8iuk4qT6TybZFNykL7u2xPClBWMH4kEuhbEHZ0XzShfE-mBU4owj47WByZWUCX1PXGmEcSUkcB22kt8Ot-VZaATWZURJXfFKL_Ek5HPtXQ9q5JJNZpdjCab0eT0PpsMT_-5uCTn-ShfjBYbcgtZQf31t2_E1cwKHvhaZo9klF_HGXFp0VRq39B-bqeB0Ct3_fukiTO9kIIn0Q8zc8-adCe1G5g-PKDhbAFeZ3gCy84FbsDgXTTsXhB6RWJjG-y2dYWVsOT6PXqupYqswWfbTy4blAEy8w-eULoXdmecGM0208E8CWpnTyoopqt-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