Giter Club home page Giter Club logo

conda-binary-relocation-link's Introduction

conda-binary-relocation-link

Experiment with conda binary relocation in case of links

Using conda

Build a conda package:

conda build conda

There is three copy of the executable:

$ find /local/froger/miniconda/envs/_build/ -type f -executable -exec ls -l {} \;
-rwxr-xr-x 1 froger sed 8465 2015-01-05 11:06 /local/froger/miniconda/envs/_build/bin/foo
-rwxr-xr-x 1 froger sed 8465 2015-01-05 11:06 /local/froger/miniconda/envs/_build/libexec/foo-core/foo-cmd0
-rwxr-xr-x 1 froger sed 8465 2015-01-05 11:06 /local/froger/miniconda/envs/_build/libexec/foo-core/foo-cmd1

Reproduce manually

Manually build and install:

$ ./configure --prefix=$PWD/foo_install
$ make
$ make install

Each executable is a reference to the same inode (link):

$ find foo_install/ -type f -executable -exec ls -l {} \;
-rwxr-xr-x 3 froger sed 8465 2015-01-05 11:03 foo_install/bin/foo
-rwxr-xr-x 3 froger sed 8465 2015-01-05 11:03 foo_install/libexec/foo-core/foo-cmd0
-rwxr-xr-x 3 froger sed 8465 2015-01-05 11:03 foo_install/libexec/foo-core/foo-cmd1

Change rpath:

$ patchelf --set-rpath '$ORIGIN/../lib' foo_install/bin/foo
$ patchelf --set-rpath '$ORIGIN/../lib' foo_install/libexec/foo-core/foo-cmd0
$ patchelf --set-rpath '$ORIGIN/../lib' foo_install/libexec/foo-core/foo-cmd1

There is three copy of the executable:

$ find foo_install/ -type f -executable -exec ls -l {} \;
-rwxr-xr-x 1 froger sed 12561 2015-01-05 11:35 foo_install/bin/foo
-rwxr-xr-x 1 froger sed 12561 2015-01-05 11:35 foo_install/libexec/foo-core/foo-cmd0
-rwxr-xr-x 1 froger sed 12561 2015-01-05 11:35 foo_install/libexec/foo-core/foo-cmd1

Clean:

$ make clean
$ rm -rf foo_install

patchelf

patchelf breaks hardlinks:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759497
https://github.com/NixOS/patchelf/issues/32

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.