Code Monkey home page Code Monkey logo

Comments (7)

stiobhan avatar stiobhan commented on August 30, 2024 1

In my case adding

target_include_directories(chap PUBLIC ${Boost_INCLUDE_DIRS})

in CMakeLists.txt and

target_include_directories(runAllTests PUBLIC ${Boost_INCLUDE_DIRS})

in test/CMakeLists.txt fixes the problems I've seen. I'm compiling on Ubuntu 18.04 with GCC 7.

from chap.

yongwangCPH avatar yongwangCPH commented on August 30, 2024

I also have the same problem when I compiled CHAP in my mac, even that I tried to specify BOOST path by:

cmake .. -DBOOST_ROOT=/usr/local/Cellar/boost/1.69.0/ -DBOOST_INCLUDEDIR=/usr/local/Cellar/boost/1.69.0/include/

The errors I got is:

In file included from /Users/wyong/Work/Softwares/chap-version_0_8_0/src/geometry/spline_curve_1D.cpp:29:
/usr/local/Cellar/boost/1.69.0/include/boost/math/tools/minima.hpp:15:10: fatal error:
'boost/config/no_tr1/cmath.hpp' file not found
#include <boost/config/no_tr1/cmath.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/chap.dir/src/geometry/spline_curve_1D.cpp.o] Error 1
make[1]: *** [CMakeFiles/chap.dir/all] Error 2
make: *** [all] Error 2

from chap.

Inniag avatar Inniag commented on August 30, 2024

Thanks for pointing out this issue! I've so far only installed/tested CHAP with dependencies in standard install paths and so haven't come across this problem yet.

I think it is due to CMake not telling the compiler where to find the Boost headers. If those are in a standard location, gcc will pick them up anyway, otherwise compilation fails as you describe.

What should fix this is to add

target_include_directories(chap PUBLIC ${Boost_INCLUDE_DIRS})

to CMakeLists.txt (in line 157, just before linking to the Boost library). A similar addition may be necessary in CMakeLists.txt in the test subdirectory.

If you can confirm that this fixes the problem, I should be able to patch this quickly.

from chap.

yongwangCPH avatar yongwangCPH commented on August 30, 2024

Thanks for the help. It seems helpful by adding "target_include_directories(chap PUBLIC ${Boost_INCLUDE_DIRS})" in CMakeLists.txt. But now I got new errors:

In file included from /Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:54:
In file included from /Users/wyong/Work/Softwares/chap-version_0_9_1/include/statistics/amise_optimal_bandwidth_estimator.hpp:36:
/Users/wyong/Work/Softwares/chap-version_0_9_1/include/statistics/gaussian_density_derivative.hpp:25:9: warning:
'GAUSSIAN_DENSITY_DERIVATIVE_HPP' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef GAUSSIAN_DENSITY_DERIVATIVE_HPP
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/wyong/Work/Softwares/chap-version_0_9_1/include/statistics/gaussian_density_derivative.hpp:26:9: note:
'GAUSSIAN_DENSITY_DERUVATIVE_HPP' is defined here; did you mean 'GAUSSIAN_DENSITY_DERIVATIVE_HPP'?
#define GAUSSIAN_DENSITY_DERUVATIVE_HPP
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GAUSSIAN_DENSITY_DERIVATIVE_HPP
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:24: error: non-constant-expression
cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:24: note: insert an explicit cast to
silence this issue
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
static_cast( )
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:38: error: non-constant-expression
cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:38: note: insert an explicit cast to
silence this issue
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
static_cast( )
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:52: error: non-constant-expression
cannot be narrowed from type 'double' to 'float' in initializer list [-Wc++11-narrowing]
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:87:52: note: insert an explicit cast to
silence this issue
pfInitProbePos_ = {std::nan(""), std::nan(""), std::nan("")};
^~~~~~~~~~~~
static_cast( )
In file included from /Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:644:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2335:5: warning: delete called on
'AbstractPathFinder' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
delete __ptr;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2648:7: note: in instantiation of
member function 'std::__1::default_delete::operator()' requested here
_ptr.second()(__tmp);
^
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:959:13: note: in instantiation of member
function 'std::__1::unique_ptr<AbstractPathFinder, std::_1::default_delete >::reset' requested here
pfm.reset(new InplaneOptimisedProbePathFinder(pfPar
,
^
In file included from /Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:644:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2335:5: warning: delete called on
'AbstractDensityEstimator' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor]
delete __ptr;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:2648:7: note: in instantiation of
member function 'std::__1::default_delete::operator()' requested here
_ptr.second()(__tmp);
^
/Users/wyong/Work/Softwares/chap-version_0_9_1/src/trajectory-analysis/chap_trajectory_analysis.cpp:1314:26: note: in instantiation of
member function 'std::__1::unique_ptr<AbstractDensityEstimator, std::__1::default_delete >::reset' requested
here
densityEstimator.reset(new HistogramDensityEstimator());
^
10 warnings and 3 errors generated.
make[2]: *** [CMakeFiles/chap.dir/src/trajectory-analysis/chap_trajectory_analysis.cpp.o] Error 1
make[1]: *** [CMakeFiles/chap.dir/all] Error 2
make: *** [all] Error 2

from chap.

Inniag avatar Inniag commented on August 30, 2024

Thanks for the quick feedback, I'll try to get an official patch ready asap.

@yongwangCPH, your issue now seems to be something completely different and I suspect it originates from using a different compiler version or different compiler settings from what @stiobhan and I are using. Could you provide your OS and compiler versions?

from chap.

yongwangCPH avatar yongwangCPH commented on August 30, 2024

I am using MacOS Mojave and AppleClang 10.0.1 compiler. I also pasted the cmake command as below:

cmake ../ -DLAPACKE_CBLAS_INCLUDE_DIR=/usr/local/opt/lapack/include -DCMAKE_PREFIX_PATH=/Users/wyong/Work/Softwares/GMX2016.5/share/cmake/gromacs_mpi/ -DBOOST_ROOT=/usr/local/Cellar/boost/1.69.0/ -DBOOST_INCLUDEDIR=/usr/local/Cellar/boost/1.69.0/include/ -DBOOST_LIBRARYDIR=/usr/local/Cellar/boost/1.69.0/lib/

from chap.

Inniag avatar Inniag commented on August 30, 2024

@yongwangCPH , I think what you are seeing is a new problem separate from the BOOST library. Could you perhaps create a separate issue for this?

I've never worked with MacOS or the Clang compiler, so this is a bit of a guess: Most of the output that you posted is just warnings that can probably be safely ignored (the header guard issue is an easily fixable typo). The only proper error that stops Clang from finishing is the narrowing conversion, but that too sounds like a rather strict interpretation of the C++ standard as NaN should be the same for float and double (and gcc seems fine with it). So my hope would be that there is a Clang compiler flag that makes it treat -Wc++11-narrowing as a warning rather than an error.

from chap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.