llvm / llvm-project

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

15.0.3 libomp: cmake fails on missing `ExtendPath` #58472

Closed kloczek closed 1 year ago

kloczek commented 1 year ago

As input source is used https://github.com/llvm/llvm-project//releases/download/llvmorg-15.0.3/openmp-15.0.3.src.tar.xz and cmake fails with:

+ /usr/bin/cmake -B x86_64-redhat-linux-gnu -D BUILD_SHARED_LIBS=ON -D CMAKE_AR=/usr/bin/gcc-ar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS_RELEASE=-DNDEBUG -D CMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -D CMAKE_Fortran_FLAGS_RELEASE=-DNDEBUG -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_NM=/usr/bin/gcc-nm -D CMAKE_RANLIB=/usr/bin/gcc-ranlib -D CMAKE_VERBOSE_MAKEFILE=ON -D INCLUDE_INSTALL_DIR=/usr/include -D LIB_INSTALL_DIR=/usr/lib64 -D LIB_SUFFIX=64 -D SHARE_INSTALL_PREFIX=/usr/share -D SYSCONF_INSTALL_DIR=/etc -S . -D ENABLE_CHECK_TARGETS=ON -D LIBOMP_INSTALL_ALIASES=OFF -D LIBOMP_HEADERS_INSTALL_PATH=/usr/lib64/clang/15.0.3/include -D OPENMP_LIBDIR_SUFFIX=64
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test OPENMP_HAVE_WALL_FLAG
-- Performing Test OPENMP_HAVE_WALL_FLAG - Success
-- Performing Test OPENMP_HAVE_WERROR_FLAG
-- Performing Test OPENMP_HAVE_WERROR_FLAG - Success
-- Performing Test OPENMP_HAVE_WCAST_QUAL_FLAG
-- Performing Test OPENMP_HAVE_WCAST_QUAL_FLAG - Success
-- Performing Test OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG
-- Performing Test OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG - Failed
-- Performing Test OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG
-- Performing Test OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test OPENMP_HAVE_WSIGN_COMPARE_FLAG
-- Performing Test OPENMP_HAVE_WSIGN_COMPARE_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_EXTRA_FLAG
-- Performing Test OPENMP_HAVE_WNO_EXTRA_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_PEDANTIC_FLAG
-- Performing Test OPENMP_HAVE_WNO_PEDANTIC_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG
-- Performing Test OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG - Success
-- Performing Test OPENMP_HAVE_STD_CPP14_FLAG
-- Performing Test OPENMP_HAVE_STD_CPP14_FLAG - Success
-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.14")
-- Performing Test LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG
-- Performing Test LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test LIBOMP_HAVE_FNO_RTTI_FLAG
-- Performing Test LIBOMP_HAVE_FNO_RTTI_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG
-- Performing Test LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG
-- Performing Test LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG
-- Performing Test LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG - Success
-- Performing Test LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG
-- Performing Test LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG
-- Performing Test LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_SWITCH_FLAG
-- Performing Test LIBOMP_HAVE_WNO_SWITCH_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG
-- Performing Test LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG
-- Performing Test LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG
-- Performing Test LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_CAST_QUAL_FLAG
-- Performing Test LIBOMP_HAVE_WNO_CAST_QUAL_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG
-- Performing Test LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG - Success
-- Performing Test LIBOMP_HAVE_MSSE2_FLAG
-- Performing Test LIBOMP_HAVE_MSSE2_FLAG - Success
-- Performing Test LIBOMP_HAVE_FTLS_MODEL_FLAG
-- Performing Test LIBOMP_HAVE_FTLS_MODEL_FLAG - Success
-- Performing Test LIBOMP_HAVE_MMIC_FLAG
-- Performing Test LIBOMP_HAVE_MMIC_FLAG - Failed
-- Performing Test LIBOMP_HAVE_M32_FLAG
-- Performing Test LIBOMP_HAVE_M32_FLAG - Failed
-- Looking for shm_open
-- Looking for shm_open - found
-- Looking for xmmintrin.h
-- Looking for xmmintrin.h - found
-- Performing Test LIBOMP_HAVE__MM_MALLOC
-- Performing Test LIBOMP_HAVE__MM_MALLOC - Success
-- Looking for aligned_alloc
-- Looking for aligned_alloc - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - not found
-- Performing Test LIBOMP_HAVE_X_FLAG
-- Performing Test LIBOMP_HAVE_X_FLAG - Success
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG - Success
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG - Success
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG - Success
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG - Success
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for immintrin.h
-- Looking for immintrin.h - found
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_RTM
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_RTM - Success
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_WAITPKG
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_WAITPKG - Success
-- Performing Test LIBOMP_HAVE_WAITPKG_INTRINSICS
-- Performing Test LIBOMP_HAVE_WAITPKG_INTRINSICS - Success
-- Performing Test LIBOMP_HAVE_RTM_INTRINSICS
-- Performing Test LIBOMP_HAVE_RTM_INTRINSICS - Success
-- Found Perl: /usr/bin/perl (found version "5.36.0")
-- Performing Test LIBOMP_HAVE_VERSION_SYMBOLS
-- Performing Test LIBOMP_HAVE_VERSION_SYMBOLS - Success
-- Performing Test LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS
-- Performing Test LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS - Success
-- Performing Test LIBOMP_HAVE_WEAK_ATTRIBUTE
-- Performing Test LIBOMP_HAVE_WEAK_ATTRIBUTE - Success
-- Performing Test LIBOMP_HAVE_PSAPI
-- Performing Test LIBOMP_HAVE_PSAPI - Failed
-- LIBOMP: Operating System     -- Linux
-- LIBOMP: Target Architecture  -- x86_64
-- LIBOMP: Build Type           -- RelWithDebInfo
-- LIBOMP: Library Kind         -- SHARED
-- LIBOMP: Library Type         -- normal
-- LIBOMP: Fortran Modules      -- FALSE
-- LIBOMP: Build                -- 20140926
-- LIBOMP: Use Stats-gathering  -- FALSE
-- LIBOMP: Use Debugger-support -- FALSE
-- LIBOMP: Use ITT notify       -- TRUE
-- LIBOMP: Use OMPT-support     -- TRUE
-- LIBOMP: Use OMPT-optional  -- TRUE
-- LIBOMP: Use OMPD-support     -- TRUE
-- LIBOMP: Use Adaptive locks   -- TRUE
-- LIBOMP: Use quad precision   -- TRUE
-- LIBOMP: Use Hwloc library    -- FALSE
CMake Error at runtime/src/CMakeLists.txt:11 (include):
  include could not find requested file:

    ExtendPath

