【问题标题】:Define location of libgcc_s.so.1定义 libgcc_s.so.1 的位置
【发布时间】:2020-06-01 22:12:48
【问题描述】:

首先,我在一个没有 SUDO 权限的 Debian VPS 中,不可能安装任何东西。

我想运行一个程序:

./program

它告诉我它需要 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

我的问题是,有没有一种无需安装 gcc-multilib(无需 sudo)即可运行程序的方法? 我想也许我可以在本地下载 gcc-multilib 并指定执行路径,但我不知道如何。

【问题讨论】:

    标签: linux dependencies debian libgcc


    【解决方案1】:

    根据您编译程序的方式和运行它的系统,您应该能够告诉系统使用 LD_LIBRARY_PATH 在特定目录中加载/查找其他库。

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

    来自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!)
    

    从错误消息来看,您似乎正在尝试在 64 位系统上运行 32 位二进制文​​件。添加正确的 32 位库应该可以让您运行您的程序。

    另一种选择是“简单地”为 64 位系统编译二进制文件。但是,如果您不在本机 64 位系统上,这可能会出现问题,并且可能会迫使您使用 cross compile

    【讨论】:

      猜你喜欢
      • 2011-07-02
      • 1970-01-01
      • 2021-02-24
      • 1970-01-01
      • 1970-01-01
      • 2019-10-09
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      相关资源
      最近更新 更多