Boost version problem

286 views
Skip to first unread message

Lucas Myers

unread,
Aug 10, 2021, 4:46:17 PM8/10/21
to deal.II User Group
Hi folks,

I'm getting the error "The version number of boost that you are compiling with does not match the version number of boost found during deal.II's configuration step." when I try to compile the first tutorial program. It is thrown at /usr/local/include/deal.II/base/config.h:508:17

This is confusing to me, because when I go into /usr/include/boost/version.hpp, it states that my BOOST_VERSION is 106700. Further, in /usr/local/include/deal.II/base/config.h, it says that my DEAL_II_BOOST_VERSION_MAJOR is 1, DEAL_II_BOOST_VERSION_MINOR is 67, and DEAL_II_BOOST_VERSION_SUBMINOR is 0 which makes my DEAL_II_BOOST_VERSION_GTE 106700, the same as what boost says it ought to be.

For context, I had installed dealii version 9.2.0 earlier, but had problems when I tried to update it to include CUDA (I think there was some API change with CUDA 11). I then installed dealii version 9.3.1 (without doing anything to the other version). Now none of the example files in version 9.3.1 will compile.

Any help is appreciated, thanks so much

Kind regards,
Lucas

Lucas Myers

unread,
Aug 10, 2021, 5:49:28 PM8/10/21
to deal.II User Group
Update: the problem is that, when I installed the newest version of dealii, the boost version that I had separately installed was 1.67.0. Instead of using the version bundled in dealii (version 1.70.0), dealii configured with the separately installed version. However, whenever it does the compilation check, it #includes the bundled version of boost. I'm not sure why it does that, because when I run a loose source file (e.g. `boost_test.cpp` in my home directory) with boost included, it uses the separately installed version. 

In any case, I think the fix will be to uninstall boost, and then re-install dealii so that it uses its bundled version. Just wanted to make a note about it because I think this is unintended behavior. 

- Lucas

Lucas Myers

unread,
Aug 19, 2021, 12:36:55 PM8/19/21
to deal.II User Group
Hi folks,

This problem is back, and I'm not sure what to do about it. To solve the problem, I updated boost to the newest version (1.76.0), and then reinstalled the newest dealii release (9.3.1). I configured it to use external dependency for boost so that it configured and installed with boost version 1.76.0. It was working for a while for some reason, but then it broke again after updating cmake to the newest version. 

I reinstalled the newest dealii version with external dependency for boost, and it gives the error that it was giving before. Again, I think the problem is that on line 506 of /include/deal.II/base/config.h there is a #include<boost/version.hpp> which is pointing to the bundled boost version as opposed to the externally installed one. How do I get this + all other include directives to point to the proper boost installation? I think this is a cmake problem, but I do not know how to tell the compiler where the proper boost installation is.

Any help is appreciated.

Kind regards,
Lucas

Jean-Paul Pelteret

unread,
Aug 19, 2021, 2:55:48 PM8/19/21
to deal.II User Group
Hi Lucas,

The documentation that describes how to configure CMake options for external libraries is here: https://dealii.org/developer/users/cmake_dealii.html#configureext . You should just need to pass cmake the flag -DBOOST-DIR=<PATH_TO_BOOST> (with the correct path added, of course. From your first post, I think that this would just be /usr). To be safe, you probably want to delete the CMakeCache.txt before reconfiguring. You should also take a look at this section: https://dealii.org/developer/users/cmake_dealii.html#buildinformation . There you can see that when an external version of boost is detected and can be used, this status should be reflected at the end of the configuration process, e.g.

# Configured Features (DEAL_II_ALLOW_BUNDLED = ON, DEAL_II_ALLOW_AUTODETECTION = ON):
# DEAL_II_WITH_BOOST set up with external dependencies
# [...]

If you pass the boost directory to CMake and then don't see a message like that, then it doesn't necessarily mean that the boost path wasn't found -- it could also mean that this specific installation of boost was not found to be usable (i.e. it didn't pass the checks that are executed during the configuration process). To understand why that could be, you'd have to provide us with the detailed.log file, along with two log files that CMake generates, namely <BUILD_DIR>/CMakeFiles/CMakeError.log and <BUILD_DIR>/CMakeFiles/CMakeOutput.log.

I hope that this helps you sort out this issue.

Best,
Jean-Paul

Lucas Myers

unread,
Oct 25, 2021, 11:33:07 AM10/25/21
to deal.II User Group
Hi Jean-Paul,

Sorry to bring this back up again, but I'm running into it after installing dealii on a new machine -- last time the solution was just to delete the entire dealii installation and do a clean reinstall. That's annoying, so I want to avoid if possible.

To reiterate: I first installed dealii with the packaged Boost version (1.70). Then, I installed the newest workable Boost version (1.76) and reinstalled. The installation didn't give any errors, and the detailed.log file says that dealii was set up with external dependencies, using Boost version (1.76). However, when I try to build anything using the standard cmake files included in the examples, the deal.II/base/config.h file complains that I have the wrong boost version because when dealii includes boost, the include directory points to the packaged boost instead of the external boost.

Following your suggestion, I tried to pass in the -DBOOST_DIR flag when cmaking the examples, but it says that the variable is unused -- I suspect you meant to pass that into cmake when building and configuring the initial dealii installation. I've also attached the requested files, but I think that the initial installation worked so I'm not sure what you'll find there.

One question to maybe get started: in the context of building one of the examples (say step-1), how does dealii know where to look for boost when it calls the deal.II/base/config.h file? I reckon it tells cmake where to look in the "FINDPACKAGE", "DEAL_II_INITIALIZE_CACHED_VARIABLES", or the "DEAL_II_INVOKE_AUTOPILOT" macros, but I don't know enough about cmake to know where to look.

Let me know if you know the answer to my question, or a workaround, and thanks so much for any help.

Kind regards,
Lucas
CMakeError.log
CMakeOutput.log
detailed.log

Lucas Myers

unread,
Oct 27, 2021, 1:42:40 PM10/27/21
to deal.II User Group
Hi folks,

I figured out the problem and am posting it here for sake of posterity:

When one installs dealii with a bundled library (e.g. Boost), the header files of the bundled version of that library are copied to `${DEAL_II_PATH}/${DEAL_II_INCLUDE_RELDIR}$/deal.II/bundled`. This include directory is also passed in as a flag to the compiler by cmake whenever find_package() is used to find dealii. Additionally, it's not possible (so far as I can tell) to pass in the standard system include directories (e.g. /usr/local/include) and have cmake generate an include compiler flag which takes precedence over other include compiler flags. That is, if I use `include_directories("/usr/local/include")`, cmake does not actually include a `-I/usr/local/include` compiler flag in the Makefile. Hence, the bundled version will always take precedent over the external version, even if dealii is reconfigured and reinstalled with external dependencies.

My solution was just to manually remove the `boost` folder from `${DEAL_II_PATH}/${DEAL_II_INCLUDE_RELDIR}$/deal.II/bundled`. Not sure if there is a way to fix this during re-installation of dealii in case someone wants to reinstall with a different configuration...

- Lucas
Reply all
Reply to author
Forward
0 new messages