-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for __atomic_load_1
-- Looking for __atomic_load_1 - not found
-- Looking for __atomic_load_1 in atomic
-- Looking for __atomic_load_1 in atomic - found
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib64/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib64/libtinfo.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
-- Found LLVM 15.0.3
-- Using LLVM in: /usr/lib64/cmake/llvm
-- Linker detection: GNU ld
-- Found LIBOMPTARGET_DEP_LIBELF: /usr/lib64/libelf.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.9.3")
-- Found LIBOMPTARGET_DEP_LIBFFI: /usr/lib64/libffi.so
-- Could NOT find LIBOMPTARGET_DEP_CUDA_DRIVER (missing: LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
-- Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_VEO_INCLUDE_DIRS)
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building AMDGPU plugin for dlopened libhsa
-- LIBOMPTARGET: Not generating amdgcn test targets as amdgpu-arch is not found
-- LIBOMPTARGET: Building CUDA offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin for dlopened libcuda
-- LIBOMPTARGET: Disabling tests using CUDA plugin as cuda may not be available
-- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found.
-- LIBOMPTARGET: Building x86_64 offloading plugin.
-- LIBOMPTARGET: Building DeviceRTL. Using clang: /usr/bin/clang, llvm-link: /usr/bin/llvm-link and opt: /usr/bin/opt
-- LIBOMPTARGET: Building the llvm-omp-device-info tool
-- LIBOMPTARGET: Can only test with Clang compiler in version 6.0.0 or later.
CMake Warning at libomptarget/cmake/Modules/LibomptargetUtils.cmake:20 (message):
  LIBOMPTARGET: The check-libomptarget target will not be available!
