同时使用32位和64位 libGL.so 问题

61 views
Skip to first unread message

laminic

unread,
Mar 30, 2015, 12:51:25 PM3/30/15
to gentoo...@googlegroups.com
前端时间执行了系统更新,升级了 gnome-shell 到 3.14.3 重启后就 crash 了,
查资料发现在 .xprofile 文件中增加
export LD_PRELOAD=/usr/lib64/opengl/ati/lib/libGL.so
可以使 gnome-shell 正常工作。
但是
使用 adb 命令 或 eclipse 运行时提示
[2015-03-31 00:33:07 - adb] ERROR: ld.so: object '/usr/lib64/opengl/ati/lib/libGL.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.

在命令行中使用 adb 我使用一个脚本解决

#!/bin/bash
env LD_PRELOAD=/usr/lib32/opengl/ati/lib/libGL.so $ANDROID_SDK/platform-tools/adb $*

但是 eclipse 不行,

感觉这种搞法很别扭,有没有彻底解决这类问题的办法?

同时 gdm 自从某此更新后就再也启动不起来了,不得已现在换成 lightdm ,不知道 gdm 是不是同样的问题

AR

unread,
Mar 30, 2015, 10:37:39 PM3/30/15
to gentoo...@googlegroups.com
某的机器上显示

ldd adb
linux-gate.so.1 (0xf75df000)
librt.so.1 => /lib32/librt.so.1 (0xf75a6000)
libdl.so.2 => /lib32/libdl.so.2 (0xf75a1000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf7586000)
libstdc++.so.6 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/32/libstdc++.so.6 (0xf747e000)
libm.so.6 => /lib32/libm.so.6 (0xf7436000)
libgcc_s.so.1 =>
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/32/libgcc_s.so.1 (0xf741a000)
libc.so.6 => /lib32/libc.so.6 (0xf7275000)
/lib/ld-linux.so.2 (0xf75e0000)

所以至少可以知道adb是32位的。

不过没看到adb需要使用libGL呀,难道还去调用其他库。


至于gnome-shell那个得查查是不是还有其他环境变量可以更精确地指定使
用的libGL位置。类似libav在调用vdpau时。

--
Silence is golden.

microcai

unread,
Mar 31, 2015, 12:34:54 AM3/31/15
to gentoo...@googlegroups.com
on Tuesday 31 March 2015 10:37:17,AR wrote:
> 2015-03-31 0:51 GMT+08:00 laminic <lam...@gmail.com>:
>
> > 前端时间执行了系统更新,升级了 gnome-shell 到 3.14.3 重启后就 crash 了,
> > 查资料发现在 .xprofile 文件中增加
> > export LD_PRELOAD=/usr/lib64/opengl/ati/lib/libGL.so
> > 可以使 gnome-shell 正常工作。
> > 但是
> > 使用 adb 命令 或 eclipse 运行时提示
> > [2015-03-31 00:33:07 - adb] ERROR: ld.so: object
> > '/usr/lib64/opengl/ati/lib/libGL.so' from LD_PRELOAD cannot be preloaded
> > (wrong ELF class: ELFCLASS64): ignored.
> >
> >

使用 overlay 里的 adb是从源码编译出来的, 64位。

laminic

unread,
Mar 31, 2015, 4:00:53 AM3/31/15
to gentoo...@googlegroups.com

调用 adb devices 时有用到libGL.so

laminic

unread,
Mar 31, 2015, 4:07:13 AM3/31/15
to gentoo...@googlegroups.com

用仓库里包 android-tools 自己编译的可以

laminic

unread,
Apr 25, 2015, 3:50:45 AM4/25/15
to gentoo...@googlegroups.com
这样还是没有从根本上解决问题,很多程序都会出现这个问题
$ jd-gui
ERROR: ld.so: object '/usr/lib64/opengl/ati/lib/libGL.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored
有办法彻底解决这样的问题吗

AR

unread,
Apr 27, 2015, 2:27:20 AM4/27/15
to gentoo...@googlegroups.com
你的系统是支持multilib的吧?看看/usr/lib是符号链接到哪里的。

一般AMD64的multilib中,/usr/lib都是符号链接到/usr/lib64而动态
链接libGL.so自然就默认寻找64位的了。

现在Gentoo有原生的ABI_X86_32与64支持,所以源代码编译的
一般都没问题。

看看可能的话尽量用支持64位的版本?


不过照这个道理来看,不论是自己编译的icedtea还是二进制发行的
都应该已经支持multilib才对呀。

你是具体跑什么工具,在哪里下的会出现这个问题?


顺带一提,某用的不是任何一种DE,而是awesome...

--
Silence is golden.

laminic

unread,
Apr 28, 2015, 10:09:06 AM4/28/15
to gentoo...@googlegroups.com
我检查了 /usr/lib  和 /lib 都是指向 64位版本,
昨天按照下面的更新说明开启了 abi_86_32 重新编译了大量的包,同时删除了 app-emulation/emul-linux-x86*,问题还是存在
我重新描述下问题:


某天更新系统gnome升级到:GNOME Shell 3.14.3后GNOME就开不起来了,ati-drivers 版本是14.12-r3, xorg-server版本是1.16.4
情况和 这个帖子是一样的 https://forums.gentoo.org/viewtopic-p-7720806.html
在回复中看到
export COGL_DRIVER=gl 
export COGL_OVERRIDE_GL_VERSION=1.4 
export COGL_RENDERER=GLX 
export LD_PRELOAD=/usr/lib64/opengl/ati/lib/libGL.so 
exec gnome-session

其实我只要在 .xprofile 中加上 export LD_PRELOAD=/usr/lib64/opengl/ati/lib/libGL.so gnome就可以正常启动

加上这句后 像 android sdk 包中的 adb 和 jd-gui 就不能使用了,
提示ERROR: ld.so: object '/usr/lib64/opengl/ati/lib/libGL.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored

在执行这两个工具前加上 LD_PRELAOD=/usr/lib32/opengl/ati/lib/libGL.so 这两个工具就可以正常执行了


查资料说32或64的ELF文件中指定的动态链接器是不同的

$~/Java/android-sdk-linux/platform-tools $ file adb   #32位的adb
adb: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.15, not stripped

$ file ~/c/getinfo   #一个64位ELF
/home/mr.liyanh/c/getinfo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

可以看到确实是不同的加载器,之后就不明白了,ld-linux.so 查找动态库的顺序是怎样的, /usr/lib 指向  /lib32 和 /lib64 有什么不同,32位程序和64位程序是怎么在一起执行那个的

我知道 LD_PRELAOD 的优先级很高,指定了这个变量会优先查找,找到了就直接使用了,导致 adb 和 jd-gui 不能正确识别
目前已经把这个变量从 .xprofile 中删除,退到 xfce4 环境中使用(gnome 经常出问题,xfce4放心很多)

附:
2015-03-28-true-multilib
  Title                     True multilib support on amd64
  Author                    Michał Górny <mgo...@gentoo.org>
  Posted                    2015-03-28
  Revision                  1

Starting on 2015-03-29, we are enabling true multilib support on amd64
and masking the old emul-linux-x86 package sets for removal. This
change provides our users with the opportunity to build 32-bit libraries
from source with all the flexibility given by ebuilds and the security
of using mainline ebuilds, rather than relying on pre-packaged binary
versions of them.

The switch to the new system is likely to require a specific action from
the users of our multilib profiles. Since the new system collides with
the old one, the Package Manager must be able to clearly satisfy all
the dependencies using the new system in order to proceed. This may
require unmerging packages installed from third-party repositories that
have not been updated to support the new system.

In order to enable building necessary 32-bit libraries, users will be
required to enable the abi_x86_32 USE flag on respective packages.
This can be done using /etc/portage/package.use entries alike
the following:

    sys-libs/zlib abi_x86_32

In most of the cases, Portage will be able to deliver correct
suggestions for that when using the --autounmask feature. However, some
users may prefer setting ABI_X86 globally to enable 32-bit libraries
in all packages that support building them. This can be done using
the following package.use entry:

    */* abi_x86_32

In case of issues, blockers especially, users are recommended
to manually uninstall any emul-linux-x86 packages that may have been
installed on their systems. This will aid the Package Manager
in choosing the correct dependency resolution path. If using Portage,
this can be done using the following command:

    $ emerge -C 'app-emulation/emul-linux-x86*'

Note: 32-bit applications may be temporarily broken after this step.
Therefore, it should be followed by a @world upgrade immediately.



--
Silence is golden.

AR

unread,
Apr 28, 2015, 9:41:49 PM4/28/15
to gentoo...@googlegroups.com
是啊。某也怀疑和gnome-shell关系比较大。挺多问题都是gnome-shell和lightdm相关的。
那个帖后面有个redhet那里的issue也许可以跟进一下。

--
Silence is golden.

microcai

unread,
Apr 29, 2015, 4:49:26 AM4/29/15
to Gentoo China
eselect opengl 执行过了么?

laminic

unread,
Apr 29, 2015, 5:41:22 AM4/29/15
to gentoo...@googlegroups.com
执行过了,显示如下:
# eselect opengl list
Available OpenGL implementations:
  [1]   ati *
  [2]   xorg-x11

Reply all
Reply to author
Forward
0 new messages