diff --git a/configs/components/runtime-agent.rb b/configs/components/runtime-agent.rb index 0bc871d1..b731e4ee 100644 --- a/configs/components/runtime-agent.rb +++ b/configs/components/runtime-agent.rb @@ -34,8 +34,8 @@ "#{settings[:bindir]}/libwinpthread-1.dll" # Used by the zlib default gem. - pkg.install_file "#{settings[:gcc_bindir]}/zlib1.dll", - "#{settings[:bindir]}/zlib1.dll" + pkg.install_file "#{settings[:gcc_bindir]}/libz-1.dll", + "#{settings[:bindir]}/libz-1.dll" end end end diff --git a/configs/components/runtime-openbolt.rb b/configs/components/runtime-openbolt.rb index a7775324..2a408fb1 100644 --- a/configs/components/runtime-openbolt.rb +++ b/configs/components/runtime-openbolt.rb @@ -19,7 +19,7 @@ # Matches what the ruby-lang.org builds copy into ruby_builtin_dlls pkg.install_file "#{settings[:gcc_bindir]}/libgmp-10.dll", "#{settings[:bindir]}/libgmp-10.dll" pkg.install_file "#{settings[:gcc_bindir]}/libwinpthread-1.dll", "#{settings[:bindir]}/libwinpthread-1.dll" - pkg.install_file "#{settings[:gcc_bindir]}/zlib1.dll", "#{settings[:bindir]}/zlib1.dll" + pkg.install_file "#{settings[:gcc_bindir]}/libz-1.dll", "#{settings[:bindir]}/libz-1.dll" end end end diff --git a/configs/platforms/windows-all-x64.rb b/configs/platforms/windows-all-x64.rb index a61c23cd..1cfa67a2 100644 --- a/configs/platforms/windows-all-x64.rb +++ b/configs/platforms/windows-all-x64.rb @@ -22,7 +22,6 @@ 'mingw64-x86_64-gcc-g++', 'mingw64-x86_64-gdbm', 'mingw64-x86_64-libffi', - 'mingw64-x86_64-readline', 'mingw64-x86_64-zlib', 'ruby', 'ruby-devel', diff --git a/tasks/build.rake b/tasks/build.rake index 89cc7019..c2c8945b 100644 --- a/tasks/build.rake +++ b/tasks/build.rake @@ -1,5 +1,25 @@ require 'fileutils' +# Returns the imports of toolchain DLLs that the package doesn't contain. They +# load during the build, where the toolchain is on PATH, and nowhere else. +def unshipped_toolchain_dlls(package_dir, toolchain_bindir) + binaries = Dir.glob("#{package_dir}/**/*.{dll,so,exe}") + abort "Found no binaries to check under #{package_dir}" if binaries.empty? + + shipped = binaries.map { |binary| File.basename(binary).downcase } + puts "Checking the DLL imports of #{binaries.size} binaries against #{toolchain_bindir}" + binaries.flat_map do |binary| + output, status = Open3.capture2('objdump', '-p', binary) + abort "Could not read the imports of #{binary} with objdump" unless status.success? + + output.scan(/DLL Name: (\S+)/).flatten.filter_map do |dll| + next if shipped.include?(dll.downcase) || !File.exist?(File.join(toolchain_bindir, dll)) + + "#{binary} imports #{dll}" + end + end +end + namespace :vox do desc 'Build vanagon project with Docker' task :build, [:project, :platform] do |_, args| @@ -24,5 +44,11 @@ namespace :vox do FileUtils.rm_rf('C:/ProgramFiles64Folder/') if platform =~ /^windows-/ run_command(cmd, silent: false, print_command: true, report_status: true) + + next unless platform =~ /^windows-/ + + toolchain_bindir = platform =~ /^windows-msys2-/ ? '/ucrt64/bin' : '/usr/x86_64-w64-mingw32/sys-root/mingw/bin' + unshipped = unshipped_toolchain_dlls('C:/ProgramFiles64Folder', toolchain_bindir) + abort "These binaries import DLLs that are not in the package:\n#{unshipped.join("\n")}" unless unshipped.empty? end end