Installing LibTorch on OSX: unsupported option fopenmp - c++

I'm trying to follow the instructions (here https://pytorch.org/cppdocs/installing.html) to install LibTorch on OSX. I was all going well up until the "make" command, which returned
Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
clang: error: unsupported option '-fopenmp'
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
make: *** [all] Error 2
Any ideas how I can fix this issue?
By the way, in the earlier cmake step, it seems like the compiler Cmake found was the default system compiler on Mac:
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works

Related

I have error in cmake make make install fmm

I want to install fast map matching fmm on windows (win7)
and cmake has an error: after command "cmake .."
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /cygdrive/c/MinGW/bin/c++.exe
-- Check for working CXX compiler: /cygdrive/c/MinGW/bin/c++.exe - broken
CMake Error at /usr/share/cmake-3.20.0/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/cygdrive/c/MinGW/bin/c++.exe"
It's not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/make.exe -f Makefile cmTC_c3891/fast && /usr/bin/make -f CMakeFiles/cmTC_c3891.dir/build.make CMakeFiles/cmTC_c3891.dir/build
make[1]: Entering directory `/cygdrive/e/fmm/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o
/cygdrive/c/MinGW/bin/c++.exe -O3 -DSPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE -o CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o -c /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
c++.exe: error: /cygdrive/e/fmm/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx: No such file or directory
c++.exe: fatal error: no input files
compilation terminated.
make[1]: *** [CMakeFiles/cmTC_c3891.dir/testCXXCompiler.cxx.o] Error 1
make[1]: Leaving directory `/cygdrive/e/fmm/build/CMakeFiles/CMakeTmp'
make: *** [cmTC_c3891/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:31 (project)
and because cmake not success, make -j8 has error
make -j8
make: *** No targets specified and no makefile found. Stop.
update:cmake has successed,the error is that i don't install enough librarys.
but i have error in make and make install
E:/anaconda/include/pyport.h:726:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
726 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
| ^~~~~
In file included from /usr/include/cpl_progress.h:33,
from /usr/include/ogrsf_frmts.h:34,
from /cygdrive/e/fmm/src/core/geometry.hpp:14,
from /cygdrive/e/fmm/build/python/CMakeFiles/pyfmm.dir/fmmPYTHON_wrap.cxx:3392:
/usr/include/cpl_port.h:156:12: fatal error: direct.h: No such file or directory
156 | # include <direct.h>
i have tried to switch anaconda to the 64 bit ,it has the same error

cmake error when i have tried to build a compilining?

i have tried to compline a repository via "https://github.com/giglio0/DRAGON-G4-LaBr3.git" but while the compiling, i have taken a error. I don't Know why it is? i am not a coder. Just i want to build this repository and run the simulation with changing some parameters. The error output is;
Scanning dependencies of target LaBr3_v4
[ 9%] Building CXX object CMakeFiles/LaBr3_v4.dir/LaBr3_v4.cc.o
[ 18%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorConstruction.cc.o
[ 27%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/DetectorMessenger.cc.o
[ 36%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/EventAction.cc.o
[ 45%] Building CXX object CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o
/home/cancan/Gatev9/example_Geant4/LaBr/LaBr3/src/HistoManager.cc:29:10: fatal error: TH1D.h: No such file or directory
29 | #include <TH1D.h>
| ^~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/LaBr3_v4.dir/build.make:134: CMakeFiles/LaBr3_v4.dir/src/HistoManager.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/LaBr3_v4.dir/all] Error 2
make: *** [Makefile:149: all] Error 2
can anybody help me?
Apparently you need to install the ROOT library, see: https://root.cern.ch/doc/master/classTH1.html
BTW, the READ.me of the application you want to compile, DRAGON-G4-LaBr3, is awful.
After your advice, i install root-6.22.06 again with use this command;
cmake -DCMAKE_INSTALL_PREFIX=/home/cancan/Gatev9/root-6.22.06-install /home/cancan/Gatev9/root-6.22.06 -Dall=ON
i learned from somewhere if i use "-Dall=ON", i can install all libraries of root but it has not still worked.

Failed to generate makefiles (intel-qs)

https://github.com/iqusoft/intel-qs/issues/32#issue-708056939
I downloaded the relevant package and ran the instructions as shown in the document until I got an error at this step.
CXX=mpiicpc cmake -DIqsMPI=ON -DIqsUtest=ON ..
Then it reported an error
root#vm:~/intel-qs/build# CXX=mpiicpc cmake -DIqsMPI=ON -DIqsUtest=ON ..
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /opt/intel/compilers_and_libraries_2020.2.254/linux/mpi/intel64/bin/mpiicpc
-- Check for working CXX compiler: /opt/intel/compilers_and_libraries_2020.2.254/linux/mpi/intel64/bin/mpiicpc -- broken
CMake Error at /opt/cmake-3.12.2/share/cmake-3.12/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/opt/intel/compilers_and_libraries_2020.2.254/linux/mpi/intel64/bin/mpiicpc"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /root/intel-qs/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_3abc4/fast"
/usr/bin/make -f CMakeFiles/cmTC_3abc4.dir/build.make CMakeFiles/cmTC_3abc4.dir/build
make[1]: Entering directory '/root/intel-qs/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_3abc4.dir/testCXXCompiler.cxx.o
/opt/intel/compilers_and_libraries_2020.2.254/linux/mpi/intel64/bin/mpiicpc -o CMakeFiles/cmTC_3abc4.dir/testCXXCompiler.cxx.o -c /root/intel-qs/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
/opt/intel/compilers_and_libraries_2020.2.254/linux/mpi/intel64/bin/mpiicpc: 1: eval: icpc: not found
CMakeFiles/cmTC_3abc4.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_3abc4.dir/testCXXCompiler.cxx.o' failed
make[1]: *** [CMakeFiles/cmTC_3abc4.dir/testCXXCompiler.cxx.o] Error 127
make[1]: Leaving directory '/root/intel-qs/CMakeFiles/CMakeTmp'
Makefile:121: recipe for target 'cmTC_3abc4/fast' failed
make: *** [cmTC_3abc4/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:17 (project)
-- Configuring incomplete, errors occurred!
See also "/root/intel-qs/CMakeFiles/CMakeOutput.log".
See also "/root/intel-qs/CMakeFiles/CMakeError.log".
If anyone knows how to do it, it would be greatly appreciated.

Test Cmake run finished with errors (CLION)

I have the following problem after changing path to one that is easier for the operating system. My MinGW configuration in CLion:
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2018.2.5/bin/cmake/win/share/cmake-3.12/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"C:/MinGW/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_da460/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_da460.dir\build.make CMakeFiles/cmTC_da460.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/Micha│/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj
C:\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_da460.dir\testCCompiler.c.obj -c C:\Users\Michał\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\Michał\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_da460.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_da460.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/Micha│/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Makefile:120: recipe for target 'cmTC_da460/fast' failed
mingw32-make.exe: *** [cmTC_da460/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Michał/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
Here is a screenshot from my PC:

Linking error of BLAS with CMake

I have the following CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
project (MTSOS)
# Select flags.
set(CMAKE_C_FLAGS "-std=c99")
# Blas library
find_package( BLAS REQUIRED )
include_directories(${BLAS_INCLUDE_DIR})
add_executable (test_MTSOS test_MTSOS.c barrier_front.c dynamics_front.c
MTSOS.c csparse.c)
# Linking CImg dependencies.
target_link_libraries (test_MTSOS m blas ${BLAS_LIBRARIES})
When I run cmake .. :
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for dgemm_
-- Looking for dgemm_ - found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- A library with BLAS API found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jabuntu14/Desktop/MTSOS/build
However, when I try to compile with make:
Scanning dependencies of target test_MTSOS
[ 20%] Building C object CMakeFiles/test_MTSOS.dir/test_MTSOS.c.o
[ 40%] Building C object CMakeFiles/test_MTSOS.dir/barrier_front.c.o
/home/jabuntu14/Desktop/MTSOS/barrier_front.c: In function ‘so_barrier’:
/home/jabuntu14/Desktop/MTSOS/barrier_front.c:83:25: warning: implicit declaration of function ‘dsyr’ [-Wimplicit-function-declaration]
dsyr(uplo, &u_size, &alpha, &Df[i*U_size], &one, A, &u_size);
^
[ 60%] Building C object CMakeFiles/test_MTSOS.dir/dynamics_front.c.o
[ 80%] Building C object CMakeFiles/test_MTSOS.dir/MTSOS.c.o
/home/jabuntu14/Desktop/MTSOS/MTSOS.c: In function ‘so_MakeA’:
/home/jabuntu14/Desktop/MTSOS/MTSOS.c:1561:13: warning: implicit declaration of function ‘dgemv’ [-Wimplicit-function-declaration]
dgemv(chn, &m_m, &n_m, &one, &M_dynamics[i*State_size*State_size], &m_m, &S_prime[i*State_size], &p_m, &zero, datam, &p_m);
^
[100%] Building C object CMakeFiles/test_MTSOS.dir/csparse.c.o
Linking C executable test_MTSOS
CMakeFiles/test_MTSOS.dir/barrier_front.c.o: In function `so_barrier':
barrier_front.c:(.text+0x4a7): undefined reference to `dsyr'
CMakeFiles/test_MTSOS.dir/MTSOS.c.o: In function `so_MakeA':
MTSOS.c:(.text+0x5e41): undefined reference to `dgemv'
MTSOS.c:(.text+0x5ee4): undefined reference to `dgemv'
MTSOS.c:(.text+0x5f87): undefined reference to `dgemv'
collect2: error: ld returned 1 exit status
make[2]: *** [test_MTSOS] Error 1
make[1]: *** [CMakeFiles/test_MTSOS.dir/all] Error 2
make: *** [all] Error 2
So I am having a linking problem but I cannot figure out why. Any help is welcome. Thanks!!
NOTE: Working under Ubuntu 14.04 with GCC. In the .c files I have included #include "cblas.h" as I saw in other websites.
EDIT: running make VERBOSE=1 the output is:
jabuntu14#ubuntu:~/Desktop/MTSOS/build$ make VERBOSE=1
/usr/bin/cmake -H/home/jabuntu14/Desktop/MTSOS -B/home/jabuntu14/Desktop/MTSOS/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
make -f CMakeFiles/test_MTSOS.dir/build.make CMakeFiles/test_MTSOS.dir/depend
make[2]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
cd /home/jabuntu14/Desktop/MTSOS/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jabuntu14/Desktop/MTSOS /home/jabuntu14/Desktop/MTSOS /home/jabuntu14/Desktop/MTSOS/build /home/jabuntu14/Desktop/MTSOS/build /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles/test_MTSOS.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make -f CMakeFiles/test_MTSOS.dir/build.make CMakeFiles/test_MTSOS.dir/build
make[2]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
Linking C executable test_MTSOS
/usr/bin/cmake -E cmake_link_script CMakeFiles/test_MTSOS.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 CMakeFiles/test_MTSOS.dir/test_MTSOS.c.o CMakeFiles/test_MTSOS.dir/barrier_front.c.o CMakeFiles/test_MTSOS.dir/dynamics_front.c.o CMakeFiles/test_MTSOS.dir/MTSOS.c.o CMakeFiles/test_MTSOS.dir/csparse.c.o -o test_MTSOS -rdynamic -lm -lblas -lf77blas -latlas
CMakeFiles/test_MTSOS.dir/barrier_front.c.o: In function `so_barrier':
barrier_front.c:(.text+0x4a7): undefined reference to `dsyr'
CMakeFiles/test_MTSOS.dir/MTSOS.c.o: In function `so_MakeA':
MTSOS.c:(.text+0x5e41): undefined reference to `dgemv'
MTSOS.c:(.text+0x5ee4): undefined reference to `dgemv'
MTSOS.c:(.text+0x5f87): undefined reference to `dgemv'
collect2: error: ld returned 1 exit status
make[2]: *** [test_MTSOS] Error 1
make[2]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make[1]: *** [CMakeFiles/test_MTSOS.dir/all] Error 2
make[1]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make: *** [all] Error 2
The functions in standard blas libraries are
dgemv_
Instead of
dgemv
As shown in your error, notice the trailing underscore.
So you probably have something in your code calling dgemv() instead of dgemv_(), change that and then you should be fine.
(I had the same issue where the code I was using had some like #define dgemv_ dgemv)