Skip to content

GH-47412: [C++] Use inlineshidden visibility in Meson configuration#47413

Merged
kou merged 2 commits intoapache:mainfrom
WillAyd:meson-symbol-hiding
Sep 5, 2025
Merged

GH-47412: [C++] Use inlineshidden visibility in Meson configuration#47413
kou merged 2 commits intoapache:mainfrom
WillAyd:meson-symbol-hiding

Conversation

@WillAyd
Copy link
Copy Markdown
Contributor

@WillAyd WillAyd commented Aug 22, 2025

Rationale for this change

I was under the false impression that 'hidden' visibility hid the most symbols from shared libraries. As it turns out, 'inlineshidden' performs the most symbol hiding, so we can achieve the best hygeine and smallest libraries from that option.

A local release build shows the following library sizes on main:

21M src/arrow/libarrow-compute.so
16M src/arrow/libarrow.so
21M src/arrow/flight/libarrow-flight.so
2.5M src/arrow/acero/libarrow-acero.so

With this PR showing a small improvement in some libraries:

21M src/arrow/libarrow-compute.so
16M src/arrow/libarrow.so
20M src/arrow/flight/libarrow-flight.so
2.4M src/arrow/acero/libarrow-acero.so

What changes are included in this PR?

Usage of 'hidden' has been replaced with 'inlineshidden'. I also added hidden symbol visibility to the compute library, where it was errantly missing before

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #47412 has been automatically assigned in GitHub to PR creator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The CMake configuration currently does not have this export macro, and it looks like the FlightDataDeserialize test currently has:

  GTEST_SKIP() << "Can't use Protobuf symbols on Windows";

So perhaps this should be ported to CMake as well? Not sure the extent of Flight support on Windows, but maybe @lidavidm has thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC every time I've tried, it's turned out that protoc doesn't actually insert the dllexport declarations in the right places and you get something unusable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But maybe it's fixed now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At least locally I see this inserted for each class in the generated file in the build folder

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suppose if it works now we can port it over

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great - I'll open a separate issue for that tomorrow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See #47429 - my naieve attempt at a fix did not work. Looks like there are some more complicating factors with how gRPC and the Flight tests are getting linked...but in any case its there to track

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Aug 25, 2025
@WillAyd WillAyd force-pushed the meson-symbol-hiding branch 2 times, most recently from 271c0c1 to 408bea9 Compare August 25, 2025 17:26
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Aug 25, 2025
@WillAyd WillAyd force-pushed the meson-symbol-hiding branch from 408bea9 to 3c06f4a Compare September 4, 2025 15:39
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 4, 2025
@lidavidm
Copy link
Copy Markdown
Member

lidavidm commented Sep 4, 2025

CC @kou

Copy link
Copy Markdown
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou merged commit 556c239 into apache:main Sep 5, 2025
41 checks passed
@kou kou removed the awaiting change review Awaiting change review label Sep 5, 2025
@github-actions github-actions bot added the awaiting merge Awaiting merge label Sep 5, 2025
@conbench-apache-arrow
Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 556c239.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

zanmato1984 pushed a commit to zanmato1984/arrow that referenced this pull request Oct 15, 2025
…tion (apache#47413)

### Rationale for this change

I was under the false impression that 'hidden' visibility hid the most symbols from shared libraries. As it turns out, 'inlineshidden' performs the most symbol hiding, so we can achieve the best hygeine and smallest libraries from that option.

A local release build shows the following library sizes on main:

21M	src/arrow/libarrow-compute.so
16M	src/arrow/libarrow.so
21M	src/arrow/flight/libarrow-flight.so
2.5M	src/arrow/acero/libarrow-acero.so

With this PR showing a small improvement in some libraries:

21M	src/arrow/libarrow-compute.so
16M	src/arrow/libarrow.so
20M	src/arrow/flight/libarrow-flight.so
2.4M	src/arrow/acero/libarrow-acero.so

### What changes are included in this PR?

Usage of 'hidden' has been replaced with 'inlineshidden'. I also added hidden symbol visibility to the compute library, where it was errantly missing before

### Are these changes tested?

Yes

### Are there any user-facing changes?

No
* GitHub Issue: apache#47412

Authored-by: Will Ayd <william.ayd@icloud.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants