Problem to use flang(-new)

After it was rumored that flang is able to produce executable binary code now without invoking another external Fortran compiler, I tried it out and build the complete LLVM together with Flang (flang-new) without much problems (well, one PC crashed because it needed too much memory), I tried to invoke the binary, which is called flang-new (compared to flang-to-external-fc). The letter seems to work, but obviously includes the runtime library of the external Fortran compiler (libgfortran.so.5 in my case). The “native” flang fails for me with the following error below. So flang takes /usr/bin/ld to link, and cannot find the corresponding libraries. For libFortran_main no shared library seems to have been build, while for libFortranDecimal and libFortranRuntime they are there. But even they did not seem to be found. Any ideas? Is there a LLVM/Flang tracker where I can post this?

install/bin/flang-new" -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -o /tmp/foo-3d2774.o -x f95-cpp-input foo.f90
 "/usr/bin/ld" -pie -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib64/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib64/crti.o /usr/lib/gcc/x86_64-linux-gnu/10/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/10 -L/usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib /tmp/foo-3d2774.o -lFortran_main -lFortranRuntime -lFortranDecimal -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/10/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/10/../../../../lib64/crtn.o
/usr/bin/ld: cannot find -lFortran_main
/usr/bin/ld: cannot find -lFortranRuntime
/usr/bin/ld: cannot find -lFortranDecimal

There is (at present) still a secret flag required for flang-new to work, -flang-experimental-exec.

1 Like

Great, thanks, that works! I will start and test our code. It would be great if there is a place where I can give error reports, as I expect that some things will probably not work.

You can report issues at the LLVM main repository issue board. Just make sure to tag with the flang label.

Polymorphism is still a work in progress. You might give the wizards another month before reporting any problems there :wink:

A lot of experimental code to implement arrays is being reimplemented and extended. Follow along in the llvm discourse to know when the switch is flipped to HLFIR.

There’s no need to report the not-yet-implemented messages.

Please report any crashes, bogus messages, or missing checks on GitHub, llvm-project, issues. Tag with flang to get attention.

The main developers advise waiting until the compiler is more complete, but hey, it’s open source so have fun with it!

  • Steve
1 Like