Martín
Martín

Reputation: 11

Define location of libgcc_s.so.1

First of all I am in a Debian VPS without SUDO permissions, without possibility of installing anything.

I want to run a program:

./program

And it informs me that it needs libgcc_s.so.1:

ERROR: ld.so: object '/lib/snoopy.so' from /etc/ld.so.preload cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
./program: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory

My question is, is there a way to run the program without having to install gcc-multilib (without sudo)? I thought that maybe I could download gcc-multilib locally and specify the path in execution, but I don't know how.

Upvotes: 1

Views: 3214

Answers (1)

Bruno Ramos
Bruno Ramos

Reputation: 146

Depending on how you compiled your program and on the system you are running it on, you should be a able to tell the system to load/find additional libraries in a specific directory using LD_LIBRARY_PATH.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/custom/path/

From the manpage of ld.so

LD_LIBRARY_PATH

          A list of directories in which to search for ELF libraries at
          execution time.  The items in the list are separated by either
          colons or semicolons, and there is no support for escaping
          either separator.

          This variable is ignored in secure-execution mode.

          Within the pathnames specified in LD_LIBRARY_PATH, the dynamic
          linker expands the tokens $ORIGIN, $LIB, and $PLATFORM (or the
          versions using curly braces around the names) as described
          above in Rpath token expansion.  Thus, for example, the fol‐
          lowing would cause a library to be searched for in either the
          lib or lib64 subdirectory below the directory containing the
          program to be executed:

              $ LD_LIBRARY_PATH='$ORIGIN/$LIB' prog

          (Note the use of single quotes, which prevent expansion of
          $ORIGIN and $LIB as shell variables!)

Here from the error message it seems you are trying to run a 32bit binary on a 64bit system. Adding the correct 32bit libraries should allow you to run your program.

Another option would be to "simply" compile your binary for a 64bit system. But that might be problematic if you not on a native 64bit system and would probably force you to cross compile.

Upvotes: 0

Related Questions