How to choose MPI vendor/distribution with CMake? - c++

I have a program that I would like to compile with CMake + make but using two different MPI distributions, OpenMPI and MPICH.
In Ubuntu, I have both installed; these are all the compiler wrappers I have installed:
mpic++ mpicxx mpif77.mpich mpijavac
mpicc mpicxx.mpich mpif77.openmpi mpijavac.pl
mpiCC mpicxx.openmpi mpif90 mpirun
mpicc.mpich mpiexec mpif90.mpich mpirun.mpich
mpicc.openmpi mpiexec.hydra mpif90.openmpi mpirun.openmpi
mpiCC.openmpi mpiexec.mpich mpifort mpivars
mpichversion mpiexec.openmpi mpifort.mpich
mpic++.openmpi mpif77 mpifort.openmpi
(OpenMPI is the default, i.e. when no distribution extension is specified. I am not using modules.)
How can I force CMake to choose MPICH over OpenMPI?
I tried setting -DMPI_ROOT=/usr/lib/x86_64-linux-gnu/mpich but
I get this error:
-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find MPI (missing: MPI_CXX_FOUND)
Reason given by package: MPI component 'C' was requested, but language C is not enabled. MPI component 'Fortran' was requested, but language Fortran is not enabled.
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.18/Modules/FindMPI.cmake:1721 (find_package_handle_standard_args)
CMakeLists.txt:11 (find_package)
it still uses OpenMPI.
This is how my CMakeLists.txt looks like:
cmake_minimum_required(VERSION 3.12.0)
project(myproject VERSION 0.1 LANGUAGES CXX)
#enable_language(C) #uncommenting these doesn't help
#enable_language(Fortran)
enable_testing()
include(CTest)
find_package(MPI REQUIRED)

Setting -DMPI_ROOT= or -DMPI_HOME= didn't work for me. It still uses the default in my system (OpenMPI).
What worked was to set -DMPI_EXECUTABLE_SUFFIX=.mpich, option which I found near the end of the documentation: https://cmake.org/cmake/help/latest/module/FindMPI.html.

Based on cmake documents, you should be able to select one by setting value of MPI_GUESS_LIBRARY_NAME.
Update: According to same document:
Try to find an MPI implementation that does not ship such a wrapper by guessing settings. Currently, only Microsoft MPI and MPICH2 on Windows are supported.

Related

opencv crosscompile:Unexpected CMake generator expression

When doing opencv cross-compilation for embedded devices, in order to use muslc c++, etc., I used this sentence in cmakelists.txt:
set(SYSTEM_LIBRARY_FOR_OPENCV
muslc
muslcsys
stdc++
supc++)
ocv_target_link_libraries(${the_module} PRIVATE
"$<BUILD_INTERFACE:${SYSTEM_LIBRARY_FOR_OPENCV}>")
Compilation can be successful, but there is such a warning:
CMake Warning at third_party/utils/opencv-4.6.0/cmake/OpenCVUtils.cmake:1675 (message):
Unexpected CMake generator expression: $<LINK_ONLY:$<BUILD_INTERFACE:muslc
Call Stack (most recent call first):
third_party/utils/opencv-4.6.0/CMakeLists.txt:1221 (ocv_get_all_libs)
I have verified that if you write directly like this:
ocv_target_link_libraries(${the_module} PRIVATE
"${SYSTEM_LIBRARY_FOR_OPENCV}")
it will appear error:
cmake error: includes target which requires target that is not in the export set
After searching, I didn't find any news related to this warning. Have you ever encountered it? How to eliminate it?
thanks

How to setup mingw in vcpkg (Windows)

