llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

flang has missing imports in 11 and 12 <limits> #52833

Closed zerothi closed 2 years ago

zerothi commented 2 years ago

Building flang with gcc >= 10 produces errors due to missing imports of limits.

In order to build flang correctly I needed to patch like this:

sed -i -e '/#include <cstdio>/a #include <limits>' flang/runtime/unit.cpp

Then compilation works with out problems.

kiranchandramohan commented 2 years ago

Thanks @zerothi for the report. Could you also report the OS that you faced this issue? We have a few buildbots in CI and they do not seem to be facing this issue. https://lab.llvm.org/buildbot/#/console

Also can you try the llvm main branch and see whether this issue is present?

zerothi commented 2 years ago

Sure, sorry for not providing. To be honest I am facing this problem with many different packages, so it could be my compiler etc.

OS: uname -a: Linux nicpa-845gb 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux Compiler: gcc -v

gcc -v                                                                                                                                                                                                        
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/generic/gcc/11.2.0/libexec/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix /opt/generic/gcc/11.2.0 --with-gmp=/opt/generic/gcc/11.2.0 --with-mpfr=/opt/generic/gcc/11.2.0 --with-mpc=/opt/generic/gcc/11.2.0 --with-isl=/opt/generic/gcc/11.2.0 --with-quad --enable-lto --enable-threads --with-multilib-list=m64 --enable-languages=c,c++,lto,fortran,objc,obj-c++,go
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC) 

I don't have time for checking the main branch, and frankly I have no clue how to build the developer version, when I compiled llvm 9 and earlier I could figure things out, but now I simply don't have the time to learn it (I am not a compiler developer ;)). So I now prefer downloading https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/llvm-project-12.0.1.src.tar.xz directly since it contains everything ;)

Does the main branch work the same as the tarball above? If not, would be rather hesitant to try it out... :(

kiranchandramohan commented 2 years ago

The current main branch has the limits import, so I guess no fix is needed there. https://github.com/llvm/llvm-project/blob/7347c28def5637d3b44c6980383437672f43fdf5/flang/runtime/unit.cpp#L15

I don't know whether we plan to update prior releases.

zerothi commented 2 years ago

Ok, great! :)

Feel free to close it then. :)