LLVM Discussion Forums

Compilation errors with flang-drivers

Hello,
I successfully built LLVM (v9.0.1), However, and in order to build flang, the configuration of flang-driver with:
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/FLANG/flang-driver -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
returns:

– The C compiler identification is GNU 7.4.0
– The CXX compiler identification is GNU 7.4.0

– Looking for os_signpost_interval_begin
– Looking for os_signpost_interval_begin - not found
– Found PythonInterp: /usr/bin/python2.7 (found version “2.7.17”)
– Looking for sys/resource.h
– Looking for sys/resource.h - found
– Clang version: 9.0.1
– Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
– Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
CMake Error at examples/analyzer-plugin/CMakeLists.txt:2 (add_llvm_loadable_module):
Unknown CMake command “add_llvm_loadable_module”.
– Configuring incomplete, errors occurred!
See also “/home/ubuntu/FLANG/flang-driver/build/CMakeFiles/CMakeOutput.log”.
See also “/home/ubuntu/FLANG/flang-driver/build/CMakeFiles/CMakeError.log”.

The error add_llvm_loadable_module seems to always occur even changing directories or other details. The logs do not clarify anything for me but I could post them if it’d help (they’re a bit long). Any suggestions on what is the orgin of the problem or how to fix it would be welcomed.
Thanks.

Hi - can I clarify what you are building? Are you building the driver project (i.e. the fork of clang) from this flang project: https://github.com/flang-compiler/flang-driver? If so, then you I encourage you to raise this as an issue on the github project there.

That flang project targets LLVM but is not part of the LLVM project itself. There is a new flang project here: https://github.com/flang-compiler/f18 that will become part of LLVM very soon (current ETA is March 16th 2020)

To address your problem, I suspect you are building flang-driver from the wrong branch for the LLVM you just built. That cmake function add_llvm_loadable_module was removed from LLVM between versions 7 and 8 by this commit 2f44fbe. I suspect you have built LLVM from a newer branch than LLVM7 and are trying to build flang-driver from a branch earlier than LLVM8.

Hello @RichBarton-Arm,
I apologize for the very long delay in my answer. The guide for building flang instructed to build the drivers fork firstly. However, you have clarified a question that I didn’t actually ask: the release of F18. Given your estimation (understanding that it’s not an official date and there is always a possible last minute bug or delay), I’m waiting on F18 and will focus on that compiler.
Thank you so much.