Open Midnighter opened 4 years ago
I encountered this issue too. I think it is the cmake binary itself that is causing the problem. I can compile/install as I expect for a range of versions of cmake but for a conda distributed cmake binaries I can trigger this failure for header include directories. This error occurs inside and outside of the conda build environment. More specifically I observe this for cmake version 3.14.0 on the default channel and for the conda-forge channel 3.13.4 >= broken < 3.17.0.
Currently fixes include:
It looks like you can't set the channel within the yaml file but you can build with something along the lines of conda build -c conda-forge .
EDIT: I do not know the intended behavior so calling it "broken" may be a misnomer
I think that this issue is similar to https://github.com/conda-forge/cmake-feedstock/issues/129, but related to implicit include directories. If I print CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES
in the same system described in that issue, I get:
-- CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: /home/traversaro/miniconda3/envs/cmake-tests/include;/home/traversaro/miniconda3/envs/cmake-tests/x86_64-conda-linux-gnu/include/c++/9.3.0;/home/traversaro/miniconda3/envs/cmake-tests/x86_64-conda-linux-gnu/include/c++/9.3.0/x86_64-conda-linux-gnu;/home/traversaro/miniconda3/envs/cmake-tests/x86_64-conda-linux-gnu/include/c++/9.3.0/backward;/home/traversaro/miniconda3/envs/cmake-tests/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include;/home/traversaro/miniconda3/envs/cmake-tests/lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed;/home/traversaro/miniconda3/envs/cmake-tests/x86_64-conda-linux-gnu/include;/home/traversaro/miniconda3/envs/cmake-tests/x86_64-conda-linux-gnu/sysroot/usr/include
But if I try to check the actual default include directories of the compiler, I get:
#include "..." search starts here:
#include <...> search starts here:
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/include/c++/9.3.0
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/include/c++/9.3.0/x86_64-conda-linux-gnu
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/include/c++/9.3.0/backward
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/include
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/include-fixed
/home/traversaro/miniconda3/envs/cmake-tests/bin/../lib/gcc/x86_64-conda-linux-gnu/9.3.0/../../../../x86_64-conda-linux-gnu/include
/home/traversaro/miniconda3/envs/cmake-tests/bin/../x86_64-conda-linux-gnu/sysroot/usr/include
End of search list.
This means that any call to include_directories("/home/traversaro/miniconda3/envs/cmake-tests/include")
would be ignored, even if /home/traversaro/miniconda3/envs/cmake-tests/include
is not considered by default by the compiler.
Is this still an issue?
Is this still an issue?
Yes, I think I've just ran into the same problem in a personal project and googling a bit (I didn't test the example though).
@ntorresalberto do you have a minimal reproducer that you can share? 🙂
@ntorresalberto do you have a minimal reproducer that you can share? slightly_smiling_face
I apologize for the delay and for the bad info. You were very sharp to request a minimal reproducer because now I don't think I can. I'm not sure what went wrong in my first tries before, but if I ever find out I'll report back.
I encountered this issue too. I think it is the cmake binary itself that is causing the problem. I can compile/install as I expect for a range of versions of cmake but for a conda distributed cmake binaries I can trigger this failure for header include directories. This error occurs inside and outside of the conda build environment. More specifically I observe this for cmake version 3.14.0 on the default channel and for the conda-forge channel 3.13.4 >= broken < 3.17.0.
Currently fixes include:
- set the cmake version according to your version/channel needs
It looks like you can't set the channel within the yaml file but you can build with something along the lines of
conda build -c conda-forge .
EDIT: I do not know the intended behavior so calling it "broken" may be a misnomer
I found a similar behavior with cmake 3.20 in a conda environment. On my makefile I had
find_package(Boost REQUIRED COMPONENTS program_options)
include_directories(${Boost_INCLUDE_DIRS})
and I was getting a "boost/program_options.hpp" not found even after a conda install boost
. After I downgraded to v3.12, my project compiled normally.
I had the same error as @willian-m using cmake 2.24 in a conda environment: Boost wasn't found despite doing
include_directories(${Boost_INCLUDE_DIRS})
find_package(Boost REQUIRED COMPONENTS program_options)
A simple
unset CXX_FLAGS
solved it for me. Apparantly cmake checks if the include directory exists in $CXX_FLAGS
and if yes, does not include it.
Going to close this issue. Please open a new one with the required information and a minimal reproducer.
You have a reproducible example in my original post, no?
@Midnighter, would you be able to give a minimal reproducer instead of the complex reproducer you have here?
I'll try. Plenty of other things on my plate now so it will take me a bit.
Still same issue here with cmake 3.24.1. The missing path is indeed in CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES : 08:45:52 -- CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: libraries/python-3.8.0/include/python3.8 which is NOT used/added when calling g++ so compilation error. tbc.
Issue:
I'm trying to build a Python package that uses cmake, pybind11, GLPK, and SUNDIALS. Within the linked repository you can see that I can build a ubuntu based Docker image just fine. However, when I try to do the same within a conda environment compilation fails because the include directories are not added correctly to the compilation commands.
Steps to reproduce:
I have created an isolated conda environment with:
which uses
.condarc
and
environment.yml
Once you run the Docker image, activate the environment with
conda activate /home/dunamis/.dfba
, then download the packagecurl -O https://gitlab.com/davidtourigny/dynamic-fba/-/archive/master/dynamic-fba-master.tar.gz
. Extract the source and check compiler arguments:You should see that only
-I/home/dunamis/.dfba/include/python3.7m
is in the compiler arguments. If you edit theCMakeLists.txt
file and change theinclude_directories
command toadd_compile_options("-I${GLPK_INCLUDE_DIR}")
this is added and the package compiles correctly.Do you have any idea what could cause these different behaviours?
Environment (
conda list
):Details about
conda
and system (conda info
):