Skip to content
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

OpenVDB / OpenEXR 2.x + IlmBase -> OpenEXR 3.x + Imath #2606

Closed
2 tasks
cederom opened this issue Sep 25, 2023 · 14 comments
Closed
2 tasks

OpenVDB / OpenEXR 2.x + IlmBase -> OpenEXR 3.x + Imath #2606

cederom opened this issue Sep 25, 2023 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@cederom
Copy link

cederom commented Sep 25, 2023

Bambu Studio Version

git/master

Where is the application from?

Bambu Lab github releases, Built from source by yourself or others

OS version

FreeBSD RELEASE 13.2 AMD64

Additional system information

No response

Printer

X1C

How to reproduce

  1. CMakeLists.txt contains OpenVDB reference to obsoleted IlmBase. Part of IlmBase became OpenEXR version 3 + Imath library [1].

find_package(OpenVDB 5.0 COMPONENTS openvdb)

slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)

  1. Modern PrusaSlicer already uses new OpenEXR + Imath.

[1] https://openexr.com/en/latest/PortingGuide.html?highlight=ilmbase#background

Actual results

  • I am porting BambuStudio to FreeBSD OS :-) BambuStudio port for FreeBSD OS. #2487
  • There was IlmBase port in FreeBSD but due to OpenEXR updates the port is now gone and code went to OpenEXR and Imath following the upstream.
  • FreeBSD port of PrusaSlicer already uses OpenEXR + Imath.

Expected results

Dependencies from IlmBase are updated to OpenEXR + Imath :-)

Project file & Debug log uploads

none

Checklist of files to include

  • Log file
  • Project file
@cederom cederom added the bug Something isn't working label Sep 25, 2023
@harley-codes
Copy link

Good find @cederom - was getting stuck on this issue too. Hopefully this will get resolved soon.

@lanewei120
Copy link
Collaborator

lanewei120 commented Oct 7, 2023

@cederom

thanks for this suggestion

"Modern PrusaSlicer already uses new OpenEXR + Imath."
could you show us how did you find this?
I just checked the OpenVDB dependence, and find no difference on this logic

we will check Prusa's logic for our reference

@cederom
Copy link
Author

cederom commented Oct 7, 2023

Thank you @harley-codes and @lanewei120 for your interest in the problem :-)

Here are several resources to reference:

  1. https://cgit.freebsd.org/ports/tree/misc/openvdb
  2. https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer
  3. https://cgit.freebsd.org/ports/tree/graphics/openexr
  4. https://openexr.com/en/latest/PortingGuide.html?highlight=ilmbase
  5. https://cgit.freebsd.org/ports/tree/math/Imath

1 is the source of FreeBSD's port for OpenVDB. If you look at Makefile line 38 it states OpenVDB depends on OpenEXR (here: https://cgit.freebsd.org/ports/tree/misc/openvdb/Makefile).

2 is the source of FreeBSD's port for PrusaSlicer version 2.6.0. If you look at Makefile line 21 it states libImath dependency (here: https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer/Makefile).

3 is the source of FreeBSD's port for OpenEXR. If you look at Makefile line 2 it states version used is 3.2.1 (here: https://cgit.freebsd.org/ports/tree/graphics/openexr/Makefile).

4 is the porting guide of OpenEXR that states changes between version 2 and version 3, particularly the "OpenEXR and Imath Are Different Packages" section states "The parts of “IlmBase” that were Imath and half are now repackaged as the Imath library. The IlmThread and Iex libraries have been folded into the OpenEXR package, since they were were not necessary to the rest of Imath."

5 is the dedicated FreeBSD port for Imath following the changes in OpenEXR version 3.X. That is a dependency for PrusaSlicer version 2.6.0 (2). It replaces the old version 2 ilmbase/OpenEXR with version 3 (see commit https://cgit.freebsd.org/ports/commit/?id=05044ea01992c28028cc87f374560aad1b6c595d).

Switching BambuStudio / PrsaSlicer to OpenEXR 3.X + Imath would make porting to new platforms possible, also should improve maintenance on existing platforms :-)

I hope that helps :-) Please let me know how can I help further :-)

@lanewei120
Copy link
Collaborator

Thank you @harley-codes and @lanewei120 for your interest in the problem :-)

Here are several resources to reference:

  1. https://cgit.freebsd.org/ports/tree/misc/openvdb
  2. https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer
  3. https://cgit.freebsd.org/ports/tree/graphics/openexr
  4. https://openexr.com/en/latest/PortingGuide.html?highlight=ilmbase
  5. https://cgit.freebsd.org/ports/tree/math/Imath

1 is the source of FreeBSD's port for OpenVDB. If you look at Makefile line 38 it states OpenVDB depends on OpenEXR (here: https://cgit.freebsd.org/ports/tree/misc/openvdb/Makefile).

2 is the source of FreeBSD's port for PrusaSlicer version 2.6.0. If you look at Makefile line 21 it states libImath dependency (here: https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer/Makefile).

3 is the source of FreeBSD's port for OpenEXR. If you look at Makefile line 2 it states version used is 3.2.1 (here: https://cgit.freebsd.org/ports/tree/graphics/openexr/Makefile).

