0

There is a 32-bit program that I need to run on a 64-bit Ubuntu. When i try to run it, I have the following error :

program: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

When using my personal PCs, I have managed to solve this issue by using the following commands:

sudo dpkg --add-architecture i386 
sudo apt-get update 
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

However, I now need to run this program on another PC on which I can't have the sudo rights. I did a google search to solve this issue but haven't found anything conclusive.

So my question is: is there any way for me to run a 32-bit program on a 64-bit Ubuntu (14.04 LTS) without any sudo command ?

Edit : the program I am trying to use is ProFit V3.1

Edit for @EliahKagan : results of requested commands: On the target machine:

$ lsb_release -a
lsb_release : command not found

$ apt-cache policy libc6
apt-cache : command not found

$ file /lib/x86_64-linux-gnu/libc-*
/lib/x86_64-linux-gnu/libc-*: cannot open `/lib/x86_64-linux-gnu/libc-*' (No such file or directory)

Given these results, I'm not sure I should also give the results on my machine... ? On my machine:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5
LTS Release: 14.04
Codename: trusty
$ apt-cache policy libc6
libc6:
  Installed: 2.19-0ubuntu6.9
  Candidate: 2.19-0ubuntu6.9 [...]
$ file /lib/x86_64-linux-gnu/libc-*
/lib/x86_64-linux-gnu/libc-2.19.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs) [...]
  • No, you can't. If you could then you would be able to install anything else. What would we need passwords and root privileges for if not to prevent just that? – user589808 Jan 3 '17 at 16:25
  • Both systems run Ubuntu 14.04 LTS and have gcc and make installed. However I don't think I fully understand your answer, my English being quite limited... Are you saying I should download the source code and compile it on my PC, and copy the program on the target machine ? Could this really help with the missing library ? – Deuce Jan 3 '17 at 18:15
  • @Deuce The library dependencies should already be installed on the target machine in their 64-bit versions, since they're very common libraries that many core Ubuntu utilities depend on. If there were a pre-built 64-bit binary (compatible with those specific library versions) it would probably just work. So yes, I think if you make a 64-bit build then it will likely work on the target machine. (gcc and make aren't actually needed on the target machine if you're building everything on your own machine, but only if you were to build the software on the target machine itself.) – Eliah Kagan Jan 3 '17 at 18:22
1

The source code of ProFit 3.1 is available, officially and at no charge. So instead of attempting to run the pre-built 32-bit binary on a 64-bit system that doesn't have library support installed for it, I recommend building it from source as a 64-bit program.

One option is to build it on your system, where you can easily install anything needed for the build, and to bring the compiled binary to the other system where you also want to run it.

  1. Make sure your own system (the one on which you do have administrative rights) is up to date, then install some tools that are useful for compiling software:

    sudo apt update && sudo apt upgrade
    sudo apt install build-essential libncurses5-dev
    

    The libncurses5-dev package provides header files for one of the libraries this program needs. The others seem to all be dependencies of build-essential (which gives you some handy utilities too, like make, and a compiler if one is not installed yet).

    You mentioned libstdc++6 in your question. The package that would provide header files for that library is libstdc++6-4.7-dev. However, ProFit does not appear to actually use libstdc++6. So you should not have to install that particular -dev package.

  2. Download the source code archive for ProFit. This is the file named profit.tar.gz.

  3. Unpack the source code archive and go into the src subdirectory of where it was unpacked:

    tar xf profit.tar.gz
    cd ProFitV3.1/src
    
  4. Optionally, back up Makefile before modifying it:

    cp Makefile Makefile.orig
    
  5. As recommended in the official build instructions, open Makefile in a text editor of your choice (nano and vim will work, as will a graphical editor) and uncomment the lines that enable readline support.

    To open the file in nano:

    nano -w Makefile
    

    Find these lines:

    #READLINE    = -DREADLINE_SUPPORT
    #READLINELIB = -lreadline -lcurses
    

    These are lines 9 and 10. To uncomment them, remove the leading # from each so they look like this instead:

    READLINE    = -DREADLINE_SUPPORT
    READLINELIB = -lreadline -lcurses
    

    Save the file and quit the text editor. (Ctrl+X quits nano, and you'll be prompted to save your changes.)

  6. Build the program, by running just:

    make
    

    You'll see some compiler warnings but there should be no errors. (If there are errors, then we'll have to figure out what went wrong.)

  7. An executable called profit should now exist in the current directory. Try running it to see if it works:

    ./profit
    

    It worked for me. (As you probably know, you can then run quit to exit back to the shell.)

    ek@Io:~/src/ProFitV3.1/src$ ./profit
    
                      PPPPP                FFFFFF ii   tt
                      PP  PP               FF          tt
                      PP  PP rrrrr   oooo  FF     ii  ttttt
                      PPPPP  rr  rr oo  oo FFFF   ii   tt
                      PP     rr     oo  oo FF     ii   tt
                      PP     rr     oo  oo FF     ii   tt
                      PP     rr      oooo  FF      ii   ttt
    
                          Protein Least Squares Fitting
    
                                   Version 3.1
    
          Copyright (c) Dr. Andrew C.R. Martin, SciTech Software 1992-2009
                  Copyright (c) Dr. Craig T. Porter, UCL 2008-2009
    
    ProFit>quit
    ek@Io:~/src/ProFitV3.1/src$
    
  8. Go back to the parent directory of ProFit's top-level directory (i.e., the directory that contains the directory where you unpacked the .tar.gz archive). Create a new archive. This one includes the files created from the build.

    cd ../..
    tar cJvf ProFitV3.1.tar.xz ProFitV3.1/
    

    taring your build ensures that, no matter how you transfer it to the other system, reasonable permissions (including executable permissions on the profit binary) are maintained.

    xz compression is entirely optional, though. You could remove the J flag (and the .xz extension).

  9. Copy ProFitV3.1.tar.xz, which you just created, to the other system on which you want to use ProFit (the system on which you are not an administrator).

    How best to do this depends on you are provided access to the other system, and you probably already know the best way. But one way is scp:

    scp ProFit3.1.tar.xz remote-username@remote-hostname:

    That copies the file to your home directory on the other machine. (Don't forget the colon at the end.) You'll have to enter your password, unless key-based authentication has been set up. Of course this only works if you have access via SSH.

  10. On the other Ubuntu system, unpack the archive, cd to the location of the profit executable, and try running it:

    tar xf ProFitV3.1.tar.xz
    cd ProFitV3.1/src
    ./profit
    

    This worked for me. However, I tested this with two Ubuntu 16.04 systems. I have not had the chance to test it with Ubuntu 14.04.

  11. Perform any needed configuration, like setting HOMEDIR and DATADIR environment variables and, optionally, placing the executable in a different directory. This is covered in Installing under UNIX-like operating systems in the ProFit installation instructions.

    You can put export commands, as shown in those instructions, in the .profile file in your home directory. They will be set for subsequent logins. There are also other methods for setting per-user environment variables, and you do not need to be an administrator to do them. However, if you choose to use the method where you edit .pam_environment, you should be very careful; though it will not affect any other users on the system, a syntax error in your .pam_environment file will prevent you from logging in and you might need an administrator's help to undo the mistake.

ProFit has very few dependencies, compared to most software. So I expect this to work. (It worked for me.) Please let me know how it goes.

  • Thanks a lot for the amazingly detailed answer ! The error error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory went away, however, I have a new error : profit: /lib64/libc.so.6: version 'GLIBC_2.14' not found (required by profit). Do you know if I can do something about it ? – Deuce Jan 3 '17 at 20:18
  • It works fine on the machine where I am an administrator, but I get the error on the other machine. Should I downgrade libc6 on my machine before compiling profit ? – Deuce Jan 3 '17 at 20:31
  • My machine also runs the 64-bit version of Ubuntu. uname -m on my machine gives : x86_64 ; uname -m on the other machine also gives : x86_64 – Deuce Jan 3 '17 at 20:44
  • @Deuce It seems the other machine's glibc (libc6 package) is way older than your glibc. For two 14.04 systems, that's odd! This and these version numbers say Ubuntu's glibc >= 2.15 even back to 12.04. I don't recommend installing that (now quite old) version of libc6 on your Ubuntu system. Let's figure out just what's on each: lsb_release -a; apt-cache policy libc6; file /lib/x86_64-linux-gnu/libc-*. You can put results from both machines in your question. – Eliah Kagan Jan 3 '17 at 21:04
  • It's done. I have a feeling I won't be using ProFit on the other machine! – Deuce Jan 3 '17 at 21:35
2

The problem is not really about running 32bits binary on a 64bits platform those are retro compatible.

The problem is about installing new shared library system-wide which you do not have enough privileges for.

You might wanna search for a version of your binary which does not need shared libraries but is bundled with every libraries it needs.

EDIT :

If debootstrap and schroot are installed on that system you might want to chroot into a subfolder of your home and be root in that new system.

That would allow to have root privileges in that "virtual environment"

Explanations on how to achieve that can be found here : http://www.binarytides.com/setup-chroot-ubuntu-debootstrap/

  • 1
    Thanks a lot for the explanation and the answer. Debootstrap and schroot are not installed on that system. If no other answer can help with my problem, I will accept yours because it seems like it may help other people with a similar problem. – Deuce Jan 3 '17 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.