Call Stack (most recent call first):
  libomptarget/test/CMakeLists.txt:5 (libomptarget_warning_say)

-- Looking for __atomic_load_1
-- Looking for __atomic_load_1 - not found
-- Looking for __atomic_load_1 in atomic
-- Looking for __atomic_load_1 in atomic - found
-- Configuring incomplete, errors occurred!
See also "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.3.src/x86_64-redhat-linux-gnu/CMakeFiles/CMakeOutput.log".
See also "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.3.src/x86_64-redhat-linux-gnu/CMakeFiles/CMakeError.log".
llvmbot commented 1 year ago

@llvm/issue-subscribers-openmp

shiltian commented 1 year ago

See https://github.com/llvm/llvm-project/issues/53281 for more details.

kloczek commented 1 year ago

Issue is that I have installed all llvm-cmake *cmake files in $(libdir)/cmake/llvm. Issue is that all those files are not wtitten to be importable by default. Solution is to add -D CMAKE_MODULE_PATH=/usr/lib64/cmake/llvm. The same was necessry to add to clanf cmake options.

Simple llvm-cmake is not finished as full cmake module and it is necessary to add that -D CMAKE_MODULE_PATH=<path> option.

Here is result

+ /usr/bin/cmake -B x86_64-redhat-linux-gnu -D BUILD_SHARED_LIBS=ON -D CMAKE_AR=/usr/bin/gcc-ar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS_RELEASE=-DNDEBUG -D CMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -D CMAKE_Fortran_FLAGS_RELEASE=-DNDEBUG -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_NM=/usr/bin/gcc-nm -D CMAKE_RANLIB=/usr/bin/gcc-ranlib -D CMAKE_VERBOSE_MAKEFILE=ON -D INCLUDE_INSTALL_DIR=/usr/include -D LIB_INSTALL_DIR=/usr/lib64 -D LIB_SUFFIX=64 -D SHARE_INSTALL_PREFIX=/usr/share -D SYSCONF_INSTALL_DIR=/etc -S . -D CMAKE_MODULE_PATH=/usr/lib64/cmake/llvm -D ENABLE_CHECK_TARGETS=ON -D LIBOMP_HEADERS_INSTALL_PATH=/usr/lib64/clang/15.0.3/include -D LIBOMP_INSTALL_ALIASES=OFF -D OPENMP_LIBDIR_SUFFIX=64
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test OPENMP_HAVE_WALL_FLAG
-- Performing Test OPENMP_HAVE_WALL_FLAG - Success
-- Performing Test OPENMP_HAVE_WERROR_FLAG
-- Performing Test OPENMP_HAVE_WERROR_FLAG - Success
-- Performing Test OPENMP_HAVE_WCAST_QUAL_FLAG
-- Performing Test OPENMP_HAVE_WCAST_QUAL_FLAG - Success
-- Performing Test OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG
-- Performing Test OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG - Failed
-- Performing Test OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG
-- Performing Test OPENMP_HAVE_WIMPLICIT_FALLTHROUGH_FLAG - Success
-- Performing Test OPENMP_HAVE_WSIGN_COMPARE_FLAG
-- Performing Test OPENMP_HAVE_WSIGN_COMPARE_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_EXTRA_FLAG
-- Performing Test OPENMP_HAVE_WNO_EXTRA_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_PEDANTIC_FLAG
-- Performing Test OPENMP_HAVE_WNO_PEDANTIC_FLAG - Success
-- Performing Test OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG
-- Performing Test OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG - Success
-- Performing Test OPENMP_HAVE_STD_CPP14_FLAG
-- Performing Test OPENMP_HAVE_STD_CPP14_FLAG - Success
-- Found PythonInterp: /usr/bin/python3.8 (found version "3.8.14")
-- Performing Test LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG
-- Performing Test LIBOMP_HAVE_FNO_EXCEPTIONS_FLAG - Success
-- Performing Test LIBOMP_HAVE_FNO_RTTI_FLAG
-- Performing Test LIBOMP_HAVE_FNO_RTTI_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG
-- Performing Test LIBOMP_HAVE_WNO_CLASS_MEMACCESS_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG
-- Performing Test LIBOMP_HAVE_WNO_COVERED_SWITCH_DEFAULT_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG
-- Performing Test LIBOMP_HAVE_WNO_FRAME_ADDRESS_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG
-- Performing Test LIBOMP_HAVE_WNO_STRICT_ALIASING_FLAG - Success
-- Performing Test LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG
-- Performing Test LIBOMP_HAVE_WSTRINGOP_OVERFLOW_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG
-- Performing Test LIBOMP_HAVE_WNO_STRINGOP_TRUNCATION_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_SWITCH_FLAG
-- Performing Test LIBOMP_HAVE_WNO_SWITCH_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG
-- Performing Test LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG
-- Performing Test LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG
-- Performing Test LIBOMP_HAVE_WNO_RETURN_TYPE_C_LINKAGE_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_CAST_QUAL_FLAG
-- Performing Test LIBOMP_HAVE_WNO_CAST_QUAL_FLAG - Success
-- Performing Test LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG
-- Performing Test LIBOMP_HAVE_WNO_INT_TO_VOID_POINTER_CAST_FLAG - Success
-- Performing Test LIBOMP_HAVE_MSSE2_FLAG
-- Performing Test LIBOMP_HAVE_MSSE2_FLAG - Success
-- Performing Test LIBOMP_HAVE_FTLS_MODEL_FLAG
-- Performing Test LIBOMP_HAVE_FTLS_MODEL_FLAG - Success
-- Performing Test LIBOMP_HAVE_MMIC_FLAG
-- Performing Test LIBOMP_HAVE_MMIC_FLAG - Failed
-- Performing Test LIBOMP_HAVE_M32_FLAG
-- Performing Test LIBOMP_HAVE_M32_FLAG - Failed
-- Looking for shm_open
-- Looking for shm_open - found
-- Looking for xmmintrin.h
-- Looking for xmmintrin.h - found
-- Performing Test LIBOMP_HAVE__MM_MALLOC
-- Performing Test LIBOMP_HAVE__MM_MALLOC - Success
-- Looking for aligned_alloc
-- Looking for aligned_alloc - found
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for _aligned_malloc
-- Looking for _aligned_malloc - not found
-- Performing Test LIBOMP_HAVE_X_FLAG
-- Performing Test LIBOMP_HAVE_X_FLAG - Success
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG
-- Performing Test LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG - Success
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG
-- Performing Test LIBOMP_HAVE_AS_NEEDED_FLAG - Success
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG
-- Performing Test LIBOMP_HAVE_VERSION_SCRIPT_FLAG - Success
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG
-- Performing Test LIBOMP_HAVE_STATIC_LIBGCC_FLAG - Success
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG
-- Performing Test LIBOMP_HAVE_Z_NOEXECSTACK_FLAG - Success
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for immintrin.h
-- Looking for immintrin.h - found
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_RTM
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_RTM - Success
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_WAITPKG
-- Performing Test LIBOMP_HAVE_ATTRIBUTE_WAITPKG - Success
-- Performing Test LIBOMP_HAVE_WAITPKG_INTRINSICS
-- Performing Test LIBOMP_HAVE_WAITPKG_INTRINSICS - Success
-- Performing Test LIBOMP_HAVE_RTM_INTRINSICS
-- Performing Test LIBOMP_HAVE_RTM_INTRINSICS - Success
-- Found Perl: /usr/bin/perl (found version "5.36.0")
-- Performing Test LIBOMP_HAVE_VERSION_SYMBOLS
-- Performing Test LIBOMP_HAVE_VERSION_SYMBOLS - Success
-- Performing Test LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS
-- Performing Test LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS - Success
-- Performing Test LIBOMP_HAVE_WEAK_ATTRIBUTE
-- Performing Test LIBOMP_HAVE_WEAK_ATTRIBUTE - Success
-- Performing Test LIBOMP_HAVE_PSAPI
-- Performing Test LIBOMP_HAVE_PSAPI - Failed
-- LIBOMP: Operating System     -- Linux
-- LIBOMP: Target Architecture  -- x86_64
-- LIBOMP: Build Type           -- RelWithDebInfo
-- LIBOMP: Library Kind         -- SHARED
-- LIBOMP: Library Type         -- normal
-- LIBOMP: Fortran Modules      -- FALSE
-- LIBOMP: Build                -- 20140926
-- LIBOMP: Use Stats-gathering  -- FALSE
-- LIBOMP: Use Debugger-support -- FALSE
-- LIBOMP: Use ITT notify       -- TRUE
-- LIBOMP: Use OMPT-support     -- TRUE
-- LIBOMP: Use OMPT-optional  -- TRUE
-- LIBOMP: Use OMPD-support     -- TRUE
-- LIBOMP: Use Adaptive locks   -- TRUE
-- LIBOMP: Use quad precision   -- TRUE
-- LIBOMP: Use Hwloc library    -- FALSE
-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for __atomic_load_1
-- Looking for __atomic_load_1 - not found
-- Looking for __atomic_load_1 in atomic
-- Looking for __atomic_load_1 in atomic - found
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib64/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib64/libtinfo.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
-- Found LLVM 15.0.3
-- Using LLVM in: /usr/lib64/cmake/llvm
-- Linker detection: GNU ld
-- Found LIBOMPTARGET_DEP_LIBELF: /usr/lib64/libelf.so
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.9.3")
-- Found LIBOMPTARGET_DEP_LIBFFI: /usr/lib64/libffi.so
-- Could NOT find LIBOMPTARGET_DEP_CUDA_DRIVER (missing: LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
-- Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_VEO_INCLUDE_DIRS)
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building AMDGPU plugin for dlopened libhsa
-- LIBOMPTARGET: Not generating amdgcn test targets as amdgpu-arch is not found
-- LIBOMPTARGET: Building CUDA offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin for dlopened libcuda
-- LIBOMPTARGET: Disabling tests using CUDA plugin as cuda may not be available
-- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found.
-- LIBOMPTARGET: Building x86_64 offloading plugin.
-- LIBOMPTARGET: Building DeviceRTL. Using clang: /usr/bin/clang, llvm-link: /usr/bin/llvm-link and opt: /usr/bin/opt
-- LIBOMPTARGET: Building the llvm-omp-device-info tool
-- LIBOMPTARGET: Can only test with Clang compiler in version 6.0.0 or later.
CMake Warning at libomptarget/cmake/Modules/LibomptargetUtils.cmake:20 (message):
  LIBOMPTARGET: The check-libomptarget target will not be available!
