PRUNERS/archer

CMake error

Opened this issue · 5 comments

Hi, I followed the instructions for a Stand-alone building, and upon running CMake I get the following error

$ cmake -G Ninja  -D CMAKE_C_COMPILER=clang  -D CMAKE_CXX_COMPILER=clang++  -D CMAKE_BUILD_TYPE=Release  -D CMAKE_INSTALL_PREFIX:PATH=$OPENMP_INSTALL  -D LIBOMP_OMPT_SUPPORT=on  -D LIBOMP_OMPT_BLAME=on  -D LIBOMP_OMPT_TRACE=on ..
-- The C compiler identification is Clang 5.0.1
-- The CXX compiler identification is Clang 5.0.1
-- Check for working C compiler: /usr/lib/llvm/5/bin/clang
-- Check for working C compiler: /usr/lib/llvm/5/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/lib/llvm/5/bin/clang++
-- Check for working CXX compiler: /usr/lib/llvm/5/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:13 (message):
  Direct configuration not supported, please use parent directory!


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.9)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "XXX/ArcherBuild/openmp/runtime/build/CMakeFiles/CMakeOutput.log".

I am using cmake 3.9.6, clang 5.0.1.

With latest OpenMP runtime, you cannot configure the OpenMP/runtime directory, but must configure the OpenMP directory.
We will need to update the readme. Just create the build directory in the openmp directory and proceed as described.

Thanks. In the next step, upon configuring archer I got another error message from CMake:

-- LLVM llvm-config found at: /usr/lib/llvm/5/bin/llvm-config
CMake Error at CMakeLists.txt:102 (include):
  include could not find load file:

    LLVMConfig


CMake Error at CMakeLists.txt:103 (include):
  include could not find load file:

    HandleLLVMOptions


CMake Error at CMakeLists.txt:104 (include):
  include could not find load file:

    AddLLVM

Actually, in my installation (Gentoo), LLVMConfig.cmake, HandleLLVMOptions.cmake, and AddLLVM.cmake are located in /usr/lib/llvm/5/lib64/cmake/llvm/ whereas CMake is searching them in /usr/lib/llvm/5/lib/cmake/llvm/. So I modified line 100 of CMakeLists.txt as

   # Incorporate the CMake features provided by LLVM:
-  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT}/lib/cmake/llvm")
+  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT}/lib64/cmake/llvm")
 
   include(LLVMConfig)
   include(HandleLLVMOptions)

This makes the CMake works, but then the compilation fails:

$ ninja -j8 -l8  
[14/15] Building CXX object lib/CMakeFiles/LLVMArcher.dir/Transforms/Instrumentation/InstrumentParallel.cpp.o
FAILED: lib/CMakeFiles/LLVMArcher.dir/Transforms/Instrumentation/InstrumentParallel.cpp.o 
/usr/lib/llvm/5/bin/clang++  -DGTEST_HAS_RTTI=0 -DLLVM_VERSION=50 -DLLVM_VERSION="50 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/usr/lib64/llvm/5/include -I/XXXXXX/archer_openmp/include -I../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -w -fcolor-diagnostics -ffunction-sections -fdata-sections -fPIC    -fno-exceptions -fno-rtti -MD -MT lib/CMakeFiles/LLVMArcher.dir/Transforms/Instrumentation/InstrumentParallel.cpp.o -MF lib/CMakeFiles/LLVMArcher.dir/Transforms/Instrumentation/InstrumentParallel.cpp.o.d -o lib/CMakeFiles/LLVMArcher.dir/Transforms/Instrumentation/InstrumentParallel.cpp.o -c ../lib/Transforms/Instrumentation/InstrumentParallel.cpp
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:269:15: error: no member named 'ArgumentListType' in 'llvm::Function'
    Function::ArgumentListType::iterator it = F.getArgumentList().begin();
    ~~~~~~~~~~^
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:269:49: error: no member named 'getArgumentList' in 'llvm::Function'
    Function::ArgumentListType::iterator it = F.getArgumentList().begin();
                                              ~ ^
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:270:15: error: no member named 'ArgumentListType' in 'llvm::Function'
    Function::ArgumentListType::iterator end = F.getArgumentList().end();
    ~~~~~~~~~~^
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:270:42: error: use of undeclared identifier 'end'; did you mean 'std::end'?
    Function::ArgumentListType::iterator end = F.getArgumentList().end();
                                         ^~~
                                         std::end
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/g++-v6/initializer_list:99:5: note: 'std::end' declared here
    end(initializer_list<_Tp> __ils) noexcept
    ^
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:272:18: error: use of undeclared identifier 'end'; did you mean 'std::end'?
    while (it != end) {
                 ^~~
                 std::end
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/include/g++-v6/initializer_list:99:5: note: 'std::end' declared here
    end(initializer_list<_Tp> __ils) noexcept
    ^
In file included from ../lib/Transforms/Instrumentation/InstrumentParallel.cpp:56:
In file included from /usr/lib64/llvm/5/include/llvm/Analysis/AliasAnalysis.h:42:
In file included from /usr/lib64/llvm/5/include/llvm/Analysis/TargetLibraryInfo.h:18:
/usr/lib64/llvm/5/include/llvm/IR/Module.h:344:50: error: non-constant-expression cannot be narrowed from type 'long' to 'size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
    SmallVector<Type*, sizeof...(ArgsTy)> ArgTys{Args...};
                                                 ^~~~
/usr/lib64/llvm/5/include/llvm/IR/Module.h:353:12: note: in instantiation of function template specialization 'llvm::Module::getOrInsertFunction<long>' requested here
    return getOrInsertFunction(Name, AttributeList{}, RetTy, Args...);
           ^
../lib/Transforms/Instrumentation/InstrumentParallel.cpp:184:22: note: in instantiation of function template specialization 'llvm::Module::getOrInsertFunction<long>' requested here
    Constant* c = M->getOrInsertFunction("__tsan_default_suppressions",
                     ^
/usr/lib64/llvm/5/include/llvm/IR/Module.h:344:50: note: insert an explicit cast to silence this issue
    SmallVector<Type*, sizeof...(ArgsTy)> ArgTys{Args...};
                                                 ^~~~
                                                 static_cast<size_t>( )
6 errors generated.
ninja: build stopped: subcommand failed.

(I anonymize the include directory archer_openmp which points to my previous installation of openmp)

I pushed a fix to the archer repository. Please pull and try to build again

CMake for archer now works without problems, but ninja -j8 -l8 gives the same errors.

@francescopt I haven't finished my fix yet, but you could give a try to the branch "update_to_60" which is based on Clang/LLVM 6.0 (but should work with clang 5.0.1.
I suggest to use the older version under release.
I should merge all my changes in the next days.