Page MenuHome

Use precompiled Boost libraries with CMake on Linux
ClosedPublic

Authored by Nathan Craddock (natecraddock) on Jan 23 2020, 7:08 AM.

Details

Summary

When building with precompiled libraries on Linux, Boost used libs from outside the lib dir which prevented CMake from finishing. This restricts CMake to only use the libs from the precompiled libraries.

I did some various tests with the four variables. The two that I can tell prevent errors are set(Boost_NO_BOOST_CMAKE ON) and set(BOOST_ROOT ${LIBDIR}/boost). For example, without BOOST_ROOT set, AL lib prints invalid header errors at Blender runtime.

@Ray Molenkamp (LazyDodo) suggested the variables besides Boost_NO_BOOST_CMAKE.

Diff Detail

Repository
rB Blender

Event Timeline

Nathan Craddock (natecraddock) retitled this revision from Use precompiled Boost libraries in CMake on Linux to Use precompiled Boost libraries with CMake on Linux.Jan 23 2020, 7:12 AM
Nathan Craddock (natecraddock) edited the summary of this revision. (Show Details)

Is it enough to only provide Boost_NO_SYSTEM_PATHS ?

It is somewhat weird to provide root directory for only one package. If this is something what needs to be done (aka, Boost_NO_SYSTEM_PATHS is not enough) we should specify root directories for all dependencies, to avoid similar issues with other packages in the future (this can happen in file like platform_common.cmake which will check whether precompiled lib is specified/exists and set ROOT for all libraries).

It is strange that it is necessary to set BOOST_ROOT. I just tested a few more combinations of the options.

Only setting Boost_NO_SYSTEM_PATHS results in the CMake build error I experienced previously, as explained in the first post here: https://devtalk.blender.org/t/building-on-linux-with-precompiled-libraries/11409/. Boost_NO_SYSTEM_PATHS and BOOST_ROOT also resulted in the error.

The combination Boost_NO_SYSTEM_PATHS and Boost_NO_BOOST_CMAKE had no CMake errors and it compiled, but it gave linking errors. Adding BOOST_ROOT cleared up the linker errors. Using BOOST_LIBRARYDIR in the place of BOOST_ROOT also allowed linking to complete.

So it seems that BOOST_ROOT is required to for linking, and Boost_NO_BOOST_CMAKE is required for CMake to finish. The other two options don't seem to have any impact on the output.

Wow, what a mess...

So here is a proposal then:

  • Go ahead with this change
  • Later on set all {FOO}_ROOT (try to re-use as much as possible on all platforms). This way we would also avoid file(GLOB LIB_SUBDIRS ${LIBDIR}/*) which is rather weak.

Brecht, Campbell, any strong opinion?

Remove extra precompiled libs vars

Use all four vars (revert previous change).

Some additional testing showed that (sometimes?) all four variables are needed.
I don't know enough about CMake to be sure.

As a side note, I think either 517870a4a11f or 544ee7a4f2f8 broke linking again, not with boost though. I will go ahead and commit this though.

If linking error you're experiencing is due to zlib symbols you need to recompile blosc (if you're compiling libraries yourself), or svn up in the precompiled folder (if you use precompiled libraries).

If your linking error is something more weird and wonderful, please mail the list (I can miss messages on chat, and in ML more people might have clues). Don't forget to include details and linking error itself.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 26 2020, 7:40 AM
This revision was automatically updated to reflect the committed changes.