Call Stack (most recent call first):
  libomptarget/test/CMakeLists.txt:5 (libomptarget_warning_say)

-- Looking for __atomic_load_1
-- Looking for __atomic_load_1 - not found
-- Looking for __atomic_load_1 in atomic
-- Looking for __atomic_load_1 in atomic - found
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_Fortran_FLAGS_RELEASE
    INCLUDE_INSTALL_DIR
    LIB_INSTALL_DIR
    LIB_SUFFIX
    SHARE_INSTALL_PREFIX
    SYSCONF_INSTALL_DIR
kloczek commented 1 year ago

IMO the best way it would be reshape llvm-cmake as regular cmake module with name like LLVM or llvm to be able use it by add in any CMakeLists.txt include(llvm) or include(LLVM) line.

With that it will be possible to remove all that CMAKE_MODULE_PATH crap and simplify everything. cmake modulke can be versioned as well so it is possiblr to controll import only module with enough high version as well.

shiltian commented 1 year ago

Is it still a problem around?

kloczek commented 1 year ago

I've not tested yet 15.0.7. Will tell you tomorrow.

kloczek commented 1 year ago

OK looks like in my case use in rpm spec file -D CMAKE_MODULE_PATH=%{_libdir}/cmake/llvm solved the isue however looks like libomp linking fails because it is not LTO ready

