halasadi / MAPS

software for the MAPS method
MIT License
24 stars 6 forks source link

habitat.cpp #11

Closed jgiemza closed 6 years ago

jgiemza commented 6 years ago

Hi, I am still not finished with "make".

habitat.cpp: In member function ‘void Habitat::generate_outer(const string&)’:
habitat.cpp:27:10: error: ‘is_valid’ is not a member of ‘boost::geometry’
     if (!boost::geometry::is_valid(domain)) {
          ^
make: *** [habitat.o] Error 1

Any idea how to deal with that ?

halasadi commented 6 years ago

Hmm, are you using boost version 1.57?

jgiemza commented 6 years ago

I believe I do. I installed this version of boost in conda environment and updated BOOST_LIB and BOOST_INC paths in the Makefile.

pcarbo commented 6 years ago

@jgiemza Can you please share with us the output of running make? It would be useful to see the exact commands and options that are being run. In particular, I'm wondering if multiple versions of Boost include files are in your include path. Also, please tell us what OS you are using, and the C++ compiler version (gcc, etc).

halasadi commented 6 years ago

Yes, would be nice to see your Makefile.

Here are the paths in my Makefile,

EIGEN_INC = /Users/halasadi/anaconda/envs/MAPS/include/eigen3 BOOST_LIB = /Users/halasadi/anaconda/envs/MAPS/lib BOOST_INC = /Users/halasadi/anaconda/envs/MAPS/include/boost

Can you change the /Users/halasadi to the correct corresponding path in your computer?

pcarbo commented 6 years ago

@halasadi Actually it is better to see the output of running make, because this gives more directly the information we want, but see the Makefile as well can't hurt.

jgiemza commented 6 years ago

Hi,

Make output:

g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c runeems2.cpp -o runeems2.o
g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c eems2.cpp -o eems2.o
g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c util.cpp -o util.o
g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c mcmc.cpp -o mcmc.o
g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c draw.cpp -o draw.o
g++ -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost -I/sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3 -O3 -DNDEBUG -O3 -c habitat.cpp -o habitat.o
habitat.cpp: In member function ‘void Habitat::generate_outer(const string&)’:
habitat.cpp:27:10: error: ‘is_valid’ is not a member of ‘boost::geometry’
     if (!boost::geometry::is_valid(domain)) {
          ^
make: *** [habitat.o] Error 1

packages in my conda environment:

conda list
# packages in environment at /sandbox/users/giemza-j/miniconda3/envs/MAPS:
#
boost                     1.57.0                        4  
eigen                     3.3.3                h5721d7b_0  
icu                       58.2                 h9c2bf20_1  
libgcc-ng                 7.2.0                h7cc24e2_2  
libstdcxx-ng              7.2.0                h7a57d05_2  

Makefile:

EIGEN_INC = /sandbox/users/giemza-j/miniconda3/envs/MAPS/include/eigen3
BOOST_LIB = /sandbox/users/giemza-j/miniconda3/envs/MAPS/lib
BOOST_INC = /sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost

EXE = runeems2
OBJ = runeems2.o eems2.o util.o mcmc.o draw.o habitat.o graph.o

CXXFLAGS = -I${BOOST_INC} -I${EIGEN_INC} -O3 -DNDEBUG -O3
LDFLAGS = -L${BOOST_LIB} \
        -lboost_system \
        -lboost_program_options \
        -lboost_filesystem

$(EXE): $(OBJ)
        $(CXX) $(CXXFLAGS) -o $(EXE) $^ $(LDFLAGS)

$(OBJ): %.o: %.cpp
        $(CXX) $(CXXFLAGS) -c $< -o $@

.PHONY: clean
clean:
        rm -f $(OBJ) $(EXE) *~

Thanks !

halasadi commented 6 years ago

I think an error (in my original instructions),

try changing

BOOST_INC = /sandbox/users/giemza-j/miniconda3/envs/MAPS/include/boost

to

BOOST_INC = /sandbox/users/giemza-j/miniconda3/envs/MAPS/include

I tried to reproduce this, and I got it to work by

EIGEN_INC = /home/halasadi/anaconda3/include/eigen3
BOOST_INC = /home/halasadi/anaconda3/include
BOOST_LIB = /home/halasadi/anaconda3/include

Not sure why..

Can you try both and report what you get?

(also update to the most version MAPS, I just made a few changes)

pcarbo commented 6 years ago

@jgiemza @halasadi The general point here is that the Boost include files (e.g., version.hpp) should be found in $(BOOST_INC)/boost. I would check that they are indeed there. Same for the Eigen include files.

It is confusing in your case because you have multiple versions of Boost installed on your computer, and it is probably finding the default version when it can't find the include files for Boost 1.57.

halasadi commented 6 years ago

@jgiemza please the updated README for instructions on how to install MAPS