Closed fxcoudert closed 1 year ago
$ codesign -v -vvv /opt/homebrew/Cellar/poppler/22.06.0_1/bin/pdfinfo
/opt/homebrew/Cellar/poppler/22.06.0_1/bin/pdfinfo: invalid signature (code or signature have been modified)
In architecture: arm64
In the poppler formula we have this:
macho = MachO.open(f)
macho.change_dylib("@rpath/#{libpoppler}", "#{opt_lib}/#{libpoppler}")
macho.write!
but because the files are not resigned, they're now invalid binaries. This does not show on bottles, because when pouring bottles we resign everything. But it shows when building stuff locally.
Three formulas use that:
$ grep macho.change_dylib *
netcdf.rb: macho.change_dylib("@rpath/#{libnetcdf}", "#{lib}/#{libnetcdf}")
poppler-qt5.rb: macho.change_dylib("@rpath/#{libpoppler}", "#{opt_lib}/#{libpoppler}")
poppler.rb: macho.change_dylib("@rpath/#{libpoppler}", "#{opt_lib}/#{libpoppler}")
Needs to be codesign
ed after doing that. But we really don't need to call change_dylib
; we can just set CMAKE_INSTALL_RPATH
instead.
diff --git a/Formula/poppler.rb b/Formula/poppler.rb
index e610f7e24ef..a4bb5e5ff4b 100644
--- a/Formula/poppler.rb
+++ b/Formula/poppler.rb
@@ -69,7 +69,7 @@ class Poppler < Formula
-DWITH_GObjectIntrospection=ON
]
- system "cmake", ".", *args
+ system "cmake", ".", *args, "-DCMAKE_INSTALL_RPATH=#{rpath}"
system "make", "install"
system "make", "clean"
system "cmake", ".", "-DBUILD_SHARED_LIBS=OFF", *args
@@ -80,20 +80,6 @@ class Poppler < Formula
resource("font-data").stage do
system "make", "install", "prefix=#{prefix}"
end
-
- if OS.mac?
- libpoppler = (lib/"libpoppler.dylib").readlink
- [
- "#{lib}/libpoppler-cpp.dylib",
- "#{lib}/libpoppler-glib.dylib",
- "#{lib}/libpoppler-qt#{Formula["qt"].version.major}.dylib",
- *Dir["#{bin}/*"],
- ].each do |f|
- macho = MachO.open(f)
- macho.change_dylib("@rpath/#{libpoppler}", "#{opt_lib}/#{libpoppler}")
- macho.write!
- end
- end
end
test do
Yes, testing that fix in https://github.com/Homebrew/homebrew-core/pull/105964#issuecomment-1186380022
More cases:
ampl-mp.rb: MachO::Tools.change_install_name("bin/libasl.dylib", "@rpath/libmp.3.dylib",
boost-mpi.rb: MachO::Tools.change_install_name("#{lib}/libboost_mpi-mt.dylib",
boost-mpi.rb: MachO::Tools.change_install_name("#{lib}/libboost_mpi.dylib",
espeak.rb: MachO::Tools.change_dylib_id("#{lib}/libespeak.dylib", "#{lib}/libespeak.dylib") if OS.mac?
grpc.rb: MachO::Tools.add_rpath(bin/"grpc_cli", rpath)
grpc.rb: MachO::Tools.add_rpath(lib/shared_library("libgrpc++_test_config"), rpath)
libsvm.rb: MachO::Tools.change_dylib_id("#{lib}/libsvm.2.dylib", "#{lib}/libsvm.2.dylib") if OS.mac?
plplot.rb: MachO::Tools.change_install_name(f, d, d_new)
pypy.rb: MachO::Tools.change_install_name("#{libexec}/bin/pypy",
pypy3.rb: MachO::Tools.change_install_name("#{libexec}/bin/pypy3",
pypy3.rb: MachO::Tools.change_dylib_id("#{libexec}/lib/libpypy3-c.dylib",
rust.rb: MachO::Tools.change_dylib_id(dylib, "@rpath/#{File.basename(dylib)}")
This seems sufficiently fixed.
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Install poppler from source (
brew install -svd poppler
) then test it.What happened (include all command output)?
What did you expect to happen?
Should not be killed
Step-by-step reproduction instructions (by running
brew
commands)