OPM / opm-common

Common components for OPM, in particular build system (cmake).
http://www.opm-project.org
GNU General Public License v3.0
31 stars 112 forks source link

Unknown CMake command "python3_add_library" #3475

Closed carlosal1015 closed 1 year ago

carlosal1015 commented 1 year ago

Hi, I am not sure if the issue belong here or is a pybind's downstream issue, but point to the line 406 and I am leaving this record.

$ cmake -S opm-common-release-2023.04-rc1 -B build-cmake
==> Retrieving sources...
  -> Downloading opm-common-release-2023.04-rc1.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 3877k    0 3877k    0     0  3326k      0 --:--:--  0:00:01 --:--:-- 3873k
100 9948k    0 9948k    0     0  4595k      0 --:--:--  0:00:02 --:--:-- 4974k
100 13.3M    0 13.3M    0     0  4310k      0 --:--:--  0:00:03 --:--:-- 4544k
100 14.9M    0 14.9M    0     0  4351k      0 --:--:--  0:00:03 --:--:-- 4565k
==> Validating source files with sha512sums...
    opm-common-release-2023.04-rc1.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting opm-common-release-2023.04-rc1.tar.gz with bsdtar
==> Starting build()...
-- The C compiler identification is GNU 12.2.1
-- The CXX compiler identification is GNU 12.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/sbin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/sbin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at cmake/Modules/Findopm-tests.cmake:26 (message):
  opm-tests not found - integration tests using opm-tests will be skipped.
Call Stack (most recent call first):
  CMakeLists.txt:62 (include)

-- Performing Test HAVE_C99
-- Performing Test HAVE_C99 - Success
-- Found C99: -std=c99  
-- Could NOT find Valgrind (missing: VALGRIND_INCLUDE_DIR VALGRIND_PROGRAM) 
-- Found Boost: /usr/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.44.0") found components: system unit_test_framework 
-- Performing Test HAVE_CJSON
-- Performing Test HAVE_CJSON - Success
-- Found cjson: /usr/include/cjson  
-- Performing Test QuadMath_COMPILES
-- Performing Test QuadMath_COMPILES - Success
-- Found QuadMath: (Supported by compiler)  
-- Found Python3: /usr/sbin/python3.10 (found version "3.10.10") found components: Interpreter 
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- Found pybind11: /usr/include (found version "2.10.4")
-- Performing Test HAVE_ATTRIBUTE_ALWAYS_INLINE
-- Performing Test HAVE_ATTRIBUTE_ALWAYS_INLINE - Success
-- Performing Test HAS_ATTRIBUTE_UNUSED
-- Performing Test HAS_ATTRIBUTE_UNUSED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED
-- Performing Test HAS_ATTRIBUTE_DEPRECATED - Success
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG
-- Performing Test HAS_ATTRIBUTE_DEPRECATED_MSG - Success
-- CMake version: 3.26.3
-- Linux distribution: Arch Linux
-- Target architecture: x86_64
-- Found Git: /usr/sbin/git (found version "2.40.0") 
-- Source code repository: not found!
-- GNU C++ compiler version: 12.2.1 20230201
-- Linker: ld 2.40
Processing opm_defaults opm-common
-- Checking to see if CXX compiler accepts flag -Wl,--enable-new-dtags
-- Checking to see if CXX compiler accepts flag -Wl,--enable-new-dtags - yes
-- Precompiled headers: disabled
-- Build type: None
-- Checking to see if CXX compiler accepts flag -mtune=native
-- Checking to see if CXX compiler accepts flag -mtune=native - yes
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Checking to see if CXX compiler accepts flag -pthread
-- Checking to see if CXX compiler accepts flag -pthread - yes
-- Could NOT find CppCheck (missing: CPPCHECK_PROGRAM) 
-- Disabling clang-check as CMAKE_EXPORT_COMPILE_COMMANDS is not enabled
-- Could NOT find Valgrind (missing: VALGRIND_INCLUDE_DIR VALGRIND_PROGRAM) 
-- Generating debug symbols: -ggdb3
-- Looking for strip utility
-- Looking for strip utility - found
-- Performing Test HAVE_DYNAMIC_BOOST_TEST
-- Performing Test HAVE_DYNAMIC_BOOST_TEST - Success
-- Writing config file "/tmp/makepkg/opm-common/src/build-cmake/config.h"...
-- This build defaults to installing in /usr
-- Checking whether the file system is case-sensitive
-- File system is case-sensitive
-- Found Doxygen: /usr/sbin/doxygen (found version "1.9.6") found components: doxygen dot 
-- Writing version information to local header project-version.h
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Found BLAS: /usr/lib/libblas.so  
-- Looking for cheev_
-- Looking for cheev_ - not found
-- Looking for cheev_
-- Looking for cheev_ - found
-- Found LAPACK: /usr/lib/liblapack.so;/usr/lib/libblas.so  
-- Performing Test HAVE_CXA_DEMANGLE
-- Performing Test HAVE_CXA_DEMANGLE - Success
-- Found MPI_C: /usr/lib/libmpi.so (found version "3.1") 
-- Found MPI_CXX: /usr/lib/libmpi_cxx.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
-- Found GMP: /usr/lib/libgmpxx.so  
-- Found dune-common: /usr/include  
-- Looking for MPI_Finalized
-- Looking for MPI_Finalized - found
-- Version 2.9.0 of dune-common from /usr/lib/cmake/dune-common
CMake Error at /usr/lib/cmake/pybind11/pybind11NewTools.cmake:189 (python3_add_library):
  Unknown CMake command "python3_add_library".
Call Stack (most recent call first):
  CMakeLists.txt:406 (pybind11_add_module)

-- Configuring incomplete, errors occurred!
==> ERROR: A failure occurred in build().
    Aborting...
==> Removing installed dependencies...
checking dependencies...
:: gettext optionally requires git: for autopoint infrastructure updates
:: glib2 optionally requires python: gdbus-codegen, glib-genmarshal, glib-mkenums, gtester-report
:: glibc optionally requires gd: for memusagestat
:: groff optionally requires netpbm: for use together with man -H command interaction in browsers
:: groff optionally requires libxaw: for gxditview
:: iproute2 optionally requires python: for routel
:: libevent optionally requires python: event_rpcgen.py
:: libxml2 optionally requires python: Python bindings
:: systemd optionally requires python: Unified Kernel Image with ukify
:: util-linux optionally requires python: python bindings to libmount
warning: dependency cycle detected:
warning: harfbuzz will be removed after its freetype2 dependency

Relevant information

Related links

blattms commented 1 year ago

Mmh, we actually do search for both components. Dune seems to to do the same. I am a bit clueless.

Would you please run CMake with the --trace option to see where the calls happen.

blattms commented 1 year ago

Ok. It only found the interpreter:

Found Python3: /usr/sbin/python3.10 (found version "3.10.10") found components: Interpreter

I guess the least we can do is to check if Development component was found. We still need to see where the call comes from, as inside OPM we use REQUIRED COMPONENTS. DUNE skips the REQUIRED, though.

carlosal1015 commented 1 year ago

Would you please run CMake with the --trace option to see where the calls happen

Appending --trace shows the following output.

blattms commented 1 year ago

Thanks. As it turns out the search is triggered by OPM. The problem is that recent versions with file pybind11NewTools.cmake need the development component even if we just use pybind11_add_module and don't activate embedded python.

I have created a PR #3478 that should fix this. Would be good if you could test that. A workaround for the problem would be to activate embedded python with passing the -DPM_ENABLE_EMBEDDED_PYTHON=ON command line option to cmake. That will also do the search.

carlosal1015 commented 1 year ago

Thanks, the issue was solved from my side.

Taking the source

source=(${pkgbase}-release-${pkgver}-rc1.tar.gz::${url}/archive/release/${pkgver}/rc1.tar.gz
  pybind11.patch::${url}/pull/3478.patch)

with the patch is sufficient to do the upgrade.

cd ${pkgbase}-release-${pkgver}-rc1
patch -p1 -i ../pybind11.patch

For completeness, providing some logs with the patch.

blattms commented 1 year ago

Thanks a lot :+1: I really like power (linux) users like you. Out of curiosity: Are you (officially) packaging OPM for arch linux?

carlosal1015 commented 1 year ago

Since last year I am a normal user as package mantainer in the sense of Arch terminology and not officially in the sense we do not distribute the binaries in the official repositories and claims this caution about the AUR.

Warning: AUR packages are user-produced content. These PKGBUILDs are completely unofficial and have not been thoroughly vetted. Any use of the provided files is at your own risk.

But, we distribute some dune-modules as signed packages (binaries) in this third-party repository and eventually we will add opm-modules too if you agree.

blattms commented 1 year ago

But, we distribute some dune-modules as signed packages (binaries) in this third-party repository and eventually we will add opm-modules too if you agree.

Cool. The more distributions we are in, the merrier. I don't see a reason why anybody should not appreciate that. Thanks a lot for this work to you and your colleagues.

On the Debian side we usually have some additional patches that might not make it to master. See e.g. file below debian/patches in opm-common and the other repos there.