[ 98%] Built target omptarget
cd /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/libomptarget/DeviceRTL /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/DependInfo.cmake --color=
Dependee "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/DependInfo.cmake" is newer than depender "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/depend.internal".
Dependee "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/depend.internal".
Scanning dependencies of target omptarget.devicertl
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
/usr/bin/gmake  -f libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/build.make libomptarget/DeviceRTL/CMakeFiles/omptarget.devicertl.dir/build
gmake[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
[ 98%] Linking CXX static library ../libomptarget.devicertl.a
cd /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL && /usr/bin/cmake -P CMakeFiles/omptarget.devicertl.dir/cmake_clean_target.cmake
cd /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/DeviceRTL && /usr/bin/cmake -E cmake_link_script CMakeFiles/omptarget.devicertl.dir/link.txt --verbose=1
/usr/bin/gcc-ar qc ../libomptarget.devicertl.a Configuration.cpp.o Debug.cpp.o Kernel.cpp.o Mapping.cpp.o Misc.cpp.o Parallelism.cpp.o Reduction.cpp.o State.cpp.o Synchronization.cpp.o Tasking.cpp.o Utils.cpp.o Workshare.cpp.o
/usr/bin/gcc-ranlib ../libomptarget.devicertl.a
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
[ 98%] Built target omptarget.devicertl
cd /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/plugins/cuda && /usr/bin/cmake -E cmake_symlink_library ../../libomptarget.rtl.cuda.so.15.0 ../../libomptarget.rtl.cuda.so.15.0 ../../libomptarget.rtl.cuda.so
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
[ 98%] Built target omptarget.rtl.cuda
cd /home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu/libomptarget/plugins/amdgpu && /usr/bin/cmake -E cmake_symlink_library ../../libomptarget.rtl.amdgpu.so.15.0 ../../libomptarget.rtl.amdgpu.so.15.0 ../../libomptarget.rtl.amdgpu.so
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
[ 98%] Built target omptarget.rtl.amdgpu
{standard input}: Assembler messages:
{standard input}: Error: invalid attempt to declare external version name as default in symbol `ompc_set_affinity_format@@VERSION'
lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
gmake[2]: *** [runtime/src/CMakeFiles/omp.dir/build.make:612: runtime/src/libomp.so] Error 1
gmake[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
gmake[1]: *** [CMakeFiles/Makefile2:713: runtime/src/CMakeFiles/omp.dir/all] Error 2
gmake[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/openmp-15.0.7.src/x86_64-redhat-linux-gnu'
shiltian commented 1 year ago

Could you put the full CMake configuration you used here? I didn't see how you enable LTO to build libomp.

kloczek commented 1 year ago

By add env variables like below:

[tkloczko@pers-jacek SPECS]$ rpm -E %set_build_flags

ASMFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
CFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
CXXFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
FFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules";
FCFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -U_FORTIFY_SOURCE -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules";
LDFLAGS="-Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1";
VALAFLAGS="${VALAFLAGS:--g}" ; export VALAFLAGS ;
CC="/usr/bin/gcc"; CXX="/usr/bin/g++"; FC="/usr/bin/gfortran";
AR="/usr/bin/gcc-ar"; NM="/usr/bin/gcc-nm"; RANLIB="/usr/bin/gcc-ranlib";
export ASMFLAGS CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS VALAFLAGS CC CXX FC AR NM RANLIB;

You can skip all '-spec=<some/file>` (that file forces to use -fPIE)

shiltian commented 1 year ago

I'll close this one as the version issue will be tracked by https://github.com/llvm/llvm-project/issues/60393.