I'm trying to get triSYCL to work and for that I need OpenMP. I'm trying to build my project with this CMakeLists file:
cmake_minimum_required(VERSION 3.16.2)
project(acDataFlow)
if (NOT DEFINED AC_DATA_FLOW_ROOT_DIR)
message(WARNING "AC_DATA_FLOW_ROOT_DIR will be ${CMAKE_CURRENT_LIST_DIR}, if you're not running the CMakeLists.txt in the root dir of the acDataFlow library, please set the variable AC_DATA_FLOW_ROOT_DIR to the path to the root of the acDataFlow library") #only for Gian Laager, normally the user will set this variable
set(AC_DATA_FLOW_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
endif ()
if (DEFINED GIAN_LAAGERS_MAC)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
set(CMAKE_CXX_COMPILER_ID Clang)
set(CMAKE_C_COMPILER_ID Clang)
set(OPENMP_LIBRARIES "/usr/local/opt/llvm/lib")
set(OPENMP_INCLUDES "/usr/local/opt/llvm/include")
link_directories(${OPENMP_LIBRARIES})
message(STATUS ${GIAN_LAAGERS_MAC})
endif ()
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
#set(CMAKE_COMPILER_IS_GNUCXX "ON")
set(CMAKE_CXX_STANDARD 17)
set(SRC_FILES
${AC_DATA_FLOW_ROOT_DIR}/src/acDataFlow.cpp
)
set(HEADER_FILES
${AC_DATA_FLOW_ROOT_DIR}/include/acDataFlow.h
)
set(Boost_INCLUDE_DIR ${AC_DATA_FLOW_ROOT_DIR}/deps/boost)
include_directories(${AC_DATA_FLOW_ROOT_DIR}/include)
set(TRISYCL_OPENCL "ON")
if (CMAKE_DEBUG)
set(TRISYCL_DEBUG "ON")
endif ()
set(TRISYCL_INCLUDE_DIR ${AC_DATA_FLOW_ROOT_DIR}/deps/SYCL/include)
include(${AC_DATA_FLOW_ROOT_DIR}/deps/SYCL/CMakeLists.txt)
include_directories(${AC_DATA_FLOW_ROOT_DIR}/deps/SYCL/include)
find_package(OpenCL)
add_library(acDataFlow ${SRC_FILES} ${HEADER_FILES})
This statements if (DEFINED GIAN_LAAGERS_MAC) means that there are options for my machine.
I tried other compilers (cc standard compiler, gcc-8 and gcc-9) but nothing seams to work.
I get this error when I run the project:
CMake Error at /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS)
Call Stack (most recent call first):
/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.16/Modules/FindOpenMP.cmake:511 (find_package_handle_standard_args)
deps/SYCL/cmake/FindTriSYCL.cmake:214 (find_package)
deps/SYCL/CMakeLists.txt:13 (include)
CMakeLists.txt:74 (include)
Does any body has an idea how I can get to run?
Thats the link to the GitHub repository
With out compiler compiler settings (as mentioned from Tsyvarev)
My CMakeLists now looks like this:
cmake_minimum_required(VERSION 3.16.2)
set(ENV{CC} "/usr/bin/clang")
set(ENV{CXX} "/usr/bin/clang++")
set(ENV{LDFLAGS} "-L/usr/local/opt/llvm/lib")
set(ENV{CPPFLAGS} "-I/usr/local/opt/llvm/include")
project(acDataFlow)
find_package(OpenMP REQUIRED)
if (NOT DEFINED AC_DATA_FLOW_ROOT_DIR)
...
and that's the output in the CMakeOutput.log file:
The system is: Darwin - 19.5.0 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Build flags:
Id flags:
The output was:
0
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
The C compiler identification is AppleClang, found in "/Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/3.16.5/CompilerIdC/a.out"
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Build flags:
Id flags:
The output was:
0
Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"
The CXX compiler identification is AppleClang, found in "/Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/3.16.5/CompilerIdCXX/a.out"
Determining if the C compiler works passed with the following output:
Change Dir: /Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_7b008/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_7b008.dir/build.make CMakeFiles/cmTC_7b008.dir/build
Building C object CMakeFiles/cmTC_7b008.dir/testCCompiler.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_7b008.dir/testCCompiler.c.o -c /Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_7b008
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7b008.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib CMakeFiles/cmTC_7b008.dir/testCCompiler.c.o -o cmTC_7b008
Detecting C compiler ABI info compiled with the following output:
Change Dir: /Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make cmTC_8d2d7/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_8d2d7.dir/build.make CMakeFiles/cmTC_8d2d7.dir/build
Building C object CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -v -Wl,-v -o CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.o -c /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.16/Modules/CMakeCCompilerABI.c
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: warning: -Wl,-v: 'linker' input unused [-Wunused-command-line-argument]
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.15.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=10.15.4 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 556.6 -v -coverage-notes-file /Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.gcno -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-objc-signed-char-bool-implicit-int-conversion -Wno-extra-semi-stmt -Wno-quoted-include-in-framework-header -fdebug-compilation-dir /Users/gianlaager/Documents/code/C++/ClionProjects/acDataFlow/cmake-build-release/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.15.0 -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.o -x c /Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.16/Modules/CMakeCCompilerABI.c
clang -cc1 version 11.0.3 (clang-1103.0.32.62) default target x86_64-apple-darwin19.5.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks (framework directory)
End of search list.
Linking C executable cmTC_8d2d7
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8d2d7.dir/link.txt --verbose=1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/llvm/lib -v -Wl,-v CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.o -o cmTC_8d2d7
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -platform_version macos 10.15.0 10.15.4 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -o cmTC_8d2d7 -L/usr/local/opt/llvm/lib -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_8d2d7.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld PROJECT:ld64-556.6
BUILD 17:57:49 Apr 24 2020
...
hopfuly that's all you need, I can't show the whole file, because it's to big.
CMAKE_C_COMPILERinCMakeLists.txtseems as easy way for change the compiler, this way has a great disadvantage: When CMake configures your project (reads and interprets yourCMakeLists.txt), it still uses old compiler - the one which is found duringproject()call. E.g. when CMake tries to guess your OpenMP environment, it compiles many code samples just for probe. And these probes use old compiler. Instead of pollutingCMakeLists.txtwith settings for your machine, setCXXandCCenvironment variables and runcmakefrom that environment.CMakeLists.txtand insertfind_package(OpenMP REQUIRED)immediately after theproject()call. This will be actual minimal reproducible example, unlike to your current code, which shows everything... but the actual detection of OpenMP. If new code will reproduce the problem, then paste error log into the question. (CMake points to the error log in the last line of configuration output).set(ENV{CC} "/usr/bin/clang")set(ENV{CXX} "/usr/bin/clang++")set(ENV{LDFLAGS} "-L/usr/local/opt/llvm/lib")set(ENV{CPPFLAGS} "-I/usr/local/opt/llvm/include")before I callproject()but that gives me the same error. (sorry for the mess with this code but I don't know how to format it correctly)