-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several Linux build errors introduced in 2.8.1 (Eigen3, DBus, boost::log) #13608
Comments
This solves the build error with the missing `Eigen3::Eigen` build target. Partially fixes prusa3d#13608
This solves the build error with missing headers. Partially fixes prusa3d#13608.
This solves the linker error about missing `boost::log` symbols. Fixes prusa3d#13608.
Also CC @fordfrog who I see has done some similar work for the Gentoo ebuild for 2.8.0 and 2.8.1. (Specifically, I managed to solve the Eigen issue "properly" without rewriting the includes in the source files, which might be of interest to you.) |
This solves the build error with the missing `Eigen3::Eigen` build target. Partially fixes prusa3d#13608
This solves the build error with missing headers. Partially fixes prusa3d#13608.
This solves the linker error about missing `boost::log` symbols. Fixes prusa3d#13608.
improved handling of eigen3 (thanks to jmickelin: prusa3d/PrusaSlicer#13608) fixed libsoup double linking (thanks to Alexander Golubev <fatzer2@gmail.com>) Closes: #39379 Closes: https://bugs.gentoo.org/940182 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
@jmickelin thanks. i updated our ebuild with your eigen3 approach and it works for us too. |
improved handling of eigen3 (thanks to jmickelin: prusa3d/PrusaSlicer#13608) fixed libsoup double linking (thanks to Alexander Golubev <fatzer2@gmail.com>) Closes: gentoo#39379 Closes: https://bugs.gentoo.org/940182 Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
@jmickelin thanks for all that detailed information. Some of those errors were also affecting OpenBSD and now I can finally get a working build :) |
This solves the linker error about missing `boost::log` symbols. Fixes #13608.
Description of the bug
2.8.1 introduced a number of regressions to the build process on Linux. Specifically, 2111699 saw a lot of refactoring in the CMake files, and a few dependencies were lost along the way. These problems are especially apparent on source
distributions like Nix or Gentoo, where the CMake modules for fetching dependencies from the web aren't used.
Here is a summary of my findings, and patches for solving them:
Errors
These errors showed up during my patching efforts. Obviously, since each one halts the build, later ones showed up after I fixed the earlier ones (using the solutions below).
Eigen3
The
Eigen3::Eigen
target is missing.CMake log
DBus
Includes (but not libraries) for DBus are missing:
CMake log
boost::log
Linker fails for
boost:log
, but only withintests/sla_print
:CMake log
OpenSSL:
Linker fails for OpenSSL:
CMake log
Root cause analysis and solutions
Eigen3:
This was exposed after the removal of the bundled version of Eigen3. Ultimately, it is caused by the module cmake/modules/FindEigen3.cmake being ancient and not properly exporting the namespaced target (
Eigen3::Eigen
) but only its alias (eigen
). (The build works if you replace all references toEigen3::Eigen
with justeigen
, but the intent is clearly to go with the namespaced name, so let's fix that.)The most immediate solution would be to update the module to the newest version from upstream, which properly exports the namespaced target: https://gitlab.com/libeigen/eigen/-/blob/3.4.0/cmake/FindEigen3.cmake?ref_type=tags
However, note that Eigen no longer bundles any
Find*.cmake
modules, in favor of usingpkg-config
, as explained in this PR: https://gitlab.com/libeigen/eigen/-/merge_requests/485The way that CMake works,
Find*
modules take precedence over the Config ones, so even though my build environment had the.pc
files present, they were masked byPrusaSlicer
's module. This suggests further ways to solve this dependency:find_package(Eigen3 CONFIG REQUIRED)
as described here.-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
flag to CMake.cmake/modules/FindEigen3.cmake
.Of these four, I actually think the final one is the most elegant and future-proof. The only caveat is that I don't know how this affects builds on other platforms, since I can't test them (though I did spot some conditional imports for
PkgConfig
, which could cause problems if some platforms doesn't use it). For this reason, I want to suggest the first method with updating of the module instead.DBus:
While I haven't pinpointed the exact cause, it seems that the move from explicit
include_directory
calls assumed that the existing invocation of${DBUS_LIBRARIES}
would be enough to pull in the includes. This does not appear to be the case. Indeed, calling CMake with the flags--trace-source=CMakeLists.txt --trace-expand
flags reveals the following:CMake log
The target actually refers to a file, namely the
.so
. I'm not a CMake expert (who is?), so I'm not entirely clear on how one is meant to add the include flags with this module unless one's using the (now removed)include_directory
call.However, I discovered that upstream DBus actually discourages use of bespoke
FindDBus
modules, and that they provide modules that should work out of the box. See here for further details: https://gitlab.freedesktop.org/dbus/dbus/-/commit/d160c1a71acc157613a5fc4e1ff315d1607f66ffSo, instead of using
cmake/modules/FindDBus.cmake
(and callingfind_package(DBus REQUIRED)
), usefind_package(DBus1 REQUIRED)
. The link can then be added usingtarget_link_libraries(libslic3r_gui PUBLIC ${DBus1_LIBRARIES})
. I have confirmed that this solves the error.Patch:
boost::log
This is caused by the missing dependency
boost_headeronly
withintests/sla_print
andsrc/slic3r
.OpenSSL
This was actually present starting in 2.8.0, and there is already a PR waiting for review from @Rose-David: #13080
I'll replicate the patch here for completeness:
Note that the above PR also includes a patch for some missing includes, but that does not appear to be needed in my testing.
PR
I have created a PR incorporating these changes here: #13609
Version of PrusaSlicer
2.8.1
Operating system
Linux, NixOS
The text was updated successfully, but these errors were encountered: