On a vanilla CentOS 7 box, I have OpenMPI installed (stock version), and did:
module load mpi
to load the MPI stuff into the environment. Under this setting, cmake (I tried both 2.8 and latest 3.12) can't seem to find the MPI. Any idea how to resolve this? Thanks
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS)
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
CMake Error at /home/f7b/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/cmake-3.12.2-25n7srkgvu3elwswze6dckezvfkxqks7/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
/home/f7b/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/cmake-3.12.2-25n7srkgvu3elwswze6dckezvfkxqks7/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/home/f7b/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/cmake-3.12.2-25n7srkgvu3elwswze6dckezvfkxqks7/share/cmake-3.12/Modules/FindMPI.cmake:1666 (find_package_handle_standard_args)
CMakeLists.txt:27 (find_package)
Appending /usr/lib64/openmpi/bin/ to the PATH before running cmake worked for me.
have you installed openmpi-devel?
what do you get when you do "which mpicc"?
can you re-try after doing:
export MPI_C=`which mpicc`
export MPI_CXX=`which mpicxx`
also this might be due to the fact that 'spack' sanitizes the environment. So might want to try "spack install --dirty ..." or else put openmpi preference in packages.yaml
Also, I would guess that missing environment variables should correspond to or found under the the following paths:
module show mpi
Try cmake version 3.9. When I built Lammps with MPI and Intel Parallel Suite, I solved the issue by using cmake 3.9 while 3.10 still had that problem. There are some discussions here.
Related
Yesterday I asked a rather similar question. But this one is slightly different.
I am on Arch Linux with gcc 10 installed. I need to use gcc with version < 9 (a colleague even uses gcc4) to compile a Fortran code base.
So I installed the gcc7-fortran package because this colleague told me that it once worked with this compiler.
CMake figures out that it has to use mpif90 to compile the whole project which does not call gfortran-7 but gfortran which is version 10.
I could not yet figure out how to tell mpif90 to use another compiler as gfortran. So i did a little hack: I moved /usr/bin/gfortran to /usr/bin/gfortran-10 and made a soft link from /usr/bin/gfortran-7 to /usr/bin/gfortran. Now mpif90 uses gfortran with version 7. Great.
Now here comes the error. CMake is able to find MPI if I use gfortran-10 as compiler but is not able to find MPI if I use gfortran-7.
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS)
CMake Error at /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1")
Call Stack (most recent call first):
/usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
CMAKE/modules/FindMPI.cmake:1721 (find_package_handle_standard_args)
CMakeLists.txt:388 (find_package)
Has anyone ever had a similar issue?
Thanks in advance!
EDIT
when using gfortran-10 cmake tells finding MPI with this message
-- Found MPI_Fortran: /usr/lib/openmpi/libmpi_usempif08.so (found version "3.1")
CMake does not find MPI for Fortran.
I am on Arch Linux with CMake 3.19.2.
I installed the openmpi (4.0.5-2) package and as stated here I also installed the gcc-fortran (10.2.0-4) package for fortran support.
I my CMake script in the line where MPI should be found:
find_package(MPI REQUIRED)
it tells me that it could not find MPI for Fortran:
-- Found MPI_C: /usr/lib/openmpi/libmpi.so (found version "3.1")
-- Found MPI_CXX: /usr/lib/openmpi/libmpi_cxx.so (found version "3.1")
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_WORKS)
CMake Error at /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
Could NOT find MPI (missing: MPI_Fortran_FOUND) (found version "3.1")
Call Stack (most recent call first):
/usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.19/Modules/FindMPI.cmake:1721 (find_package_handle_standard_args)
CMakeLists.txt:387 (find_package)
When installing openmpi it tells me that fortran support should be enabled:
(2/2) installing openmpi
Optional dependencies for openmpi
gcc-fortran: fortran support [installed]
There is a file /usr/lib/openmpi/libmpi_mpifh.so. Correct me if I am wrong but I think this should be the correct library file.
Thanks in advance for your help!
EDIT
I just tried to build a minimal example:
project(test)
cmake_minimum_required(VERSION 3.0)
enable_language(Fortran)
find_package(MPI REQUIRED)
With this it finds MPI_Fortran
-- Found MPI_Fortran: /usr/lib/openmpi/libmpi_usempif08.so (found version "3.1")
The CMakeLists.txt is a rather long and legacy one...
Seems that I have to find the solution on my own.
I solved the problem. As said in the edit of the answer this is legacy cmake and not written by myself.
My fortran skills are not too advanced so I do not know why this is used but the following line did break the finding process of the library:
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -heap-arrays 0")
If anyone falls into the same trap try to avoid this!
You need to use the COMPONENTS keyword on the find_package command, e.g.
find_package(MPI REQUIRED COMPONENTS Fortran)
Be sure you have Fortran enabled in your CMakeLists.txt either by enabling it in the project command, i.e.
project(name LANGUAGES Fortran)
or by calling
enable_language(Fortran)
prior to find_package.
While trying to use Cmake on windows 10, it is not possible as OpenSSL wasn't found in my system even though I have it downloaded and installed.
CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find OpenSSL (missing: OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
src/cmake/macros/FindOpenSSL.cmake:184 (find_package_handle_standard_args)
CMakeLists.txt:92 (find_package)
I'm not familiar with Cmake, especially not as well on managing software like this for windows 10 (Because it's not meant for win10) but help would be appreciated!
Expected results: Azeroath core to compile and load normally
Outcome results: Azeroath core didn't compile at all
Make sure your using correct version, it has to be full installer and "NOT" light version. Also check your using x86 or x64 (dont mix DLL).
This is where i get mine for windows https://slproweb.com/products/Win32OpenSSL.html
I am attempting to build hyperscan: https://github.com/01org/hyperscan on ubuntu 16.04. I have installed the listed prerequisites and I am now using Cmake to create the build scripts which gives the following error:
...
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- looking for sqlite3 in source tree
CMake Error at cmake/sqlite3.cmake:25 (message):
no sqlite3 in source tree
Call Stack (most recent call first):
tools/hsbench/CMakeLists.txt:1 (include)
-- Configuring incomplete, errors occurred!
See also "/home/rful011/hyperscan/build/CMakeFiles/CMakeOutput.log".
See also "/home/rful011/hyperscan/build/CMakeFiles/CMakeError.log".
The tails of the two Cmake Files have nothing related to sqlite -- they deal with the thread stuff.
I installed the libsqlite3-dev package but that made no difference. I am not familiar with Cmake (with configure I would be looking at fiddling with options to specify library locations...) so I am at a loss on how to proceed.
I did find the sqlite.cmake file and it appears to check for installed module (which presumably failed) and then it looks in the source tree.3
The problem turned out to be that pkg-config was not installed and installing it fixed the issue.
I was looking at the cmake file and guessed that "find_package(PkgConfig QUIET)" called pktconfig and when I checked it was not installed.
Hope this helps someone in the future!
I installed cxWidgets as follows:
sudo install wxWidgets-3.0
In the cmake file of a project I am trying to build, find_package is called:
find_package(wxWidgets REQUIRED)
However, cmake complains that it can't find the package:
CMake Error at /opt/local/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
My question is, given that cxWidgets is installed (I have confirmed by running port installed), why can't cmake find it?
The problem is that MacPorts has to support multiple versions of wxWidgets and I have no good idea how to automatically let CMake find the requested version.
You have two options.
The first one is to run sudo port select wxWidgets wxWidgets-3.0. Then CMake should automatically find wxWidgets 3.0.
The second option is to add an additional argument to cmake that depends on the software you are trying to compile.
Usually one of these flags should work:
-DwxWidgets_CONFIG_EXECUTABLE=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config
-DwxWidgets_wxrc_EXECUTABLE=/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wxrc