Skip to content

Instantly share code, notes, and snippets.

@faustinoaq
Last active December 6, 2017 03:11
Show Gist options
  • Save faustinoaq/9c0288007be86dc1b908f031b4a1dc37 to your computer and use it in GitHub Desktop.
Save faustinoaq/9c0288007be86dc1b908f031b4a1dc37 to your computer and use it in GitHub Desktop.
Extract binary dependencies (dynamic libraries) for crystal compiled program
executable = "bin/critter"
deps = [] of String
output = `ldd #{executable}`.scan(/(\/.*)\s\(/) do |m|
library = m[1]
deps << library
real_lib = File.real_path(library)
deps << real_lib if real_lib != library
end
deps.each do |dep|
`cp -v #{dep} deps/`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment