[PATCH] D126291: [flang][Driver] Update link job on windows

Markus Mützel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 06:13:16 PDT 2022


mmuetzel added a comment.

I checked out the LLVM repository from https://github.com/llvm/llvm-project.git and applied your patch with `patch -Np0 -i D126291.433988.patch`.

After some failing attempts, I finally found a configuration for which building succeeded. I struggled with duplicate symbols and two many symbols when linking some libraries.
I ended up using these switches:

  cmake \
    -Sllvm \
    -Bbuild \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=pkg \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DCMAKE_C_COMPILER_LAUNCHER=ccache \
    -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
    -DLLVM_ENABLE_PROJECTS="clang;mlir;flang;llvm" \
    -DLLVM_TARGETS_TO_BUILD="X86" \
    -DCMAKE_BUILD_TYPE=Release \
    -DLLVM_ENABLE_LIBCXX=ON \
    -DCLANG_DEFAULT_RTLIB=compiler-rt \
    -DCLANG_DEFAULT_UNWINDLIB=libunwind \
    -DCLANG_DEFAULT_LINKER=lld \
    -DLLVM_BUILD_LLVM_DYLIB=OFF \
    -DLLVM_BUILD_STATIC=OFF \
    -DLLVM_ENABLE_ASSERTIONS=OFF \
    -DLLVM_ENABLE_FFI=ON \
    -DLLVM_ENABLE_THREADS=ON \
    -DLLVM_INCLUDE_EXAMPLES=OFF \
    -DLLVM_INSTALL_UTILS=ON

I hope those make sense.

With those, `flang-new` was built in a CLANG64 build environment of MSYS2. 
After installation, I got:

  $ PATH=./pkg/bin:$PATH flang-new --version
  flang-new version 15.0.0
  Target: x86_64-w64-windows-gnu
  Thread model: posix
  InstalledDir: D:/llvm-project/pkg/bin

However, when trying to build a simple "Hello World" program with it, I got:

  $ PATH=./pkg/bin:$PATH flang-new hello.f90 -L/clang64/lib
  ld.lld: error: could not open 'D:/llvm-project/pkg/lib/clang/15.0.0/lib/windows/libclang_rt.builtins-x86_64.a': No such file or directory
  ld.lld: error: could not open 'D:/llvm-project/pkg/lib/clang/15.0.0/lib/windows/libclang_rt.builtins-x86_64.a': No such file or directory
  flang-new: error: linker command failed with exit code 1 (use -v to see invocation)

Those files don't exist indeed.
Is that expected? Did I do something wrong? Incorrect configuration? Do I also need to enable `compiler-rt`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126291/new/

https://reviews.llvm.org/D126291



More information about the cfe-commits mailing list