I tried to install mingw package from vcpkg but I got an error
C:\Users\Administrator\Downloads\vcpkg>vcpkg.exe install curl:x64-mingw-static
Computing installation plan...
The following packages will be built and installed:
curl[core,non-http,schannel,ssl,sspi]:x64-mingw-static -> 7.82.0
* zlib[core]:x64-mingw-static -> 1.2.12
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-mingw-static...
Error: while detecting compiler information:
The log content at C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\stdout-x64-mingw-static.log is:
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
Command failed: ninja -v
Working Directory: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/vcpkg-parallel-configure
Error code: 1
See logs for more information:
C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-out.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_cmake.cmake:370 (vcpkg_execute_required_process)
scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
scripts/ports.cmake:145 (include)
Error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
C:\Users\Administrator\Downloads\vcpkg>
How can I fix it? I have mingw installed on C:/mingw64 and C:/mingw32 and I'm using them in CLion without problems
Error in config-x64-mingw-static-out.log
[1/1] cmd /c "cd .. && "C:/Users/Administrator/Downloads/vcpkg/downloads/tools/cmake-3.22.2-windows/cmake-3.22.2-windows-i386/bin/cmake.exe" "C:/Users/Administrator/Downloads/vcpkg/scripts/detect_compiler" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-DZ_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-D_VCPKG_INSTALLED_DIR=C:/Users/Administrator/Downloads/vcpkg/installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/Users/Administrator/Downloads/vcpkg/packages/detect_compiler_x64-windows-static""
-- The C compiler identification is MSVC 19.31.31107.0
-- The CXX compiler identification is MSVC 19.31.31107.0
#COMPILER_HASH#c3649029c7e070e5f43d9ce4d317605f000f9404
#COMPILER_C_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_C_VERSION#19.31.31107.0
#COMPILER_C_ID#MSVC
#COMPILER_CXX_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_CXX_VERSION#19.31.31107.0
#COMPILER_CXX_ID#MSVC
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_SHARED_LIBS
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
VCPKG_TARGET_ARCHITECTURE
_VCPKG_ROOT_DIR
-- Build files have been written to: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-windows-static-rel
It looks like it detects microsoft compiler instead of mingw
The problem was not set gcc.exe in PATH, adding it resolved problem

How to set MKL on Linux with Cmake