4 is the porting guide of OpenEXR that states changes between version 2 and version 3, particularly the "OpenEXR and Imath Are Different Packages" section states "The parts of “IlmBase” that were Imath and half are now repackaged as the Imath library. The IlmThread and Iex libraries have been folded into the OpenEXR package, since they were were not necessary to the rest of Imath."

5 is the dedicated FreeBSD port for Imath following the changes in OpenEXR version 3.X. That is a dependency for PrusaSlicer version 2.6.0 (2). It replaces the old version 2 ilmbase/OpenEXR with version 3 (see commit https://cgit.freebsd.org/ports/commit/?id=05044ea01992c28028cc87f374560aad1b6c595d).

Switching BambuStudio / PrsaSlicer to OpenEXR 3.X + Imath would make porting to new platforms possible, also should improve maintenance on existing platforms :-)

I hope that helps :-) Please let me know how can I help further :-)

thanks for the detailed information

I just found there is no modifications in https://github.com/prusa3d/PrusaSlicer to support OpenEXR+Imath
do you mean PrusaSlicer can be compiled under FreeBSD without the modifications in its original git,
and just do the modifications in https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer?

@cederom
Copy link
Author

cederom commented Oct 8, 2023

I just found there is no modifications in https://github.com/prusa3d/PrusaSlicer to support OpenEXR+Imath do you mean PrusaSlicer can be compiled under FreeBSD without the modifications in its original git, and just do the modifications in https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer?

  • PrusaSlicer depends on OpenVDB and Imath (see: https://cgit.freebsd.org/ports/tree/cad/PrusaSlicer/Makefile).
  • OpenVDB depends on Imath+OpenEXR (see: https://cgit.freebsd.org/ports/tree/misc/openvdb/Makefile).
  • This is aligned to new version of OpenEXR 3.X that swapped required functions from OpenEXR + IlmBase to OpenEXR + Imath (see: https://openexr.com/en/latest/PortingGuide.html?highlight=ilmbase).
  • IlmBase standalone library is now obsolete (it was required by OpenVDB using OpenEXR 2.X). It has been removed from FreeBSD Ports due changes in OpenEXR 3.X.
  • Requiring IlmBase in current BambuStudio enforces alignment to old OpenEXR 2.X and block porting to FreeBSD. It also may cause problems on other platforms.
  • I would be best to remove dependency on IlmBase in BambuStudio and add dependency on OpenEXR 3.X + Imath. That would fit current dependencies of OpenVDB (required by PrusaSlicer) and thus OpenEXR 3.X.
  • OpenEXR can fetch "silently" Imath during build, but that causes problems for various packages that used IlmBase, including current build setup of the BambuStudio.
  • Current main of BambuStudio build problem related with IlmBase dependency is reported as BambuStudio port for FreeBSD OS. #2487.
  • FreeBSD Ports is an example how OpenEXR 3.X + Imath update was made.
  • FreeBSD Port is just a Makefile that automates fetch + build in order to generate a system package. It also includes dependencies in the Makefile.

I will try to build git master of PrusaSlicer on FreeBSD (no ports Makefile used) and report back :-)

Please let me know how can I help further :-)

@cederom
Copy link
Author

cederom commented Oct 9, 2023

Below there is a log for git master build of PrusaSlicer:

octagon% cd XXX/PrusaSlicer.git
octagon% cmake -B build -S .
-- The C compiler identification is Clang 14.0.5
-- The CXX compiler identification is Clang 14.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- No build type selected, default to Release
-- SLIC3R_ASAN: OFF
-- SLIC3R_BUILD_SANDBOXES: OFF
-- SLIC3R_BUILD_TESTS: ON
-- SLIC3R_DESKTOP_INTEGRATION: ON
-- SLIC3R_ENABLE_FORMAT_STEP: ON
-- SLIC3R_FHS: OFF
-- SLIC3R_GTK: 2
-- SLIC3R_GUI: ON
-- SLIC3R_MSVC_COMPILE_PARALLEL: ON
-- SLIC3R_MSVC_PDB: ON
-- SLIC3R_PCH: ON
-- SLIC3R_PERL_XS: OFF
-- SLIC3R_STATIC: OFF
-- SLIC3R_UBSAN: OFF
-- SLIC3R_STATIC: OFF
-- CMAKE_PREFIX_PATH: (default)
CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


CMake Warning at /usr/local/share/cmake/Modules/FindBoost.cmake:1390 (message):
  New Boost version may have incorrect or missing dependencies and imported
  targets
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindBoost.cmake:1514 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/local/share/cmake/Modules/FindBoost.cmake:2125 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:361 (find_package)


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Boost: /usr/local/include (found suitable version "1.83.0", minimum required is "1.66.0") found components: system filesystem thread log locale regex chrono atomic date_time iostreams log_setup
-- Boost::boost exists
-- TBB found in /usr/local/lib/cmake/TBB
-- Could NOT find CURL (missing: CURL_DIR)
-- Falling back to MODULE search for CURL...
-- Found CURL: /usr/local/lib/libcurl.so (found version "8.3.0")
-- Found ZLIB: /usr/local/lib/libzlibstatic.a (found version "1.2.13")
-- Found Eigen3: /usr/local/include/eigen3 (Required is at least version "3.3")
-- EXPAT found in /usr/local/lib/cmake/expat-2.5.0
CMake Error at CMakeLists.txt:457 (add_library):
  add_library cannot create target "libexpat" because another target with the
  same name already exists.  The existing target is an interface library
  created in source directory
  "/XXX/PrusaSlicer.git".  See
  documentation for policy CMP0002 for more details.


-- Found PNG: /usr/local/lib/libpng.so (found version "1.6.40")
-- Found OpenGL: /usr/local/lib/libOpenGL.so
-- Could NOT find GLEW (missing: GLEW_DIR)
-- Falling back to MODULE search for GLEW...
-- Found GLEW: /usr/local/include (found version "2.2.0")
-- Found NLopt in '/usr/local/lib'.
-- Using NLopt include directory '/usr/local/include'.
-- Using NLopt library '/usr/local/lib/libnlopt.so'.
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "2.0.3")
-- Found OpenVDB: /usr/local/include (found suitable version "10.0.1", minimum required is "5.0") found components: openvdb
-- OpenVDB ABI Version: 10
CMake Warning at cmake/modules/FindOpenVDB.cmake:345 (message):
  IlmBase::Half can not be found!
Call Stack (most recent call first):
  cmake/modules/FindOpenVDB.cmake:367 (just_fail)
  CMakeLists.txt:564 (find_package)


CMake Error at CMakeLists.txt:569 (message):
  OpenVDB could not be found with the bundled find module.  You can try to
  specify the find module location of your OpenVDB installation with the
  OPENVDB_FIND_MODULE_PATH cache variable.


-- Configuring incomplete, errors occurred!

@cederom
Copy link
Author

cederom commented Oct 9, 2023

I will try to provide patches to both OpenVDB and PrusaSlicer:

  1. Transition to OpenEXR 3.X + Imath.
  2. Build out of the box on FreeBSD (I guess this will be also mandatory to build BambuStudio here).

@cederom
Copy link
Author

cederom commented Oct 9, 2023

@lanewei120 is it possible to skip PrusaSlicer build as part of BambuStudio and use existing installed system package or is it hardcoded part?

That would allow easy building of BambuStudio that could depend on the already installed system packages (no matter how these were built).

If this is not possible then we need to patch the upstream of OpenVDB and PrusaSlicer in the first place and then maintain the FreeBSD support in the upstream.

Update: I can see that BambuStudio IS a modified PrusaSlicer. There was no question ;-)

@lanewei120
Copy link
Collaborator

@lanewei120 is it possible to skip PrusaSlicer build as part of BambuStudio and use existing installed system package or is it hardcoded part?

That would allow easy building of BambuStudio that could depend on the already installed system packages (no matter how these were built).

If this is not possible then we need to patch the upstream of OpenVDB and PrusaSlicer in the first place and then maintain the FreeBSD support in the upstream.

Update: I can see that BambuStudio IS a modified PrusaSlicer. There was no question ;-)

yes, the building of BambuStudio is dependent of PrusaSlicer
as BambuStudio is a based on PrusaSlicer, the building steps are very similiar
thanks for doing this~

@cederom
Copy link
Author

cederom commented Oct 10, 2023

@lanewei120 is BambuStudio 1:1 copy of the PrusaSlicer + additional "out-of-tree" modifications, so patching PrusaSlicer upstream will also propagate BambuStudio or these projects diverged at some point and need to be patched separately and will not stay in sync?

I mean the best possible situation would be to patch the PrusaSlicer and then rebase changes to BambuStudio.. now.. and in future :-)

@lanewei120
Copy link
Collaborator

@lanewei120 is BambuStudio 1:1 copy of the PrusaSlicer + additional "out-of-tree" modifications, so patching PrusaSlicer upstream will also propagate BambuStudio or these projects diverged at some point and need to be patched separately and will not stay in sync?

I mean the best possible situation would be to patch the PrusaSlicer and then rebase changes to BambuStudio.. now.. and in future :-)

need to patch seperately:)
they are seperate code base now

@cederom
Copy link
Author

cederom commented Oct 10, 2023

Okay @lanewei120, so the BambuStudio was created out of PrusaSlicer, do you share back fixes and updates to the upstream PrusaSlicer? o_O

@lanewei120
Copy link
Collaborator

Okay @lanewei120, so the BambuStudio was created out of PrusaSlicer, do you share back fixes and updates to the upstream PrusaSlicer? o_O

they have much difference in lots of parts,
and the PrusaSlicer's maintainer will do this if they think it is neccessary

@cederom
Copy link
Author

cederom commented Dec 29, 2023

Okay, OpenVDB 11 was released with required fixes in the upstream AcademySoftwareFoundation/openvdb#1678 :-)

The other stuff is up to PrusaSlicer upstream. I know more now how BambuStudio is organized. I will get back to porting in my free time :-)

Thank you for the support and time! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants