conda-forge / boost-feedstock

A conda-smithy repository for boost.
BSD 3-Clause "New" or "Revised" License
15 stars 41 forks source link

CMake: Could NOT find Boost #185

Closed tdegeus closed 1 year ago

tdegeus commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

I'm not sure if this is strictly related to this feedstock.

I'm using some header-only math functions from Boost. I can just install libboost-headers. I still use the Boost::headers target, such that my library has a find_dependency(Boost REQUIRED) call. The FindBoost is I believe provided by CMake and not by this feedstock.

Yet on my Linux machine I keep getting an error

  CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find Boost (missing: Boost_INCLUDE_DIR)
  Call Stack (most recent call first):
    /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake/Modules/FindBoost.cmake:2344 (find_package_handle_standard_args)
    /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
    /home/tdegeus/miniforge3/envs/code_epm_jed/lib/cmake/prrng/prrngConfig.cmake:31 (find_dependency)
    CMakeLists.txt:42 (find_package)

Strangely I'm not getting this error in the equivalent CI : https://github.com/tdegeus/GooseEPM/actions/runs/7017121385/job/19089767396

Installed packages

conda list
# packages in environment at /home/tdegeus/miniforge3/envs/code_epm_jed:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
alabaster                 0.7.13             pyhd8ed1ab_0    conda-forge
autodocsumm               0.2.11             pyhd8ed1ab_0    conda-forge
babel                     2.13.1             pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hd590300_1    conda-forge
brotli-bin                1.1.0                hd590300_1    conda-forge
brotli-python             1.1.0           py312h30efb56_1    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
c-ares                    1.22.1               hd590300_0    conda-forge
ca-certificates           2023.11.17           hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2023.11.17         pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py312hf06ca03_0    conda-forge
cfgv                      3.3.1              pyhd8ed1ab_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
cmake                     3.27.8               hcfe8598_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda_envfile             0.4.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.2.0           py312h8572e83_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
deprecation               2.1.0              pyh9f0ad1d_0    conda-forge
distlib                   0.3.7              pyhd8ed1ab_0    conda-forge
distro                    1.8.0              pyhd8ed1ab_0    conda-forge
docopt                    0.6.2                      py_1    conda-forge
docutils                  0.17.1          py312h7900ff3_4    conda-forge
doxygen                   1.9.8                h661eb56_0    conda-forge
enstat                    0.9.7              pyhd8ed1ab_0    conda-forge
filelock                  3.13.1             pyhd8ed1ab_0    conda-forge
fonttools                 4.45.1          py312h98912ed_0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
ghostscript               10.02.1              h59595ed_0    conda-forge
goosehdf5                 0.26.1             pyhd8ed1ab_0    conda-forge
goosempl                  0.14.0             pyhd8ed1ab_0    conda-forge
gooseslurm                0.13.4             pyhd8ed1ab_0    conda-forge
h5glance                  0.8.1              pyhd8ed1ab_0    conda-forge
h5py                      3.10.0          nompi_py312h819072b_100    conda-forge
hdf5                      1.14.2          nompi_h4f84152_100    conda-forge
htmlgen                   2.0.0              pyhd8ed1ab_0    conda-forge
identify                  2.5.32             pyhd8ed1ab_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
imagesize                 1.4.1              pyhd8ed1ab_0    conda-forge
importlib-metadata        6.8.0              pyha770c72_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.5           py312h8572e83_1    conda-forge
krb5                      1.21.2               h659d440_0    conda-forge
lcms2                     2.15                 hb7c19ff_3    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libaec                    1.1.2                h59595ed_1    conda-forge
libblas                   3.9.0           20_linux64_openblas    conda-forge
libboost-headers          1.83.0               ha770c72_0    conda-forge
libbrotlicommon           1.1.0                hd590300_1    conda-forge
libbrotlidec              1.1.0                hd590300_1    conda-forge
libbrotlienc              1.1.0                hd590300_1    conda-forge
libcblas                  3.9.0           20_linux64_openblas    conda-forge
libcurl                   8.4.0                hca28451_0    conda-forge
libdeflate                1.19                 hd590300_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_3    conda-forge
libgfortran-ng            13.2.0               h69a702a_3    conda-forge
libgfortran5              13.2.0               ha4646dd_3    conda-forge
libgomp                   13.2.0               h807b86a_3    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           20_linux64_openblas    conda-forge
libnghttp2                1.58.0               h47da74e_0    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.25          pthreads_h413a1c8_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libsqlite                 3.44.2               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_3    conda-forge
libtiff                   4.6.0                ha9c0a0a_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.46.0               hd590300_0    conda-forge
libwebp-base              1.3.2                hd590300_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
markupsafe                2.1.3           py312h98912ed_1    conda-forge
mathjax                   3.2.2                ha770c72_0    conda-forge
matplotlib-base           3.8.2           py312he5832f3_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mv_regex                  0.3.0              pyhd8ed1ab_0    conda-forge
mycluster                 1.6                      pypi_0    pypi
ncurses                   6.4                  h59595ed_2    conda-forge
ninja                     1.11.1               h924138e_0    conda-forge
nodeenv                   1.8.0              pyhd8ed1ab_0    conda-forge
numpy                     1.26.2          py312heda63a1_0    conda-forge
openjpeg                  2.5.0                h488ebb8_3    conda-forge
openssl                   3.2.0                hd590300_1    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
parallel                  20231122             ha770c72_0    conda-forge
pdfcombine                1.1.5              pyhd8ed1ab_0    conda-forge
perl                      5.32.1          4_hd590300_perl5    conda-forge
pillow                    10.1.0          py312hf3581a9_0    conda-forge
pip                       23.3.1             pyhd8ed1ab_0    conda-forge
platformdirs              4.0.0              pyhd8ed1ab_0    conda-forge
pre-commit                3.5.0              pyha770c72_0    conda-forge
prettytable               3.9.0              pyhd8ed1ab_0    conda-forge
prrng                     1.12.0               h00ab1b0_3    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pybind11                  2.11.1          py312h8572e83_2    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pybind11-global           2.11.1          py312h8572e83_2    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.12.0          hab00c5b_0_cpython    conda-forge
python-cppcolormap        1.4.5           py312h5b9907d_1    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-gooseeye           0.8.0           py312h5b9907d_0    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pytz                      2023.3.post1       pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py312h98912ed_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rhash                     1.4.4                hd590300_0    conda-forge
scikit-build              0.17.6             pyh4af843d_0    conda-forge
scipy                     1.11.4          py312heda63a1_0    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.0.4              pyhd8ed1ab_0    conda-forge
setuptools_scm            8.0.4                hd8ed1ab_0    conda-forge
shelephant                0.24.0             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snowballstemmer           2.2.0              pyhd8ed1ab_0    conda-forge
sphinx                    5.0.0              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.7              pyhd8ed1ab_0    conda-forge
sphinxcontrib-devhelp     1.0.5              pyhd8ed1ab_0    conda-forge
sphinxcontrib-htmlhelp    2.0.4              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1              pyhd8ed1ab_0    conda-forge
sphinxcontrib-qthelp      1.0.6              pyhd8ed1ab_0    conda-forge
sphinxcontrib-serializinghtml 1.1.9              pyhd8ed1ab_0    conda-forge
termcolor                 2.3.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tqdm                      4.66.1             pyhd8ed1ab_0    conda-forge
typing-extensions         4.8.0                hd8ed1ab_0    conda-forge
typing_extensions         4.8.0              pyha770c72_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ukkonen                   1.0.1           py312h8572e83_4    conda-forge
urllib3                   2.1.0              pyhd8ed1ab_0    conda-forge
virtualenv                20.24.7            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.12             pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xsimd                     10.0.0               h924138e_0    conda-forge
xtensor                   0.24.7               h00ab1b0_0    conda-forge
xtensor-python            0.26.1          py312hfb10629_2    conda-forge
xtl                       0.7.5                hf52228f_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zstd                      1.5.5                hfc55251_0    conda-forge

