Code Monkey home page Code Monkey logo

libtree's Introduction

Test AUR version

libtree

A tool that:

  • ๐ŸŒณ turns ldd into a tree
  • โ˜๏ธ explains why shared libraries are found and why not
  • ๐Ÿ“ฆ optionally deploys executables and dependencies into a single directory

example

Installation

Download the latest release from GitHub.

Static executable

wget -qO libtree https://github.com/haampie/libtree/releases/download/v2.0.0/libtree_x86_64
chmod +x libtree
./libtree $(which man)

Static executable + optional dependencies

wget -qO libtree.tar.gz https://github.com/haampie/libtree/releases/download/v2.0.0/libtree_x86_64.tar.gz
mkdir libtree
tar -xf libtree.tar.gz -C libtree
export PATH="$PWD/libtree:$PATH"
libtree $(which man)

Deploying binaries + dependencies into a folder

$ libtree $(which man) -d man.bundle --chrpath --strip
man
โ”œโ”€โ”€ libmandb-2.9.1.so [runpath]
โ”‚   โ”œโ”€โ”€ libman-2.9.1.so [runpath]
โ”‚   โ”‚   โ”œโ”€โ”€ libpipeline.so.1 [ld.so.conf]
โ”‚   โ”‚   โ””โ”€โ”€ libseccomp.so.2 [ld.so.conf]
โ”‚   โ””โ”€โ”€ libgdbm.so.6 [ld.so.conf]
โ”œโ”€โ”€ libman-2.9.1.so (collapsed) [runpath]
โ””โ”€โ”€ libpipeline.so.1 (collapsed) [ld.so.conf]

Deploying to "man.bundle/usr"
"/usr/bin/man" => "man.bundle/usr/bin/man"
"/usr/lib/man-db/libmandb-2.9.1.so" => "man.bundle/usr/lib/libmandb-2.9.1.so"
"/usr/lib/man-db/libman-2.9.1.so" => "man.bundle/usr/lib/libman-2.9.1.so"
"/usr/lib/x86_64-linux-gnu/libpipeline.so.1.5.2" => "man.bundle/usr/lib/libpipeline.so.1.5.2"
  creating symlink "man.bundle/usr/lib/libpipeline.so.1"
"/usr/lib/x86_64-linux-gnu/libseccomp.so.2.5.1" => "man.bundle/usr/lib/libseccomp.so.2.5.1"
  creating symlink "man.bundle/usr/lib/libseccomp.so.2"
"/usr/lib/x86_64-linux-gnu/libgdbm.so.6.0.0" => "man.bundle/usr/lib/libgdbm.so.6.0.0"
  creating symlink "man.bundle/usr/lib/libgdbm.so.6"

$ tree man.bundle/
man.bundle/
โ””โ”€โ”€ usr
    โ”œโ”€โ”€ bin
    โ”‚ย ย  โ””โ”€โ”€ man
    โ””โ”€โ”€ lib
        โ”œโ”€โ”€ libgdbm.so.6 -> libgdbm.so.6.0.0
        โ”œโ”€โ”€ libgdbm.so.6.0.0
        โ”œโ”€โ”€ libman-2.9.1.so
        โ”œโ”€โ”€ libmandb-2.9.1.so
        โ”œโ”€โ”€ libpipeline.so.1 -> libpipeline.so.1.5.2
        โ”œโ”€โ”€ libpipeline.so.1.5.2
        โ”œโ”€โ”€ libseccomp.so.2 -> libseccomp.so.2.5.1
        โ””โ”€โ”€ libseccomp.so.2.5.1

3 directories, 9 files

Verbose output

By default, certain standard dependencies are not shown. For more verbose output use

  • libtree -v $(which man) to show skipped libraries without their children
  • libtree -a $(which apt-get) to show the full recursive list of libraries

Use the --path or -p flags to show paths rather than sonames:

  • libtree -p $(which tar)

Changing search paths

libtree follows the rules of ld.so to locate libraries, but does not use ldconfig's cache. Instead it parses /etc/ld.so.conf at runtime. In fact you can change the search path config by setting --ldconf mylibs.conf. Search paths can be added as well via LD_LIBRARY_PATH="path1:path2:$LD_LIBRARY_PATH" libtree ....

Building

  • From source:
    git clone https://github.com/haampie/libtree.git
    cd libtree
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/path/to/cxxopts;/path/to/elfio;/path/to/termcolor" ..
    make -j
    make install
  • Using spack:
    spack install libtree +chrpath +strip
    spack load libtree
    

Known issues

  • When deploying libs with libtree app -d folder.bundle --chrpath, the runpaths are only changed when the binaries already have an rpath or runpath. This is a limitation of chrpath. Another option is to use patchelf instead, but this tool is known to break binaries sometimes.

libtree's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.