[Openmp-dev] CMake config failure

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Thu Feb 4 06:24:33 PST 2021


Hi Jim,

In order to support various new "features" we changed the way to build 
the openmp offload support, it is as runtime not a project now. I 
thought the old way would still work, especially for non-offload openmp, 
but maybe that was wrong.

Long story short, we should add more cmake magic to either make the old 
way work properly or emit an appropriate warning.

I think the problem here is that openmp now wants `clang` to be the 
compiler (mainly for the GPU runtimes). To guarantee we have a matching 
and capable `clang` we generally like `clang` to be in the enabled 
projects and openmp in the enabled runtimes 
(-DLLVM_ENABLE_RUNTIMES="openmp"). Since you build with clang we could 
verify if the version is recent enough and use it. We also might not 
need any of this because you don't build the target stuff (explicitly) 
so we could disable that part and go with whatever compiler was chosen.

@Shilei, @Jon, could you take a look?

~ Johannes


On 2/4/21 6:43 AM, Jim Cownie via Openmp-dev wrote:
> p.s. Note that if I switch to the “master” branch (and add a few more build targets as below), then this failure does not occur.
>       -DLLVM_ENABLE_PROJECTS='clang;openmp;polly;clang-tools-extra;libcxx;libcxxabi'
>
>> On 4 Feb 2021, at 12:34, Jim Cownie <JCOWNIE at GMAIL.COM> wrote:
>>
>> I am trying to build the runtime on MacOS, but Cmake is failing.
>>
>> $ git branch
>>    master
>>    release/11.x
>> * release/12.x
>>
>> $ git describe
>> llvmorg-12.0.0-rc1-51-ge8cdcaeae406
>>
>> $ cat JimConfig.sh
>> // Config script
>> BUILD_SYSTEM=Ninja
>> BUILD_TAG=ninja
>> INSTALLDIR=$HOME/software/clang-12.0.0/arm64
>>
>> cmake ../llvm \
>>        -G$BUILD_SYSTEM -B ${BUILD_TAG}_build \
>>        -DCMAKE_OSX_ARCHITECTURES='arm64' \
>>        -DCMAKE_C_COMPILER=`which clang` \
>>        -DCMAKE_CXX_COMPILER=`which clang++` \
>>        -DCMAKE_BUILD_TYPE=Release \
>>        -DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
>>        -DLLVM_LOCAL_RPATH=$INSTALLDIR/lib \
>>        -DLLVM_ENABLE_WERROR=FALSE \
>>        -DLLVM_TARGETS_TO_BUILD='AArch64' \
>>        -DLLVM_DEFAULT_TARGET_TRIPLE='aarch64-apple-darwin20.2.0' \
>>        -DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)" \
>>        -DLLVM_ENABLE_PROJECTS=‘openmp'
>>
>> $ sh JimConfig.sh
>> -- clang project is disabled
>> -- clang-tools-extra project is disabled
>> -- compiler-rt project is disabled
>> -- debuginfo-tests project is disabled
>> -- libc project is disabled
>> -- libclc project is disabled
>> -- libcxx project is disabled
>> -- libcxxabi project is disabled
>> -- libunwind project is disabled
>> -- lld project is disabled
>> -- lldb project is disabled
>> -- mlir project is disabled
>> -- openmp project is enabled
>> -- parallel-libs project is disabled
>> -- polly project is disabled
>> -- pstl project is disabled
>> -- flang project is disabled
>> -- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
>> -- Native target X86 is not selected; lli will not JIT code
>> -- Threads enabled.
>> -- Doxygen disabled.
>> -- Go bindings disabled.
>> -- Ninja version: 1.10.2
>> -- Found ld64 - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
>> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
>> -- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
>> -- OCaml bindings disabled.
>> -- LLVM host triple: x86_64-apple-darwin20.2.0
>> -- LLVM default target triple: aarch64-apple-darwin20.2.0
>> CMake Warning at cmake/modules/HandleLLVMOptions.cmake:261 (message):
>>    -fPIC is not supported.
>> Call Stack (most recent call first):
>>    cmake/modules/HandleLLVMOptions.cmake:297 (add_flag_or_print_warning)
>>    CMakeLists.txt:698 (include)
>>
>>
>> -- Targeting AArch64
>> CMake Error at /Users/jcownie/llvm-project/openmp/CMakeLists.txt:93 (add_subdirectory):
>>    The binary directory
>>
>>      /Users/jcownie/llvm-project/build_aarch64/ninja_build/projects/openmp/runtime
>>
>>    is already used to build a source directory.  It cannot be used to build
>>    source directory
>>
>>      /Users/jcownie/llvm-project/openmp/runtime
>>
>>    Specify a unique binary directory name.
>>
>>
>> -- Registering Bye as a pass plugin (static build: OFF)
>> -- Failed to find LLVM FileCheck
>> -- Version: 0.0.0
>> -- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
>> -- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
>> -- Performing Test HAVE_POSIX_REGEX -- success
>> -- Performing Test HAVE_STEADY_CLOCK -- success
>> -- Configuring incomplete, errors occurred!
>> See also "/Users/jcownie/llvm-project/build_aarch64/ninja_build/CMakeFiles/CMakeOutput.log".
>> See also "/Users/jcownie/llvm-project/build_aarch64/ninja_build/CMakeFiles/CMakeError.log".
>> $
>>
>> This previously worked (with an older version of 12.0).
>>
>> Suggestions, please...
>>
>> -- Jim
>> James Cownie <jcownie at gmail.com <mailto:jcownie at gmail.com>>
>> Mob: +44 780 637 7146
>>
>
> -- Jim
> James Cownie <jcownie at gmail.com>
> Mob: +44 780 637 7146
>
>
>
>
>
>
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list