-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Labels
Description
The Flang driver puts -L$LLVM_DIR/lib -lflang_rt.runtime after OS library directory -L options when linking.
$ flang -### test.f90 |& tail -1 | tr ' ' '\n' | grep '^"-[Ll]'
"-L/home/foo/llvm/bin/../lib/aarch64-unknown-linux-gnu"
"-L/usr/lib/gcc/aarch64-linux-gnu/13"
"-L/lib/aarch64-linux-gnu"
"-L/usr/lib/aarch64-linux-gnu"
"-L/lib"
"-L/usr/lib"
"-L/home/foo/llvm/lib"
"-lflang_rt.runtime"
"-lm"
"-lgcc"
"-lgcc_s"
"-lc"
"-lgcc"
"-lgcc_s"If you install Flang (and Flang-RT) manually on an environment where the OS-provided Flang package is already installed, this has a problem.
When user-installed Flang is invoked, libflang_rt.runtime in the user-installed directory should be linked. However, OS-provided libflang_rt.runtime in /lib (or /lib/TRIPLE or /lib64, depending on OS) is linked instead.
#100403 and open-mpi/ompi#13116 suffer from this problem.
Should we prioritize -L$LLVM_DIR/lib over -L/lib?