cbg-ethz / MC-CBN

MC-CBN performs large-scale inference on conjunctive Bayesian networks
GNU General Public License v2.0
4 stars 3 forks source link

Compilation fails with libboost 1.74 #5

Closed rdiaz02 closed 1 year ago

rdiaz02 commented 3 years ago

Hi,

When trying to install on Linux systems with libboost 1.74 compilation fails. I can see errors like

model_impl.cpp:132:67: error: ‘_1’ was not declared in this scope
                             boost::detail::subscript(topo_order), _1),

model_impl.cpp:134:69: error: ‘_2’ was not declared in this scope
                               boost::detail::subscript(topo_order), _2)));

which suggest a problem with libboost. Compilation succeeds on an older Debian system with libboost 1.67 and an Ubuntu system with libboost 1.65.

(Compilation failing with libboost 1.74 makes installation in newer systems much harder).

sposadac commented 3 years ago

Hi Ramon,

Thank you very much for reporting this issue. Could you compile the package with an older version of the boost libraries for the time being? I briefly looked at it, but it is not obvious to me how to quickly fix it. Nonetheless, we will try to come back to you as soon as possible.

rdiaz02 commented 3 years ago

Hi Susana,

Thanks for looking into the issue. Yes, I was able to install in a couple of machines using the older versions of libboost. So for now this works.

sposadac commented 3 years ago

Hi Ramon,

Could you please try if the PR #6 fixes this issue? Thank you very much!

rdiaz02 commented 3 years ago

Hi Susana,

I just tried with libboost 1.74 (and using branch boost of the code) and I still get errors. For example

model_impl.cpp:133:67: error: ‘_1’ was not declared in this scope
  133 |                             boost::detail::subscript(topo_order), _1),

(...)

model_impl.cpp:135:69: error: ‘_2’ was not declared in this scope
  135 |                               boost::detail::subscript(topo_order), _2)));
sposadac commented 3 years ago

Odd. I read from this error message that a header is missing. ~I would suggest to add #include <boost/bind.hpp> to the src/model_impl.cpp file~. Just to make sure, did you install it from source (see https://github.com/cbg-ethz/MC-CBN#installation-from-source)?

UPDATE: Following up with issue #7, I decided to resort to BH to manage the boost dependencies (see recent commit in PR #6)

rdiaz02 commented 1 year ago

I think this problem is still present and we are seeing installation failures in Linux and Macs[1].

I think for installation to succeed one needs to use an outdated (more than 2 years old) version of Boost (https://www.boost.org/users/history/). This makes it very hard, or close to impossible, to install MCCBN under other Linux distros or recent Ubuntu (releases 22.04 LTS ---jammy--- and 22.10 ---kinetic--- both have version 1.74 of libboost [1]), under Macs, and, I guess, Windows with WSL (unless one uses a very specific kernel).

P.S. We are installing from source (following https://github.com/cbg-ethz/MC-CBN#installation-from-source).

[1] In a Mac with MacOS Monterey we see:

model_impl.cpp:136:67: error: use of undeclared identifier '_1'

                            boost::detail::subscript(topo_order), _1),

                                                                  ^

model_impl.cpp:138:69: error: use of undeclared identifier '_2'

                              boost::detail::subscript(topo_order), _2)));

[2] https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=libboost&searchon=names

sposadac commented 1 year ago

Thanks a lot for testing. This is unexpected because I am currently using boost 1.76 and I don't get the same error message. I will try to reproduce the error on a docker container and get back to you as soon as I can

rdiaz02 commented 1 year ago

Hi Susana, The problem with Mac is seen using version 1.80.0 of boost.

rdiaz02 commented 1 year ago

And I have just tested again in a Linux system with libboost-1.74 and I am getting the same errors:

model_impl.cpp:136:67: error: ‘_1’ was not declared in this scope
  136 |                             boost::detail::subscript(topo_order), _1),
(...)
model_impl.cpp:138:69: error: ‘_2’ was not declared in this scope
  138 |                               boost::detail::subscript(topo_order), _2)));

I am using, of course, the master branch. I wonder if your not seeing errors could be due to your using a different branch, maybe the one here: https://github.com/cbg-ethz/MC-CBN/pull/6 . But that branch was never merged into master and that branch has at least a problem in the NAMESPACE file (see https://github.com/cbg-ethz/MC-CBN/issues/8 ).

sposadac commented 1 year ago

Hi Ramon I managed to reproduce and hopefully fix the issue (see branch boost-placeholders). I added a further dependency, namely autoconf-archive, and use a more recent R version (updating the documentation accordingly, still wip). In the mean time, I am providing a first rough version of the container that I used for testing

FROM debian:testing

RUN apt update && apt install -y r-base
# TODO: remove m4 files
RUN apt update && apt install -y libboost1.74-dev wget autoconf automake autoconf-archive
RUN R -e 'if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager"); BiocManager::install(version = "3.16"); BiocManager::install(c("graph", "Rgraphviz")); install.packages("remotes")'

WORKDIR /root/
RUN mkdir build
WORKDIR /root/build
RUN wget https://github.com/cbg-ethz/MC-CBN/archive/refs/heads/boost-placeholders.zip && unzip boost-placeholders.zip && rm boost-placeholders.zip
WORKDIR /root/build/MC-CBN-boost-placeholders
RUN autoreconf -vif && R CMD build . && R -e 'remotes::install_local("mccbn_2.1.0.tar.gz", dependencies=TRUE)'
rdiaz02 commented 1 year ago

Hi Susana,

I was able to install just fine now. Both issuing manually the recipe (i.e., not as part of a docker build process, but just from the shell, copying the wget, etc) and by cloning the repo, checking out the boost-placeholders branch, and following the README instructions.

sposadac commented 1 year ago

Thanks a lot for your feedback and testing