Skip to content

Remove local source copied zlib files#6399

Merged
larshg merged 2 commits intoPointCloudLibrary:masterfrom
larshg:removezlibusedinsurfacenurbs
Jan 30, 2026
Merged

Remove local source copied zlib files#6399
larshg merged 2 commits intoPointCloudLibrary:masterfrom
larshg:removezlibusedinsurfacenurbs

Conversation

@larshg
Copy link
Contributor

@larshg larshg commented Jan 26, 2026

External zlib has been default and is the preferred usage.

Makes #6396 obsolete.

@larshg larshg force-pushed the removezlibusedinsurfacenurbs branch from 75bc47f to a45d48c Compare January 26, 2026 14:12
Copy link
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would keep the HAVE_ZLIB preprocessor-define and the WITH_SYSTEM_ZLIB option, and either warn or error-out if WITH_SYSTEM_ZLIB is FALSE. That's a smoother transition for people who use one or the other. And zlib.cmake can probably be removed now?

@larshg
Copy link
Contributor Author

larshg commented Jan 27, 2026

Have updated accordingly.

@larshg larshg requested a review from Copilot January 28, 2026 14:10
@larshg larshg added this to the pcl-1.16.0 milestone Jan 28, 2026
@larshg larshg added module: surface module: io changelog: removal Meta-information for changelog generation labels Jan 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes locally bundled zlib source files from the PCL codebase and transitions to using external system zlib exclusively. The PR description states "External zlib has been default and is the preferred usage."

Changes:

  • Removes all local zlib source and header files from surface/src/3rdparty/opennurbs/ and surface/include/pcl/surface/3rdparty/opennurbs/
  • Removes zlib.cmake build configuration file
  • Updates CMakeLists.txt files to require external ZLIB package and use the modern ZLIB::ZLIB target
  • Simplifies header files to always use external zlib instead of conditionally using bundled zlib
  • Adds deprecation warning for WITH_SYSTEM_ZLIB option

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
surface/src/on_nurbs/fitting_curve_2d_asdm.cpp UNRELATED: Removes m_data->interior_normals.clear() call - appears to be an accidental inclusion
surface/src/3rdparty/opennurbs/*.c Removes all bundled zlib C source files (zutil, uncompr, trees, inftrees, inflate, inffast, infback, crc32, compress, adler32)
surface/src/3rdparty/opennurbs/zlib.cmake Removes zlib CMake configuration file
surface/src/3rdparty/opennurbs/opennurbs_zlib.cpp Removes conditional compilation blocks for bundled zlib, adds include for pcl_config.h
surface/include/pcl/surface/3rdparty/opennurbs/*.h Removes all bundled zlib header files (zutil, zconf, trees, opennurbs_zlib, inftrees, inflate, inffixed, inffast, examples_linking_pragmas, deflate)
surface/CMakeLists.txt Replaces conditional zlib logic with required find_package(ZLIB) and uses modern ZLIB::ZLIB target
io/CMakeLists.txt Adds ZLIB to optional dependencies and links ZLIB::ZLIB when PNG is found
CMakeLists.txt Deprecates WITH_SYSTEM_ZLIB option and always searches for system ZLIB

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -265,7 +265,6 @@ FittingCurve2dASDM::assembleInterior (double wInt, double sigma2, double rScale,
m_data->interior_line_start.clear ();
m_data->interior_line_end.clear ();
m_data->interior_error.clear ();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line deletion appears to be unrelated to the purpose of this PR which is to remove local zlib files. The removal of m_data->interior_normals.clear() is a functional change to the code logic. Looking at the rest of the function, interior_normals is still being used at lines 275, 331, and 341, so this deletion may cause inconsistent state. This change should either be removed from this PR or explained in the PR description if it's intentional.

Copilot uses AI. Check for mistakes.
Copy link
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove examples_linking_pragmas.h? That belongs to opennurbs, not zlib

CMakeLists.txt Outdated
endif()
else()
message(WARNING "CMake will use a ZLIB version bundled with the PCL source code. However, that is an older version which may pose a risk and may be removed in a future PCL release. It is recommended to install an up-to-date version of ZLIB on your system and set WITH_SYSTEM_ZLIB=TRUE.")
message(WARNING "WITH_SYSTEM_ZLIB option is deprecated, has no effect and will be removed in 1.18.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
message(WARNING "WITH_SYSTEM_ZLIB option is deprecated, has no effect and will be removed in 1.18.")
if(NOT WITH_SYSTEM_ZLIB)
message(WARNING "WITH_SYSTEM_ZLIB option is deprecated, has no effect and will be removed in 1.18.")
endif()

Maybe like this, so that the warning is not always displayed, only when someone chooses the deprecated behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess when we remove it, people will just see a warning if the supply the argument on cmake call, that it won't be used. Thats why I went with showing always. Maybe it can be checked if the variable is defined or not and if defined, then we print the message.

@larshg
Copy link
Contributor Author

larshg commented Jan 29, 2026

Ahh, maybe I was too quick - I probably removed since I saw zlib in there: https://github.com/PointCloudLibrary/pcl/pull/6399/changes#diff-a4d0602f96c844e85341ecf937a6d4d39aeb46a4c8acbc51fda8ee7a67033450L62

But we can keep it.

Using system installed zlib.
…causes a out-of-vector bound if its cleared.

Example works afterwards.
@larshg larshg force-pushed the removezlibusedinsurfacenurbs branch from 1aabed4 to e134f0f Compare January 29, 2026 18:02
Copy link
Member

@mvieth mvieth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay sure, the CMake default not-used warning is fine, too.

@larshg larshg merged commit a113c61 into PointCloudLibrary:master Jan 30, 2026
13 checks passed
@larshg larshg deleted the removezlibusedinsurfacenurbs branch January 30, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: removal Meta-information for changelog generation module: io module: surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants