Building on Linux with precompiled libraries

I am attempting to set up a new dev environment after a reinstall of my system. I am running Arch. Using the precompiled libraries is the first suggestion on the wiki, so I want to get that working. Based on the errors install_deps and make deps give me, I think that the precompiled libraries will be the easiest route; however, I find some CMake errors.

Running make, this is the error message printed:

CMake Error in source/creator/CMakeLists.txt:
	  Imported target "Boost::filesystem" includes non-existent path
	
	    "/include"
	
	  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
	
	  * The path was deleted, renamed, or moved to another location.
	
	  * An install or uninstall procedure did not complete successfully.
	
	  * The installation package was faulty and references files it does not
	  provide.

Attempting to compile anyway will print messages like the following throughout the build process.

	[  8%] Building CXX object intern/cycles/blender/CMakeFiles/bf_intern_cycles.dir/blender_particles.cpp.o
	cc1plus: warning: /include: No such file or directory [-Wmissing-include-dirs]

I’m not sure what this /include directory is for. I can create an empty directory there which silences the warnings printed by CMake, but doesn’t solve any issues building. (cc1plus: warning: /include is not a directory).

Looks like boost is having a unhappy time, I’d probably start by passing -DBoost_DEBUG=On option to cmake and see what’s going on.

It appears cmake is finding some system cmake boost files: /lib64/cmake/boost_* rather than the precompiled libs.

Full output: https://developer.blender.org/P1224

$ cmake ../blender/ -DBoost_DEBUG=On

-- Using pre-compiled LIBDIR: /home/nathan/blender/source/blender/../lib/linux_centos7_x86_64
-- Found Boost 1.71.0 at /lib64/cmake/Boost-1.71.0
--   Requested configuration: QUIET COMPONENTS filesystem;regex;thread;date_time;wave;locale;iostreams;system
-- BoostConfig: find_package(boost_headers 1.71.0 EXACT CONFIG  QUIET HINTS /lib64/cmake)
-- Found boost_headers 1.71.0 at /lib64/cmake/boost_headers-1.71.0
-- BoostConfig: find_package(boost_filesystem 1.71.0 EXACT CONFIG  QUIET HINTS /lib64/cmake)
-- Found boost_filesystem 1.71.0 at /lib64/cmake/boost_filesystem-1.71.0
-- Boost toolset is gcc9 (GNU 9.2.0)
-- Scanning /lib64/cmake/boost_filesystem-1.71.0/libboost_filesystem-variant*.cmake
--   Including /lib64/cmake/boost_filesystem-1.71.0/libboost_filesystem-variant-shared.cmake
--   [ ] libboost_filesystem.so.1.71.0
--   Including /lib64/cmake/boost_filesystem-1.71.0/libboost_filesystem-variant-static.cmake
--   [x] libboost_filesystem.a
-- Adding boost_filesystem dependencies: headers
-- BoostConfig: find_package(boost_regex 1.71.0 EXACT CONFIG  QUIET HINTS /lib64/cmake)
-- Found boost_regex 1.71.0 at /lib64/cmake/boost_regex-1.71.0
-- Boost toolset is gcc9 (GNU 9.2.0)
-- Scanning /lib64/cmake/boost_regex-1.71.0/libboost_regex-variant*.cmake
--   Including /lib64/cmake/boost_regex-1.71.0/libboost_regex-variant-shared.cmake
--   [ ] libboost_regex.so.1.71.0
--   Including /lib64/cmake/boost_regex-1.71.0/libboost_regex-variant-static.cmake
--   [x] libboost_regex.a
...

I ran the same command on an Ubuntu VM and the output was was formatted very differently, but the references to libboost_* were all found in the LIBDIR

Also on Arch, although I have not been using pre-compiled libs or ./build_files/build_environment/install_deps.sh.

It looks like this needs some work, I’m running into multiple problems getting this running as well (OSL fails to build).

The install deps script is now working for me, although I wasn’t getting the boost error you had, I ran into a few other issues which have been resolved.

./build_files/build_environment/install_deps.sh  --with-all --skip-opencollada --skip-osl

Thanks for looking into this. install_deps.sh works for me now, but when I run make with the args the script outputs, it can’t find Python (because my system has 3.8.1 rather than 3.7). Replacing it with -D PYTHON_VERSION=3.8 solves that cmake error, but I still get the same boost error as before. I tried both with my first build directory, and just in case I cloned Blender from scratch with the same results.

CMake Error in source/creator/CMakeLists.txt:
  Imported target "Boost::filesystem" includes non-existent path

    "/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.
...

does it help when you hint boost a little with
-DBOOST_ROOT=/home/nathan/blender/source/blender/../lib/linux_centos7_x86_64/boost/ ?

Doesn’t seem like that variable works here.

$ cmake ../blender/ -DBOOST_ROOT=/home/nathan/blender/source/blender/../lib/linux_centos7_x86_64/boost/

...
[ Same error as before ]
...

-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BOOST_ROOT

-DBOOST_ROOT did not work, but @LazyDodo suggested looking at https://cmake.org/cmake/help/latest/module/FindBoost.html. The bottom of the page suggests to

Set Boost_NO_BOOST_CMAKE to ON , to disable the search for boost-cmake.

This worked (using precompiled libs again). CMake finished with no warnings, and all compilation was successful; however, linking Boost did not work. 100s of lines printed like:

/lib64/libboost_locale.a(time_zone.o):function boost::locale::impl_icu::get_time_zone(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&): error: undefined reference to 'icu_65::TimeZone::createTimeZone(icu_65::UnicodeString const&)'

or 

/home/nathan/blender/source/lib/linux_centos7_x86_64/osl/lib/liboslcomp.a(oslcomp.cpp.o):oslcomp.cpp:function boost::system::error_category::std_category::equivalent(std::error_code const&, int) const: error: undefined reference to 'boost::system::detail::generic_category_ncx()'

I’m going to continue trying different cmake boost flags to set the proper directories for linking. I’m not too proficient here, so any other ideas would be great.

Also, is -DBoost_NO_BOOST_CMAKE=On something that could/should be enabled by default?

The combination of flags that worked for compilation and linking is

-DBoost_NO_BOOST_CMAKE=ON
-DBOOST_ROOT=${LIBDIR}/boost
-DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/
-DBoost_NO_SYSTEM_PATHS=ON

These will hopefully be comitted soon so setting the flags manually will not be needed. https://developer.blender.org/D6659

For a short time (about 12 hours or so) the above worked and Blender compiled. A recent change (I cannot determine which) now causes openimageio and openexr linker errors. I already looked at the CMake docs again, but I cannot find anything there regarding oiio or exr.

The paths in the errors look correct, as in they are not finding system libraries. All of the errors are undefined reference. I already ran svn up for the precompiled libraries. I tried a new build directory.

Linker output: https://developer.blender.org/P1233

Another strange thing, these linker errors persist even when disabling openimageio and openexr. I’m not sure where to go from here, any ideas?

perhaps it is picking up ilmbase from outside the lib folder?