This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit c8bb992227b037a7321171d39b9b1b57b3461349 Author: Jim Jagielski <[email protected]> AuthorDate: Mon Aug 3 12:23:00 2026 -0400 Improve macOS/arm64 build linting a full run on Mac Silicon --- main/RepositoryExternal.mk | 9 ++++++- main/avmedia/source/macavf/macavf_uno.cxx | 2 ++ main/forms/util/makefile.mk | 16 ++++++++++++- main/solenv/bin/macosx-dylib-link-list.pl | 11 ++++++++- main/solenv/bin/modules/macosxotoolhelper.pm | 36 ++++++++++++++++++++++------ main/vcl/inc/aqua/salgdi.h | 4 ++-- main/xmlsecurity/util/makefile.mk | 11 +++++++++ 7 files changed, 77 insertions(+), 12 deletions(-) diff --git a/main/RepositoryExternal.mk b/main/RepositoryExternal.mk index 178fc69f80..1d4d32be6f 100644 --- a/main/RepositoryExternal.mk +++ b/main/RepositoryExternal.mk @@ -142,7 +142,14 @@ $(call gb_LinkTarget_set_include,$(1),\ $$(INCLUDE) \ $(LIBXML_CFLAGS) \ ) -$(call gb_LinkTarget_add_libs,$(1),$(LIBXML_LIBS)) + +# Some system libxml2 builds report -licuuc in their link flags because +# libxml2 itself was built against ICU. That ICU dependency is already +# satisfied inside libxml2's own dylib; forwarding -licuuc to consumers +# makes them link this tree's bundled (OOO-layer) ICU directly, which +# breaks URE-layer consumers on macOS (see macosx-change-install-names.pl, +# which has no rule for a URE library depending on an OOO one). +$(call gb_LinkTarget_add_libs,$(1),$(filter-out -licuuc,$(LIBXML_LIBS))) endef else # !SYSTEM_LIBXML diff --git a/main/avmedia/source/macavf/macavf_uno.cxx b/main/avmedia/source/macavf/macavf_uno.cxx index 30c67c83ed..a6cace7bd4 100644 --- a/main/avmedia/source/macavf/macavf_uno.cxx +++ b/main/avmedia/source/macavf/macavf_uno.cxx @@ -21,6 +21,8 @@ #include "macavf_manager.hxx" +#include <cppuhelper/implementationentry.hxx> + using namespace ::com::sun::star; // ------------------- diff --git a/main/forms/util/makefile.mk b/main/forms/util/makefile.mk index 4e3a5208ef..f276f52fe6 100644 --- a/main/forms/util/makefile.mk +++ b/main/forms/util/makefile.mk @@ -49,6 +49,20 @@ LIB1FILES=\ SHL1TARGET=$(TARGET)$(DLLPOSTFIX) +.IF "$(OS)$(SYSTEM_LIBXML)"=="MACOSXYES" +# The macOS shared-library link template (tg_shl.mk) always searches +# $(SOLARLIB) -- which includes /usr/lib -- before any of this makefile's +# own libs, and the SDK bundles its own older libxml2 under /usr/lib. A +# plain "-lxml2" (as pulled in by LIBXML2LIB) resolves to that bundled +# copy instead of the configured --with-system-libxml one, and it is +# missing symbols (xmlXPathValuePush, xmlXPathValuePop) that xformsxpath +# needs. Link the intended libxml2 by absolute path so the search order +# can't shadow it. +FORMS_LIBXML2LIB:=$(shell xml2-config --prefix)/lib/libxml2.dylib +.ELSE +FORMS_LIBXML2LIB=$(LIBXML2LIB) +.ENDIF + SHL1STDLIBS= \ $(EDITENGLIB) \ $(SALLIB) \ @@ -68,7 +82,7 @@ SHL1STDLIBS= \ $(TKLIB) \ $(SVXCORELIB) \ $(UCBHELPERLIB) \ - $(LIBXML2LIB) \ + $(FORMS_LIBXML2LIB) \ $(ICUUCLIB) \ $(ICUINLIB) diff --git a/main/solenv/bin/macosx-dylib-link-list.pl b/main/solenv/bin/macosx-dylib-link-list.pl index 1580caa8a6..8d1ba13a00 100644 --- a/main/solenv/bin/macosx-dylib-link-list.pl +++ b/main/solenv/bin/macosx-dylib-link-list.pl @@ -59,7 +59,16 @@ foreach (@ARGV) if (/^-l(.*)$/) { my $loc = locate("lib$1.dylib"); - handle($1, $loc) if defined $loc && otoolD($loc) =~ m'^(@.+/.+)\n$'; + # A makefile's STDLIBS/STDSHL lists can legitimately name the same + # library twice (accumulated from more than one variable). Unlike + # the @todo loop below, this pass had no dedup guard, so a repeated + # -lfoo emitted the same -dylib_file entry twice; ld then reports + # that entry as "recursively loading" instead of just ignoring the + # duplicate. + if (defined $loc && otoolD($loc) =~ m'^(@.+/.+)\n$') + { + handle($1, $loc) unless defined $done{$1}; + } } } foreach $file (@todo) diff --git a/main/solenv/bin/modules/macosxotoolhelper.pm b/main/solenv/bin/modules/macosxotoolhelper.pm index a5c814d2e0..33ab44ff8e 100644 --- a/main/solenv/bin/modules/macosxotoolhelper.pm +++ b/main/solenv/bin/modules/macosxotoolhelper.pm @@ -33,12 +33,34 @@ sub otoolD($) { my ($file) = @_; my $call = "otool -D $file"; open(IN, "-|", $call) or die "cannot $call"; - my $line = <IN>; - if( $line !~ /^\Q$file\E:\n$/ ) { - die "unexpected otool -D output (\"$line\", expecting \"$file:\")"; - } - $line = <IN>; - <IN> == undef or die "unexpected otool -D output"; + my @lines = <IN>; close(IN); - return $line; + + # A fat/universal binary (e.g. a Homebrew-installed library bundling + # x86_64 and arm64 slices) makes otool -D print one + # "<path> (architecture <arch>):" stanza per slice instead of the + # single "<path>:" header a thin binary gets. Every slice of the same + # library reports the same install name, so take it from the first + # stanza and ignore the rest. + # + # A slice with no install name (e.g. a loadable module/bundle, such as + # a PKCS#11 provider that is only ever dlopen()ed) prints its header + # with nothing after it -- callers rely on getting undef back for that + # case, same as otool -D on a thin file with no install name. + my $header_re = qr/^\Q$file\E(?: \(architecture [^)]+\))?:\n$/; + my @names; + my $i = 0; + while ($i < @lines) { + $lines[$i] =~ $header_re or + die "unexpected otool -D output (\"$lines[$i]\", expecting \"$file:\")"; + ++$i; + if ($i < @lines && $lines[$i] !~ $header_re) { + push @names, $lines[$i]; + ++$i; + } + } + return undef unless @names; + grep($_ ne $names[0], @names) and + die "otool -D reported differing install names across architectures for $file"; + return $names[0]; } diff --git a/main/vcl/inc/aqua/salgdi.h b/main/vcl/inc/aqua/salgdi.h index aa57334cea..42b62c0cd3 100644 --- a/main/vcl/inc/aqua/salgdi.h +++ b/main/vcl/inc/aqua/salgdi.h @@ -215,7 +215,7 @@ public: bool CheckContext(); void UpdateWindow( NSRect& ); // delivered in NSView coordinates void RefreshRect( const CGRect& ); -#ifndef __x86_64__ // on 64bit OSX NSRect is typedef'ed as CGRect +#ifndef __LP64__ // on 64bit OSX (both x86_64 and arm64) NSRect is typedef'ed as CGRect void RefreshRect( const NSRect& ); #endif void RefreshRect(float lX, float lY, float lWidth, float lHeight); @@ -449,7 +449,7 @@ inline void AquaSalGraphics::RefreshRect( const CGRect& rRect ) RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height ); } -#ifndef __x86_64__ // on 64bit OSX NSRect is typedef'ed as CGRect +#ifndef __LP64__ // on 64bit OSX (both x86_64 and arm64) NSRect is typedef'ed as CGRect inline void AquaSalGraphics::RefreshRect( const NSRect& rRect ) { RefreshRect( rRect.origin.x, rRect.origin.y, rRect.size.width, rRect.size.height ); diff --git a/main/xmlsecurity/util/makefile.mk b/main/xmlsecurity/util/makefile.mk index e21b114dfd..1e329f8b87 100644 --- a/main/xmlsecurity/util/makefile.mk +++ b/main/xmlsecurity/util/makefile.mk @@ -118,6 +118,17 @@ SHL2STDLIBS += $(NSS_LIBS) SHL2STDLIBS+= $(MSCRYPTOLIBS) # SHL2STDLIBS+= $(XMLSECLIB) $(LIBXML2LIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB) SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB) +.ELIF "$(OS)$(SYSTEM_LIBXML)"=="MACOSXYES" +# The macOS shared-library link template (tg_shl.mk) always searches +# $(SOLARLIB) -- which includes /usr/lib -- before any of this makefile's +# own libs, and the SDK bundles its own older libxml2 under /usr/lib. A +# plain "-lxml2" (as pulled in by NSSCRYPTOLIBS via LIBXML2LIB) resolves +# to that bundled copy instead of the configured --with-system-libxml one, +# and it is missing symbols (xmlCtxtPushInput, xmlXPathValuePush) that +# xmlsec1 needs. Link the intended libxml2 by absolute path so the +# search order can't shadow it. +XMLSECURITY_SYSTEM_LIBXML2:=$(shell xml2-config --prefix)/lib/libxml2.dylib +SHL2STDLIBS+= $(XMLSECLIB-NSS) $(XMLSECLIB) $(XMLSECURITY_SYSTEM_LIBXML2) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB) .ELSE SHL2STDLIBS+= $(NSSCRYPTOLIBS) .ENDIF