Environment info

conda info

     active environment : code_epm_jed
    active env location : /home/tdegeus/miniforge3/envs/code_epm_jed
            shell level : 2
       user config file : /home/tdegeus/.condarc
 populated config files : /home/tdegeus/miniforge3/.condarc
                          /home/tdegeus/.condarc
          conda version : 23.10.0
    conda-build version : not installed
         python version : 3.11.6.final.0
       virtual packages : __archspec=1=icelake
                          __glibc=2.28=0
                          __linux=4.18.0=0
                          __unix=0=0
       base environment : /home/tdegeus/miniforge3  (writable)
      conda av data dir : /home/tdegeus/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/tdegeus/miniforge3/pkgs
                          /home/tdegeus/.conda/pkgs
       envs directories : /home/tdegeus/miniforge3/envs
                          /home/tdegeus/.conda/envs
               platform : linux-64
             user-agent : conda/23.10.0 requests/2.31.0 CPython/3.11.6 Linux/4.18.0-348.23.1.el8_5.x86_64 rhel/8.5 glibc/2.28 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.3
                UID:GID : 177478:10532
             netrc file : None
           offline mode : False
h-vetinari commented 1 year ago

The answer is simply that libboost-headers does not contain the CMake metadata, which is in libboost-devel.

tdegeus commented 1 year ago

From this feedstock's perspective, I agree. Yet:

  1. I would say that I would not need Boost's CMake files. It should suffice to use the default https://cmake.org/cmake/help/latest/module/FindBoost.html
  2. Since I'm not linking against Boost I would really like to not depend on libboost-devel

Again, it is a bit of a vague issue because my CI is simply passing by using https://cmake.org/cmake/help/latest/module/FindBoost.html . Yet, I cannot figure out what the installation-specific issue could be.

h-vetinari commented 1 year ago

There are different ways to "find" boost, and because boost is so ubiquitous, CMake even has its own FindBoost function (which actually gets preferred over our metadata, unless you do find_package(boost CONFIG)). In particular, certain detection mechanisms will be happy enough with finding the right headers somewhere, and deducing the rest from that.

I cannot tell what's happening in your specific situation, but you can ensure that your $PREFIX is set correctly, and if that fails, it's really not a big deal to depend on libboost-devel. Effectively, that's all that existed before the recent refactor, and if you want to avoid the run-export, you can do either of

ignore_run_exports_from:
  - libboost-devel

or

ignore_run_exports:
  - libboost

(both are equivalent, their only difference is if they are addressing the run-exporteR or the run-exporteE)

Finally, I get that this is not an amazing setup. We'd like to have CMake metadata even just for the headers. But that's a bit complicated with how CMake metadata is all in the same set of files, and we can't split them well across different packages.

tdegeus commented 1 year ago

Thanks for the tips. Like you say, it would have been ideal to separate CMake header-only support, but that is rather an upstream request.

As to my non-reproducible issue: I'll do some more investigating, hopefully I will find out.

tdegeus commented 1 year ago

For documentation purposes:

I did come across a reproducer : https://readthedocs.org/projects/gooseeye/builds/22752796/ . It seems that there may be a naming inconsistency somewhere upstream. The complaint is

Could NOT find Boost (missing: Boost_INCLUDE_DIR)

Indeed https://cmake.org/cmake/help/latest/module/FindBoost.html mentions Boost_INCLUDE_DIRS (notice the plural). I cannot really figure out who made a 'mistake' and why this lets my CMake fail.

cc @h-vetinari