Building PrusaSlicer From Source Fails For Older Versions (e.g., 2.9.0)

by ADMIN 72 views

Building PrusaSlicer from Source Fails for Older Versions (e.g., 2.9.0)

PrusaSlicer is a popular open-source slicing software for 3D printing. However, building it from source can be a challenging task, especially for older versions. In this article, we will explore the issue of building PrusaSlicer from source failing for older versions, such as 2.9.0.

When attempting to build PrusaSlicer from source using Docker, the build process fails for older versions, such as version 2.9.0. The only difference between the working and failing Dockerfiles is that the failing one runs git checkout version_2.9.0 after cloning the repository.

The build process should complete successfully for older versions, just as it does for the master branch.

When attempting to build version 2.9.0, the make command fails with the following errors:

[  1%] Building CXX object bundled_deps/CMakeFiles/localesutils.dir/localesutils/LocalesUtils.cpp.o
[  1%] Building C object bundled_deps/miniz/CMakeFiles/miniz_static.dir/miniz.c.o
[  1%] Building CXX object build-utils/CMakeFiles/encoding-check.dir/encoding-check.cpp.o
[  2%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/dict.c.o
[  2%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/geom.c.o
[  2%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/memalloc.c.o
[  2%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/mesh.c.o
[  2%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/normal.c.o
[  3%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/priorityq.c.o
[  3%] Linking CXX executable encoding-check
[  3%] Built target encoding-check
[  3%] Building CXX object bundled_deps/hints/CMakeFiles/hintsToPot.dir/HintsToPot.cpp.o
[  3%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/render.c.o
[  3%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/sweep.c.o
[  3%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/tess.c.o
[  4%] Building C object bundled_deps/glu-libtess/CMakeFiles/glu-libtess.dir/src/tessmono.c.o
[  4%] Linking C static library libglu-libtess.a
[  4%] Built target glu-libtess
[  5%] Linking CXX static library liblocalesutils.a
[  6%] Building CXX object src/clipper/CMakeFiles/clipper.dir/clipper_z.cpp.o
[  6%] Built target localesutils
[  7%] Building CXX object tests/arrange/CMakeFiles/arrange_tests.dir/arrange_tests_main.cpp.o
In file included from /opt/PrusaSlicer/src/clipper/clipper_z.cpp:7:
/opt/PrusaSlicer/src/clipper/clipper.cpp: In function ‘void ClipperLib_Z::InitEdge(TEdge*, TEdge*, TEdge*, const IntPoint&)’:
/opt/PrusaSlicer/src/clipper/clipper.cpp:431:14: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct ClipperLib_Z::TEdge’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  431 |   std::memset(e, 0, sizeof(TEdge));
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /opt/PrusaSlicer/src/clipper/clipper.cpp:41:
/opt/PrusaSlicer/src/clipper/clipper.hpp:230:10: note: ‘struct ClipperLib_Z::TEdge’ declared here
  230 |   struct TEdge {
      |          ^~~~~
[  7%] Linking C static library libminiz_static.a
[  7%] Built target miniz_static
[  8%] Building CXX object tests/fff_print/CMakeFiles/fff_print_tests.dir/fff_print_tests.cpp.o
/opt/PrusaSlicer/tests/fff_print/fff_print_tests.cpp:3:10: fatal error: libslic3r/libslic3r.h: No such file or directory
    3 | #include "libslic3r/libslic3r.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [tests/fff_print/CMakeFiles/fff_print_tests.dir/build.make:76: tests/fff_print/CMakeFiles/fff_print_tests.dir/fff_print_tests.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1248: tests/fff_print/CMakeFiles/fff_print_tests.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  8%] Building CXX object tests/arrange/CMakeFiles/arrange_tests.dir/test_arrange.cpp.o
In file included from /opt/PrusaSlicer/tests/arrange/test_arrange.cpp:2:
/opt/PrusaSlicer/tests/test_utils.hpp:4:10: fatal error: libslic3r/TriangleMesh.hpp: No such file or directory
    4 | #include <libslic3r/TriangleMesh.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [tests/arrange/CMakeFiles/arrange_tests.dir/build.make:90: tests/arrange/CMakeFiles/arrange_tests.dir/test_arrange.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[  9%] Linking CXX executable hintsToPot
[  9%] Built target hintsToPot
In copy constructor ‘ClipperLib_Z::PolyNode::PolyNode(const ClipperLib_Z::PolyNode&)’,
    inlined from ‘static constexpr std::_Require<std::__and_<std::__not_<typename std::allocator_traits< <template-parameter-1-1> >::__construct_helper<_Tp, _Args>::type>, std::is_constructible<_Tp, _Args ...> > > std::allocator_traits< <template-parameter-1-1> >::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = ClipperLib_Z::PolyNode; _Args = {ClipperLib_Z::PolyNode}; _Alloc = tbb::detail::d1::scalable_allocator<ClipperLib_Z::PolyNode>]’ at /usr/include/c++/13/bits/alloc_traits.h:276:4,
    inlined from ‘static decltype (std::allocator_traits< <template-parameter-1-1> >::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits< <template-parameter-1-1> >::construct::__args)...)) std::allocator_traits< <template-parameter-1-1> >::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = ClipperLib_Z::PolyNode; _Args = {ClipperLib_Z::PolyNode}; _Alloc = tbb::detail::d1::scalable_allocator<ClipperLib_Z::PolyNode>]’ at /usr/include/c++/13/bits/alloc_traits.h:379:16,
    inlined from ‘std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {ClipperLib_Z::PolyNode}; _Tp = ClipperLib_Z::PolyNode; _Alloc = tbb::detail::d1::scalable_allocator<ClipperLib_Z::PolyNode>]’ at /usr/include/c++/13/bits/vector.tcc:117:30,
    inlined from ‘void ClipperLib_Z::Clipper::BuildResult2(ClipperLib_Z::PolyTree&)’ at /opt/PrusaSlicer/src/clipper/clipper.cpp:2824:39:
/opt/PrusaSlicer/src/clipper/clipper.hpp:144:7: warning: ‘*(__vector(2) unsigned int*)((char*)&<unnamed> + offsetof(ClipperLib_Z::PolyNode, ClipperLib_Z::PolyNode::m_jointype))’ may be used uninitialized [-Wmaybe-uninitialized]
  144 | class PolyNode
      |       ^~~~~~~~
/opt/PrusaSlicer/src/clipper/clipper.cpp: In member function ‘void ClipperLib_Z::Clipper::BuildResult2(ClipperLib_Z::PolyTree&)’:
/opt/PrusaSlicer/src/clipper/clipper.cpp:282<br/>
**Building PrusaSlicer from Source Fails for Older Versions (e.g., 2.9.0)**

**Q&A**
=====

**Q: Are there known changes in dependencies that make older versions incompatible with newer build environments?**

A: Yes, there are known changes in dependencies that can make older versions incompatible with newer build environments. PrusaSlicer relies on various dependencies, such as CMake, Git, and build-essential, which can change over time. These changes can affect the build process and cause issues with older versions.

**Q: Are there additional steps required to correctly fetch dependencies for older versions?**

A: Yes, there are additional steps required to correctly fetch dependencies for older versions. When building PrusaSlicer from source, you need to ensure that the dependencies are correctly fetched and installed. This can involve using specific versions of dependencies or applying patches to resolve compatibility issues.

**Q: What are some common issues that can occur when building PrusaSlicer from source?**

A: Some common issues that can occur when building PrusaSlicer from source include:

* **Dependency issues**: As mentioned earlier, dependencies can change over time, causing issues with older versions.
* **Build environment issues**: The build environment can also change over time, causing issues with older versions.
* **Configuration issues**: Configuration files can become outdated or corrupted, causing issues with the build process.
* **Compilation issues**: Compilation errors can occur due to various reasons, such as missing dependencies or incorrect configuration.

**Q: How can I troubleshoot issues when building PrusaSlicer from source?**

A: To troubleshoot issues when building PrusaSlicer from source, you can try the following:

* **Check the build logs**: Review the build logs to identify any errors or warnings.
* **Check the dependencies**: Verify that the dependencies are correctly installed and configured.
* **Check the configuration files**: Verify that the configuration files are correct and up-to-date.
* **Try a different build environment**: Try building PrusaSlicer from source using a different build environment, such as a virtual machine or a container.

**Q: Can I use a pre-built version of PrusaSlicer instead of building from source?**

A: Yes, you can use a pre-built version of PrusaSlicer instead of building from source. Pre-built versions of PrusaSlicer are available for various platforms, including Windows, macOS, and Linux. You can download and install the pre-built version from the official PrusaSlicer website.

**Q: How can I contribute to the PrusaSlicer project?**

A: To contribute to the PrusaSlicer project, you can:

* **Report issues**: Report any issues you encounter when building PrusaSlicer from source.
* **Submit patches**: Submit patches to resolve compatibility issues or improve the build process.
* **Participate in discussions**: Participate in discussions on the PrusaSlicer forums or GitHub issues to help resolve issues and improve the project.

By following these steps and troubleshooting techniques, you can successfully build PrusaSlicer from source and contribute to the project.