ERROR: ld.so: object 'libXXX32.so' from LD_PRELOAD cannot be preloaded: ignored.

在 x86_64 版本的 centos 5.x 运行 32 bit 的某程序,该程序需要利用 LD_PRELOAD 预先加载 libXXX32.so,也是 32 bit 的版本。

但是每次运行的时候,都会出现上面的提示,让我以为预先加载失败。

google 了一把,发现这个链接 ld.so too verbose when it can't LD_PRELOAD a 32 bit library on a 64 bit OS https://bugzilla.redhat.com/show_bug.cgi?id=249256

 

按照上面的说法,只要按照下面的步骤就可以重现这个问题

Description of problem:

If I set LD_PRELOAD to point to a 32 bit shared object when running a 32 bit
application on a 64 bit OS, ld.so (/lib64/ld-2.3.4.so) can report:

ERROR: ld.so: object '/path/to/some.so' from LD_PRELOAD cannot be preloaded:
ignored.

This can happen if the 32 bit application spawns a sub-process using the
system() call - because this calls /bin/sh which is a 64 bit binary (which
reports the 'ERROR') ...

Version-Release number of selected component (if applicable):

glibc-2.3.4-2.25

How reproducible:

Every time

Steps to Reproduce:
1. Set LD_PRELOAD to point to a 32 bit lib (on 64 bit OS)
2. Run 32 bit application that calls system()
3.

Actual results:

ERROR: ld.so: object '/path/to/some.so' from LD_PRELOAD cannot be preloaded:
ignored.

Expected results:

No 'ERROR' message

Additional info:

按照他的说法,对于32 bit的程序来说,预先加载已经是成功的,尽管出现这个消息。我比较了一下,发现我这边的情况也是类似的,不过这个提示信息确实比较雷人。
the 'ERROR' message cause users to report
problems where there are none. The word 'ERROR' is too strong - it's not really
an error as the application runs fine.






根据你提供的引用内容,"error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory"错误是因为系统找不到名为"libmpc.so.3"的共享库文件。这个错误可能是由于链接器ld无法找到库文件所在的路径。根据引用中的CMakeLists.txt的内容,可以看到库文件被放在了"/usr/local/lib"目录下,但是ld默认的目录是"/lib"和"/usr/lib"。所以需要将库文件所在的路径告诉ld。 为了解决这个问题,可以按照引用中的方法进行操作: 1. 将库文件复制到一个统一的目录,比如"/usr/local/lib"目录下:将"libmpc.so.3"文件复制到"/usr/local/lib"目录下,可以使用命令"cp libmpc.so.3 /usr/local/lib/"。 2. 编辑库文件配置文件,添加库文件所在目录:使用命令"vim /etc/ld.so.conf.d/usr-libs.conf"打开文件,在文件中添加一行"/usr/local/lib",保存文件。 3. 更新ld的缓存文件:使用命令"ldconfig"更新"/etc/ld.so.cache"文件。 完成以上步骤后,再次运行程序就不应该再出现"error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory"错误了。这样ld就能找到库文件所在的路径并正确加载库文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [解决error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file](https://blog.csdn.net/deeplan_1994/article/details/83927832)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值