I've used the same code provided in this link
How to setup MKL on linux with CMake
But i'm getting this error
Could NOT find MKL (missing: MKL_LIBRARIES MKL_INCLUDE_DIRS
I've tried to set MKLROOT to the following
SET(ENV{MKLROOT} "/home/usr/intel/mkl:$ENV{MKLROOT}")
This is how findmkl.cmake module looks like without the line of code to set the environment for mklroot (i've used the same code in the link below)
https://gist.github.com/scivision/5108cf6ab1515f581a84cd9ad1ef72aa
i suspect the issue is setting the mklroot but not sure, any help is appreciated.
If MKLROOT is initially unset, the statement SET(ENV{MKLROOT} "/home/usr/intel/mkl:$ENV{MKLROOT}") sets MKLROOT equal to /home/usr/intel/mkl:, which is an incorrect format for the path. Instead, you could use
set(ENV{MKLROOT} "/home/usr/intel/mkl")
Alternatively, you can set the value of that environment variable externally, e.g.,
source /home/usr/intel/bin/compilervars.sh intel64
and then run CMake. In that case, there is no need for the CMake set statement, which is a more portable solution.
UPDATE: As of 20th Feb 2021 compilervars.sh is not provided within Intel MKL and the environment should be set with the following command:
source /opt/intel/oneapi/setvars.sh intel64
or wherever oneAPI is installed.

Error using CMake to build SFML for Fedora 23 [xcb-image not found]

[FIRST ERROR FIXED, ANOTHER ONE AT END OF POST]
Hello and thanks in advance, I am having an issue trying to build SFML for my Fedora 23 system so I may continue work on my game I was developing in Linux Mint (I like fedora better, and I want it to work for both Debian and openSUSE distributions). The problem occurs when I am building SFML in the CMake GUI, it gives me the error:
Could NOT find LIBXCB_IMAGE (missing: LIBXCB_IMAGE_LIBRARY)
CMake Error at cmake/Modules/FindXCB.cmake:93 (message):
xcb-image not found
Call Stack (most recent call first):
src/SFML/Window/CMakeLists.txt:202 (find_package)
Configuring incomplete, errors occurred!
I checked to see if xcb-image was there by using the "locate" keyword and it returned:
[hunter#localhost ~]$ locate xcb-image
/usr/lib/libxcb-image.so.0
/usr/lib/libxcb-image.so.0.0.0 /usr/lib64/libxcb-image.so.0
/usr/lib64/libxcb-image.so.0.0.0
I also tried reinstalling libxcb to see if that would fix it but no cigar.
And yes, I read the tutorial SFML gives and made sure everything was installed and I followed the correct steps as well. link
Any idea why it's giving me this error? Compiler is the normal Fedora 23 gcc-c++ install... I'll provide any more information if needed.
EDIT 1
Fixed by installing 'xcb-util-image-devel'
I was able to fix it; but now get a new error:
UDev not found.
UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include
currently found includes: UDEV_INCLUDE_DIR-NOTFOUND
UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib
currently found libs: UDEV_LIBRARIES-NOTFOUND
CMake Error at cmake/Modules/FindUDev.cmake:49 (MESSAGE):
Could not find UDev library
Call Stack (most recent call first):
src/SFML/Window/CMakeLists.txt:215 (find_package)
I used 'locate udev' and I found lots of stuff:
[hunter#localhost ~]$ locate udev
/etc/udev
/etc/udev/hwdb.bin
/etc/udev/hwdb.d
/etc/udev/rules.d
/etc/udev/udev.conf
/usr/bin/udevadm
/usr/lib/libudev.so.1
/usr/lib/libudev.so.1.6.4
/usr/lib/udev
/usr/lib/dracut/modules.d/95udev-rules
/usr/lib/dracut/modules.d/90dm/dm-pre-udev.sh
/usr/lib/dracut/modules.d/90mdraid/mdmon-pre-udev.sh
/usr/lib/dracut/modules.d/95udev-rules/59-persistent-storage.rules
/usr/lib/dracut/modules.d/95udev-rules/61-persistent-storage.rules
/usr/lib/dracut/modules.d/95udev-rules/load-modules.sh
/usr/lib/dracut/modules.d/95udev-rules/module-setup.sh
/usr/lib/dracut/modules.d/98dracut-systemd/dracut-pre-udev.service
/usr/lib/dracut/modules.d/98dracut-systemd/dracut-pre-udev.service.8
/usr/lib/dracut/modules.d/98dracut-systemd/dracut-pre-udev.service.8.asc
/usr/lib/dracut/modules.d/98dracut-systemd/dracut-pre-udev.sh
/usr/lib/python3.4/site-packages/pyudev
/usr/lib/python3.4/site-packages/pyudev-0.17-py3.4.egg-info
/usr/lib/python3.4/site-packages/blivet/udev.py
/usr/lib/python3.4/site-packages/blivet/__pycache__/udev.cpython-34.pyc
/usr/lib/python3.4/site-packages/blivet/__pycache__/udev.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__init__.py
/usr/lib/python3.4/site-packages/pyudev/__pycache__
/usr/lib/python3.4/site-packages/pyudev/_compat.py
/usr/lib/python3.4/site-packages/pyudev/_errorcheckers.py
/usr/lib/python3.4/site-packages/pyudev/_libc.py
/usr/lib/python3.4/site-packages/pyudev/_libudev.py
/usr/lib/python3.4/site-packages/pyudev/_qt_base.py
/usr/lib/python3.4/site-packages/pyudev/_util.py
/usr/lib/python3.4/site-packages/pyudev/core.py
/usr/lib/python3.4/site-packages/pyudev/device
/usr/lib/python3.4/site-packages/pyudev/glib.py
/usr/lib/python3.4/site-packages/pyudev/monitor.py
/usr/lib/python3.4/site-packages/pyudev/os.py
/usr/lib/python3.4/site-packages/pyudev/pyqt4.py
/usr/lib/python3.4/site-packages/pyudev/pyside.py
/usr/lib/python3.4/site-packages/pyudev/wx.py
/usr/lib/python3.4/site-packages/pyudev/__pycache__/__init__.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/__init__.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_compat.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_compat.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_errorcheckers.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_errorcheckers.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_libc.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_libc.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_libudev.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_libudev.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_qt_base.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_qt_base.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_util.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/_util.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/core.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/core.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/glib.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/glib.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/monitor.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/monitor.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/os.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/os.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/pyqt4.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/pyqt4.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/pyside.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/pyside.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/__pycache__/wx.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/__pycache__/wx.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/device/__init__.py
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__
/usr/lib/python3.4/site-packages/pyudev/device/_device.py
/usr/lib/python3.4/site-packages/pyudev/device/_errors.py
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/__init__.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/__init__.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/_device.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/_device.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/_errors.cpython-34.pyc
/usr/lib/python3.4/site-packages/pyudev/device/__pycache__/_errors.cpython-34.pyo
/usr/lib/python3.4/site-packages/pyudev-0.17-py3.4.egg-info/PKG-INFO
/usr/lib/python3.4/site-packages/pyudev-0.17-py3.4.egg-info/SOURCES.txt
/usr/lib/python3.4/site-packages/pyudev-0.17-py3.4.egg-info/dependency_links.txt
/usr/lib/python3.4/site-packages/pyudev-0.17-py3.4.egg-info/top_level.txt
/usr/lib/python3.4/site-packages/sos/plugins/udev.py
/usr/lib/python3.4/site-packages/sos/plugins/__pycache__/udev.cpython-34.pyc
/usr/lib/python3.4/site-packages/sos/plugins/__pycache__/udev.cpython-34.pyo
/usr/lib/systemd/systemd-udevd
/usr/lib/systemd/system/dracut-pre-udev.service
/usr/lib/systemd/system/initrd-udevadm-cleanup-db.service
/usr/lib/systemd/system/systemd-udev-settle.service
/usr/lib/systemd/system/systemd-udev-trigger.service
/usr/lib/systemd/system/systemd-udevd-control.socket
/usr/lib/systemd/system/systemd-udevd-kernel.socket
/usr/lib/systemd/system/systemd-udevd.service
/usr/lib/systemd/system/initrd.target.wants/dracut-pre-udev.service
/usr/lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket
/usr/lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket
/usr/lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service
/usr/lib/systemd/system/sysinit.target.wants/systemd-udevd.service
/usr/lib/udev/ata_id
/usr/lib/udev/bcache-register
/usr/lib/udev/cdrom_id
/usr/lib/udev/check-ptp-camera
/usr/lib/udev/collect
/usr/lib/udev/hwdb.d
/usr/lib/udev/iphone-set-info
/usr/lib/udev/ipod-set-info
/usr/lib/udev/libinput-device-group
/usr/lib/udev/libinput-model-quirks
/usr/lib/udev/mtd_probe
/usr/lib/udev/mtp-probe
/usr/lib/udev/pcmcia-check-broken-cis
/usr/lib/udev/pcmcia-socket-startup
/usr/lib/udev/rename_device
/usr/lib/udev/rules.d
/usr/lib/udev/scsi_id
/usr/lib/udev/udev-add-printer
/usr/lib/udev/udev-configure-printer
/usr/lib/udev/usb_modeswitch
/usr/lib/udev/v4l_id
/usr/lib/udev/hwdb.d/20-OUI.hwdb
/usr/lib/udev/hwdb.d/20-acpi-vendor.hwdb
/usr/lib/udev/hwdb.d/20-bluetooth-vendor-product.hwdb
/usr/lib/udev/hwdb.d/20-net-ifname.hwdb
/usr/lib/udev/hwdb.d/20-pci-classes.hwdb
/usr/lib/udev/hwdb.d/20-pci-vendor-model.hwdb
/usr/lib/udev/hwdb.d/20-sane-backends.hwdb
/usr/lib/udev/hwdb.d/20-sdio-classes.hwdb
/usr/lib/udev/hwdb.d/20-sdio-vendor-model.hwdb
/usr/lib/udev/hwdb.d/20-usb-classes.hwdb
/usr/lib/udev/hwdb.d/20-usb-media-players.hwdb
/usr/lib/udev/hwdb.d/20-usb-vendor-model.hwdb
/usr/lib/udev/hwdb.d/60-evdev.hwdb
/usr/lib/udev/hwdb.d/60-keyboard.hwdb
/usr/lib/udev/hwdb.d/69-libmtp.hwdb
/usr/lib/udev/hwdb.d/70-mouse.hwdb
/usr/lib/udev/hwdb.d/70-pointingstick.hwdb
/usr/lib/udev/hwdb.d/90-libinput-model-quirks.hwdb
/usr/lib/udev/rules.d/10-dm.rules
/usr/lib/udev/rules.d/11-dm-lvm.rules
/usr/lib/udev/rules.d/11-dm-mpath.rules
/usr/lib/udev/rules.d/13-dm-disk.rules
/usr/lib/udev/rules.d/39-usbmuxd.rules
/usr/lib/udev/rules.d/40-iio-sensor-proxy.rules
/usr/lib/udev/rules.d/40-libgphoto2.rules
/usr/lib/udev/rules.d/40-usb-media-players.rules
/usr/lib/udev/rules.d/40-usb_modeswitch.rules
/usr/lib/udev/rules.d/50-udev-default.rules
/usr/lib/udev/rules.d/56-hp_conf_usb.rules
/usr/lib/udev/rules.d/56-hpmud.rules
/usr/lib/udev/rules.d/60-block.rules
/usr/lib/udev/rules.d/60-cdrom_id.rules
/usr/lib/udev/rules.d/60-drm.rules
/usr/lib/udev/rules.d/60-evdev.rules
/usr/lib/udev/rules.d/60-fprint-autosuspend.rules
/usr/lib/udev/rules.d/60-net.rules
/usr/lib/udev/rules.d/60-pcmcia.rules
/usr/lib/udev/rules.d/60-persistent-alsa.rules
/usr/lib/udev/rules.d/60-persistent-input.rules
/usr/lib/udev/rules.d/60-persistent-storage-tape.rules
/usr/lib/udev/rules.d/60-persistent-storage.rules
/usr/lib/udev/rules.d/60-persistent-v4l.rules
/usr/lib/udev/rules.d/60-raw.rules
/usr/lib/udev/rules.d/60-serial.rules
/usr/lib/udev/rules.d/61-gnome-bluetooth-rfkill.rules
/usr/lib/udev/rules.d/61-gnome-settings-daemon-rfkill.rules
/usr/lib/udev/rules.d/62-multipath.rules
/usr/lib/udev/rules.d/63-md-raid-arrays.rules
/usr/lib/udev/rules.d/64-btrfs.rules
/usr/lib/udev/rules.d/64-md-raid-assembly.rules
/usr/lib/udev/rules.d/65-libwacom.rules
/usr/lib/udev/rules.d/65-md-incremental.rules
/usr/lib/udev/rules.d/65-sane-backends.rules
/usr/lib/udev/rules.d/69-bcache.rules
/usr/lib/udev/rules.d/69-cd-sensors.rules
/usr/lib/udev/rules.d/69-dm-lvm-metad.rules
/usr/lib/udev/rules.d/69-libmtp.rules
/usr/lib/udev/rules.d/69-xorg-vmmouse.rules
/usr/lib/udev/rules.d/70-mouse.rules
/usr/lib/udev/rules.d/70-power-switch.rules
/usr/lib/udev/rules.d/70-printers.rules
/usr/lib/udev/rules.d/70-spice-vdagentd.rules
/usr/lib/udev/rules.d/70-touchpad-quirks.rules
/usr/lib/udev/rules.d/70-uaccess.rules
/usr/lib/udev/rules.d/70-wacom.rules
/usr/lib/udev/rules.d/71-seat.rules
/usr/lib/udev/rules.d/73-seat-late.rules
/usr/lib/udev/rules.d/75-net-description.rules
/usr/lib/udev/rules.d/75-probe_mtd.rules
/usr/lib/udev/rules.d/77-mm-cinterion-port-types.rules
/usr/lib/udev/rules.d/77-mm-ericsson-mbm.rules
/usr/lib/udev/rules.d/77-mm-huawei-net-port-types.rules
/usr/lib/udev/rules.d/77-mm-longcheer-port-types.rules
/usr/lib/udev/rules.d/77-mm-mtk-port-types.rules
/usr/lib/udev/rules.d/77-mm-nokia-port-types.rules
/usr/lib/udev/rules.d/77-mm-pcmcia-device-blacklist.rules
/usr/lib/udev/rules.d/77-mm-platform-serial-whitelist.rules
/usr/lib/udev/rules.d/77-mm-simtech-port-types.rules
/usr/lib/udev/rules.d/77-mm-telit-port-types.rules
/usr/lib/udev/rules.d/77-mm-usb-device-blacklist.rules
/usr/lib/udev/rules.d/77-mm-usb-serial-adapters-greylist.rules
/usr/lib/udev/rules.d/77-mm-x22x-port-types.rules
/usr/lib/udev/rules.d/77-mm-zte-port-types.rules
/usr/lib/udev/rules.d/78-sound-card.rules
/usr/lib/udev/rules.d/80-drivers.rules
/usr/lib/udev/rules.d/80-kvm.rules
/usr/lib/udev/rules.d/80-libinput-device-groups.rules
/usr/lib/udev/rules.d/80-mm-candidate.rules
/usr/lib/udev/rules.d/80-net-setup-link.rules
/usr/lib/udev/rules.d/80-udisks2.rules
/usr/lib/udev/rules.d/85-nm-unmanaged.rules
/usr/lib/udev/rules.d/85-regulatory.rules
/usr/lib/udev/rules.d/90-alsa-restore.rules
/usr/lib/udev/rules.d/90-fwupd-devices.rules
/usr/lib/udev/rules.d/90-libgpod.rules
/usr/lib/udev/rules.d/90-libinput-model-quirks.rules
/usr/lib/udev/rules.d/90-pulseaudio.rules
/usr/lib/udev/rules.d/90-vconsole.rules
/usr/lib/udev/rules.d/91-drm-modeset.rules
/usr/lib/udev/rules.d/95-cd-devices.rules
/usr/lib/udev/rules.d/95-dm-notify.rules
/usr/lib/udev/rules.d/95-upower-csr.rules
/usr/lib/udev/rules.d/95-upower-hid.rules
/usr/lib/udev/rules.d/95-upower-wup.rules
/usr/lib/udev/rules.d/98-kexec.rules
/usr/lib/udev/rules.d/99-qemu-guest-agent.rules
/usr/lib/udev/rules.d/99-systemd.rules
/usr/lib64/libgudev-1.0.so.0
/usr/lib64/libgudev-1.0.so.0.2.0
/usr/lib64/libudev.so.1
/usr/lib64/libudev.so.1.6.4
/usr/lib64/pulse-7.0/modules/module-udev-detect.so
/usr/sbin/udevadm
/usr/share/bash-completion/completions/_udevadm
/usr/share/bash-completion/completions/udevadm
/usr/share/doc/libgudev
/usr/share/doc/python3-pyudev
/usr/share/doc/libgudev/NEWS
/usr/share/doc/python3-pyudev/CHANGES.rst
/usr/share/doc/python3-pyudev/README.rst
/usr/share/licenses/libgudev
/usr/share/licenses/python3-pyudev
/usr/share/licenses/libgudev/COPYING
/usr/share/licenses/python3-pyudev/COPYING
/usr/share/man/man5/udev.conf.5.gz
/usr/share/man/man7/udev.7.gz
/usr/share/man/man8/dracut-pre-udev.service.8.gz
/usr/share/man/man8/systemd-udevd-control.socket.8.gz
/usr/share/man/man8/systemd-udevd-kernel.socket.8.gz
/usr/share/man/man8/systemd-udevd.8.gz
/usr/share/man/man8/systemd-udevd.service.8.gz
/usr/share/man/man8/udevadm.8.gz
/usr/share/pkgconfig/udev.pc
/usr/share/vim/vim74/ftplugin/udevconf.vim
/usr/share/vim/vim74/ftplugin/udevperm.vim
/usr/share/vim/vim74/ftplugin/udevrules.vim
/usr/share/vim/vim74/syntax/udevconf.vim
/usr/share/vim/vim74/syntax/udevperm.vim
/usr/share/vim/vim74/syntax/udevrules.vim
/usr/share/zsh/site-functions/_udevadm
/var/cache/PackageKit/metadata/updates/packages/python3-pyudev-0.19.0-1.fc23.noarch.rpm
Same principle here : you should try to find the "-devel" package that contains the files that CMake is looking for (i.e the .so without a number appended at the end, and the header files)
Here the package you are looking for may be systemd-devel (udev library is now part of systemd)

Unable to generate makefile for basic PETSc program

I have a very basic program using PETSC
#include "PETSC/petsc.h"
#include "PETSC/petscsys.h"
#include "PETSC/petscmat.h"
int main(int argc, char *argv[]) {
PetscMPIInt rank,size;
PetscInitialize(&argc,&argv,0,0);
MPI_Comm_size(PETSC_COMM_WORLD,&size);
MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
PetscPrintf(PETSC_COMM_WORLD,"Number of processors = %d, rank = %d\n",size,rank);
PetscSynchronizedPrintf(PETSC_COMM_WORLD,"synchronized rank = %d\n",rank);
MPI_Barrier(PETSC_COMM_WORLD);
PetscFinalize();
return 0;
}
However, I got undefined reference errors to PETSC_COMM_WORLD, PetscInitialize and other junk, when I tried to compile using mpic++
I am now trying to use build and cmake. This is my attempt at a CMakeLists
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(checkMPI)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules")
set(PETSC_ARCH linux-gnu)
set(PETSC_DIR l${PROJECT_SOURCE_DIR}/third-party/petsc)
FIND_PACKAGE(PETSc REQUIRED)
INCLUDE_DIRECTORIES(${PETSC_INCLUDES})
ADD_DEFINITIONS(${PETSC_DEFINITIONS})
ADD_EXECUTABLE(checkMPI checkMPI.cpp)
TARGET_LINK_LIBRARIES(checkMPI ${PETSC_LIBRARIES})
In addition, I have a directory cmake-modules containing the cmake-modules for PETSc
However, when I try to generate the makefile by typing ccmake .. and then c, I get the output
CMake Error at cmake-modules/FindPETSc.cmake:127 (message):
The pair PETSC_DIR=l/directory/HPC/third-party/petsc
PETSC_ARCH=linux-gnu do not specify a valid PETSc installation
Call Stack (most recent call first):
CMakeLists.txt:10 (FIND_PACKAGE)
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108
(message):
PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH.
(missing: PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315
Anyone can help?
Based on FindPETSC.cmake it seems that the default options for PETSC_ARCH are:
linux-gnu-c-debug
linux-gnu-c-opt
x86_64-unknown-linux-gnu
i386-unknown-linux-gnu
or the one you have used in case of the manual build.
CMake tries to find file ${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h or
${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h.