Add helper function to gather output from ldd