Find the answer to your Linux question:
Results 1 to 4 of 4
The problem that I am having is that for example. I compile and install a executable like /bin/bash and I decide to copy the executable to a usb drive and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Location
    USA
    Posts
    8

    Explanation of Compiling a bin/executable!!


    The problem that I am having is that for example. I compile and install a executable like /bin/bash and I decide to copy the executable to a usb drive and i compile new libs to place with it. This is what I want to know why can I not relink the executable to the new libs on the usb drive. If the executable was compiled to be 32-bit in nature then I should be able to move it to the usb drive and still run the application. If there is a way I would like to know. thanks!

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    you don't need to relink the libs (if i understand your prob correctly). you could try one of these:

    1) mount the USB disk to a path that would reflect where the binary (e.g., /bin/bash) expects to find the libs (which is probably impractical)

    2) mount the USB drive anywhere and use symlinks to get the libs to be found by the binary

    3) use the LD_LIBRARY_PATH variable to tell the binary where the libs are to be found

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Location
    USA
    Posts
    8
    Ok, So i would export LD_LIBRARY_PATH to the usb path to relink, to say use as a chroot environment. That would link everything after source ~/.bash_profile. So it really does not matter what the output of ldd /usr/bin/bash as long as those libs are placed within the lib dir when relinking with LD_LIBRARY_PATH. I am just trying to build a system from scratch, using only 32-bit executables and copying everything over to a usb drive to test out to see if it will work. Thanks for the response.

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    you might also be interested in the LD_PRELOAD variable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •