macOS PDFium builds: install_name_tool fails due to header padding

54 views
Skip to first unread message

Tor

unread,
Apr 11, 2025, 12:32:32 PMApr 11
to pdfium
Hi all,

I'm using the prebuilt binaries from https://github.com/bblanchon/pdfium-binaries in a .NET MAUI application that targets Mac. When the build system tries to change the install_name of libpdfium.dylib using install_name_tool, I get this error:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool:
changing install names or rpaths can't be redone for: obj/Debug/net9.0-maccatalyst/maccatalyst-arm64/nativelibraries/Contents/MonoBundle/pdfm.dylib.tmp
(for architecture arm64) because larger updated load commands do not fit
(the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)

It seems like this might be due to the binaries being linked without headerpad_max_install_names, which means there’s no room in the Mach-O header to update the install name.

What’s odd is that the ARM version of the V8-enabled build seems to have enough space for install name changes, while the x64 version, and the non-V8 ARM and x64 versions, does not. So this might be a build config difference between architectures and versions.

The maintainer of pdfium-binaries mentioned that this is likely something that should be fixed upstream, which is why I’m bringing it up here. Would it make sense to include headerpad_max_install_names for macOS targets in the GN build files? Or is there a preferred way to handle this?

Thanks for any thoughts on this!

Best,
Tor Øyvind Fluør

Justin Pierce

unread,
Apr 13, 2025, 9:03:05 AMApr 13
to Tor, pdfium
You mean just as a compilation symbol / preprocessor directive? Is there any downside to including it? 

Have you tested a build on your end to ensure this will actually remedy your issue? Pdfium isn't too hard to build. 


From: pdf...@googlegroups.com <pdf...@googlegroups.com> on behalf of Tor <t...@casecrafter.com>
Sent: Friday, April 11, 2025 4:14:10 PM
To: pdfium <pdf...@googlegroups.com>
Subject: macOS PDFium builds: install_name_tool fails due to header padding
 
--
You received this message because you are subscribed to the Google Groups "pdfium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pdfium/4953a249-4839-4e8c-adbf-2691415203e9n%40googlegroups.com.

Tor

unread,
Apr 14, 2025, 10:29:15 AMApr 14
to pdfium
I have built Pdfium locally now, and changed the ldflags in BUILD.gn to ldflags = [ "-Wl,-headerpad_max_install_names" ].
Adding the linker parameter fixed my issues with long install names, and with the new dylibs my .NET MAUI program works on both my ARM and x64 Macs.
I have made a small GitHub project with the patch and some build script: https://github.com/Case-Crafter/pdfium-maccatalyst

I don't know if there are any downsides to including this.

Best,
Tor Øyvind Fluør

Justin Pierce

unread,
Apr 15, 2025, 3:50:28 PMApr 15
to Tor, pdfium
I will submit a bug report and subsequent change request for you
Sent: Monday, April 14, 2025 9:29:15 PM
To: pdfium <pdf...@googlegroups.com>
Subject: Re: macOS PDFium builds: install_name_tool fails due to header padding
 

Justin Pierce

unread,
May 2, 2025, 12:31:48 AMMay 2
to pdfium
Please see rejection of proposal here: https://issues.chromium.org/issues/410996561 with detailed information and possible next steps
Reply all
Reply to author
Forward
0 new messages