mutationpp / Mutationpp

The MUlticomponent Thermodynamic And Transport library for IONized gases in C++
GNU Lesser General Public License v3.0
103 stars 58 forks source link

Silence Eigen3 error in cmake #195

Open Gianni-NCSU opened 2 years ago

Gianni-NCSU commented 2 years ago
My OS is Linux

OS Version: NAME="Fedora Linux" VERSION="35 (Workstation Edition)" ID=fedora VERSION_ID=35 VERSION_CODENAME="" PLATFORM_ID="platform:f35" PRETTY_NAME="Fedora Linux 35 (Workstation Edition)" ANSI_COLOR="0;38;2;60;110;180" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:35" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" REDHAT_BUGZILLA_PRODUCT_VERSION=35 REDHAT_SUPPORT_PRODUCT="Fedora" REDHAT_SUPPORT_PRODUCT_VERSION=35 PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy" VARIANT="Workstation Edition" VARIANT_ID=workstation

**Cmake Version:** cmake version 3.22.1 **`uname -a` output**
Linux DESKTOP-DS49QDR 5.15.13-200.fc35.x86_64 #1 SMP Wed Jan 5 16:39:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

env output

``` Linux DESKTOP-DS49QDR 5.15.13-200.fc35.x86_64 #1 SMP Wed Jan 5 16:39:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux [gabsillis@DESKTOP-DS49QDR ~]$ env SHELL=/bin/bash SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/2183,unix/unix:/tmp/.ICE-unix/2183 COLORTERM=truecolor HISTCONTROL=ignoredups XDG_MENU_PREFIX=gnome- HISTSIZE=1000 HOSTNAME=DESKTOP-DS49QDR SSH_AUTH_SOCK=/run/user/1000/keyring/ssh XMODIFIERS=@im=ibus DESKTOP_SESSION=gnome EDITOR=/usr/bin/nano PWD=/home/gabsillis LOGNAME=gabsillis XDG_SESSION_DESKTOP=gnome XDG_SESSION_TYPE=wayland MODULESHOME=/usr/share/Modules MANPATH=/usr/share/man: SYSTEMD_EXEC_PID=2218 XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.M4HZF1 GDM_LANG=en_US.UTF-8 HOME=/home/gabsillis USERNAME=gabsillis LANG=en_US.UTF-8 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36: XDG_CURRENT_DESKTOP=GNOME VTE_VERSION=6602 WAYLAND_DISPLAY=wayland-0 GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/fea870ad_1c50_4faa_8a42_94497341af26 MOZ_GMP_PATH=/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed GNOME_SETUP_DISPLAY=:1 XDG_SESSION_CLASS=user TERM=xterm-256color LESSOPEN=||/usr/bin/lesspipe.sh %s USER=gabsillis GNOME_TERMINAL_SERVICE=:1.237 MODULES_RUN_QUARANTINE=LD_LIBRARY_PATH LD_PRELOAD LOADEDMODULES= DISPLAY=:0 SHLVL=1 QT_IM_MODULE=ibus XDG_RUNTIME_DIR=/run/user/1000 DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/ which_declare=declare -f XDG_DATA_DIRS=/home/gabsillis/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop PATH=/home/gabsillis/.local/bin:/home/gabsillis/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin MODULEPATH=/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles GDMSESSION=gnome DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus MAIL=/var/spool/mail/gabsillis MODULES_CMD=/usr/share/Modules/libexec/modulecmd.tcl BASH_FUNC_ml%%=() { module ml "$@" } BASH_FUNC_which%%=() { ( alias; eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" } BASH_FUNC_module%%=() { _module_raw "$@" 2>&1 } BASH_FUNC__module_raw%%=() { eval `/usr/bin/tclsh /usr/share/Modules/libexec/modulecmd.tcl bash "$@"`; _mlstatus=$?; return $_mlstatus } _=/usr/bin/env ``` **Mutation++ origin**
git clone https://github.com/mutationpp/Mutationpp.git
cd eigen
mkdir build
cd build
cmake ..
sudo make install

Mutation++ build steps

  1. Install Eigen from source git clone https://gitlab.com/libeigen/eigen.git mkdir cd eigen
  2. Build Mutation with cmake Enter the newly cloned repository
    mkdir build
    cd build
    cmake ..

    Then the error occurs Mutation++ cmake output

    ``` -- The CXX compiler identification is GNU 11.2.1 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Searching for Eigen3... -- Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIRS) -- Configuring done -- Generating done -- Build files have been written to: /tmp/Mutationpp/build ```

Comments

In the find package command add the NO_MODULE or equivalently CONFIG flag to not have this error occur.

find_package(Eigen3 NO_MODULE)

or

find_package(Eigen3 CONFIG)
rdbisme commented 2 years ago

Hello, why would you like to silence the error? Can you please edit your post with the steps you took to build Mutation++? The one you listed are partial and wrong (cd eigen?). Also, you are not passing correctly the path to your self-compiled Eigen3, so the script is compiling it from the vendored version.

Also find_package(Eigen3 CONFIG) is already used in the custom FindEigen3.cmake module that is used to allow automatic taking into account the vendored dependencies (practice I'm not so happy about)

Can you please tell me what's your problem and what are you trying to achieve? The cmake script should error if Eigen3 is not found and I don't think it should be silenced.

Gianni-NCSU commented 2 years ago

Hello. I was unaware there were custom find_package modules, sorry for the confusion. My problem was that with a system level installation of Eigen your FindEigen3.cmake would treat it as if Eigen was not found.

I found a solution to my problem: in your module FindEigen3.cmake you check for Eigen3_FOUND but Eigen seems to set EIGEN3_FOUND instead: https://stackoverflow.com/questions/42902922/cmake-finds-eigen-library-but-does-not-mark-with-found

Changing that on lines 47, 64, and 74 fixed my problem. As a side note, before this fix, the find_path location did find signature_of_eigen3_matrix_library but then doesn't set the EIGEN3_INCLUDE_DIRS correctly on my system. I wasn't able to fully figure out what was happening there.

rdbisme commented 2 years ago

I'm still not convinced. This is how I compiled against a self-compiled Eigen version:

asciicast

Gianni-NCSU commented 2 years ago

I followed those same steps on my machine and get the error. asciicast

rdbisme commented 2 years ago

I think you're missing a make install after the cmake when building eigen3, aren't you?

Gianni-NCSU commented 2 years ago

I've fixed the recording, unfortunately I still get the error. asciicast

rdbisme commented 2 years ago

Before "building" eigen3, switch to the latest tag: git checkout 3.4.0