Skip to content

Incorrect flang symlink #276

Open
Open
@VeeEM

Description

@VeeEM

I was building the latest amd-staging and ran into an error because bin/flang is symlinked to clang-21 instead of flang-21.

I used these settings:

cmake -G Ninja
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_TARGETS_TO_BUILD="X86;AMDGPU" \
-DLLVM_LIT_ARGS=-v \
-DLLVM_ENABLE_PROJECTS="clang;mlir;flang;lld" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload;flang-rt" \
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=libc \
-DLLVM_RUNTIME_TARGETS="default;amdgcn-amd-amdhsa" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
../llvm-project/llvm

cmake --build .

In the build log I see these steps to create symlinks

[7143/7242] /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E cmake_symlink_executable bin/flang-21 bin/flang && :

followed later by

[7214/7242] /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E cmake_symlink_executable bin/clang-21 bin/clang && cd /scratch/project_462000700/vimaylis/llvm/build4/tools/clang/tools/driver && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E create_symlink clang-21 /scratch/project_462000700/vimaylis/llvm/build4/./bin/clang++ && cd /scratch/project_462000700/vimaylis/llvm/build4/tools/clang/tools/driver && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E create_symlink clang-21 /scratch/project_462000700/vimaylis/llvm/build4/./bin/clang-cl && cd /scratch/project_462000700/vimaylis/llvm/build4/tools/clang/tools/driver && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E create_symlink clang-21 /scratch/project_462000700/vimaylis/llvm/build4/./bin/clang-cpp && cd /scratch/project_462000700/vimaylis/llvm/build4/tools/clang/tools/driver && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools/24.03/bin/cmake -E create_symlink clang-21 /scratch/project_462000700/vimaylis/llvm/build4/./bin/flang

It seems the correct link is created it is then overwritten later.

Later the build fails because the link is wrong

[1/982] /scratch/project_462000700/vimaylis/llvm/build4/bin/flang --target=x86_64-unknown-linux-gnu -cpp -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/scratch/project_462000700/vimaylis/llvm/llvm-project/flang-rt/include -I/
scratch/project_462000700/vimaylis/llvm/llvm-project/flang-rt/../flang/include -I/scratch/project_462000700/vimaylis/llvm/build4/runtimes/runtimes-bins/flang-rt -O3 -module-dirflang-rt/lib/runtime -fno-lto -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -E /scratch/project_462000
700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90 > flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90 && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/bu
ildtools/24.03/bin/cmake -E cmake_ninja_depends --tdi=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/FortranDependInfo.json --lang=Fortran --src=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/modul
e/iso_fortran_env_impl.f90-pp.f90 --out=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90 --dep=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_46
2000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90.d --obj=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90.o --ddi=flang-rt/lib/runtime/CMakeFiles/fla
ng_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90.o.ddi --src-orig=/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90
FAILED: flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90 flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/fla
ng/module/iso_fortran_env_impl.f90.o.ddi 
/scratch/project_462000700/vimaylis/llvm/build4/bin/flang --target=x86_64-unknown-linux-gnu -cpp -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/scratch/project_462000700/vimaylis/llvm/llvm-project/flang-rt/include -I/scratch/
project_462000700/vimaylis/llvm/llvm-project/flang-rt/../flang/include -I/scratch/project_462000700/vimaylis/llvm/build4/runtimes/runtimes-bins/flang-rt -O3 -module-dirflang-rt/lib/runtime -fno-lto -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -E /scratch/project_462000700/vima
ylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90 > flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90 && /pfs/lustrep1/appl/lumi/SW/LUMI-24.03/common/EB/buildtools
/24.03/bin/cmake -E cmake_ninja_depends --tdi=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/FortranDependInfo.json --lang=Fortran --src=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fo
rtran_env_impl.f90-pp.f90 --out=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90 --dep=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/
vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90-pp.f90.d --obj=flang-rt/lib/runtime/CMakeFiles/flang_rt.runtime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90.o --ddi=flang-rt/lib/runtime/CMakeFiles/flang_rt.ru
ntime.static.dir/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90.o.ddi --src-orig=/scratch/project_462000700/vimaylis/llvm/llvm-project/flang/module/iso_fortran_env_impl.f90
flang: error: unknown argument: '-fc1'
flang: error: unknown argument '-triple'; did you mean '-Xclang -triple'?
flang: error: unknown argument '-mrelocation-model'; did you mean '-Xclang -mrelocation-model'?
flang: error: unknown argument '-pic-level'; did you mean '-Xclang -pic-level'?
flang: error: unknown argument '-pic-is-pie'; did you mean '-Xclang -pic-is-pie'?
flang: error: unknown argument '-target-cpu'; did you mean '-Xclang -target-cpu'?
flang: error: unknown argument '-vectorize-loops'; did you mean '-Xclang -vectorize-loops'?
flang: error: unknown argument '-vectorize-slp'; did you mean '-Xclang -vectorize-slp'?
flang: error: unknown argument '-mframe-pointer=none'; did you mean '-Xclang -mframe-pointer=none'?
flang: error: no such file or directory: 'x86_64-unknown-linux-gnu'
flang: error: no such file or directory: 'pic'
flang: error: no such file or directory: '2'
flang: error: no such file or directory: 'x86-64'

The CMake option CLANG_LINK_FLANG can be turned off to avoid this error, but it should probably not be required to get a working build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Under InvestigationgenericBuild error, or some other issue not caused by an LLVM bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions