Skip to content

Conversation

patrikhuber
Copy link
Contributor

@patrikhuber patrikhuber commented Sep 15, 2025

Currently, Open3D fails to compile on MSVC with the Ninja generator (Visual Studio CMake's default) with a "fatal error LNK1189: library limit of 65535 objects exceeded" when linking Open3D.dll. Comparing the export.def files of the Ninja and VS Generator builds shows tens-of-thousands of more exports for the Ninja build (most of them Eigen-related). Also, all the individual compiled .obj files (e.g. Indexer.obj) are about 50-100% larger in file size on Ninja compared to the VS Generator.

It turns out the issue is that MSBuild adds /Zc:inline by default to the cl command-line call (without it being present in CMake's CXX flags!), but of course Ninja won't do such "magic". So the flag needs to be added explicitly for Open3D to compile with other generators.

Note that /Zc:inline does not steer inlining behaviour (as the name might suggest), it merely "Removes unreferenced data or functions", as described by its documentation (https://learn.microsoft.com/en-us/cpp/build/reference/zc-inline-remove-unreferenced-comdat?view=msvc-170).

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes issue described above.
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

See above.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

See above.

MSBuild adds /Zc:inline by default, but it needs to be added explicitly for other generators (e.g. Ninja), for Open3D to compile (the linker fails otherwise with a "fatal error LNK1189: library limit of 65535 objects exceeded"). /Zc:inline will remove unreferenced data and functions from object files.
Copy link

update-docs bot commented Sep 15, 2025

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant