无法在 Android 上加载 libGL.so

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11332817/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:01:23  来源:igfitidea点击:

Failed to load libGL.so on Android

android

提问by php.khan

I am using Ubuntu 12.04(Precise Pangolin) with the Oracle JDK7, and when I am running the Android emulator from Eclipse, it's giving this error:

我将Ubuntu 12.04(精确穿山甲)与 Oracle JDK7 一起使用,当我从Eclipse运行 Android 模拟器时,出现以下错误:

[2012-07-04 02:52:10 - Emulator] error libGL.so: cannot open shared object file: No such file or directory 
[2012-07-04 02:52:10 - Emulator] Failed to load libGL.so

Also the emulator is very slow. How can I solve this problem?

模拟器也很慢。我怎么解决这个问题?

采纳答案by user1410657

I have the Android SDK installed into ~/android-sdk-linux_x86, so I did:

我将 Android SDK 安装到 ~/android-sdk-linux_x86 中,所以我做了:

ln -s /usr/lib/libGL.so.1 ~/android-sdk-linux_x86/tools/lib/libGL.so

This solves errors just like linking to /usr/lib does, but it doesn't require root and doesn't mess with core system directories.

这就像链接到 /usr/lib 一样解决了错误,但它不需要 root 并且不会弄乱核心系统目录。

回答by libo

On 64-bit Ubuntu 12.04, do it like this:

在 64 位 Ubuntu 12.04 上,这样做:

$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
  libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
  libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
  python-markdown libxml2-utils xsltproc zlib1g-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Source: Installing required packages (Ubuntu 12.04)

来源:安装所需的软件包(Ubuntu 12.04)

回答by Wood Dragon

For 32-bit Ubuntu 12.04 LTS, this worked:

对于 32 位 Ubuntu 12.04 LTS,这有效:

sudo apt-get install libgl1-mesa-dev

None of the following worked:

以下均无效:

cd /usr/lib/i386-linux-gnu/mesa/
sudo ln -s libGL.so.1.2 libGL.so 
sudo ln -s libGL.so.1.2 /usr/lib/libGL.so
ln -s libGL.so.1.2 ~/android/android-sdk-linux/tools/lib/libGL.so

回答by user1289608

I am using Ubuntu 12.04 64-bit. Using the following command to solve the problem

我正在使用 Ubuntu 12.04 64 位。使用以下命令解决问题

 sudo ln -s /usr/lib32/fglrx/libGL.so.1.2 /usr/lib/libGL.so

Note: This is applicable only to those who use the AMD/ATI graphic drivers.

注意:这仅适用于使用 AMD/ATI 图形驱动程序的用户。

回答by Frank AFRIAT

What works for me (ubuntu 12.04 64bit) was just to run :

对我有用的(ubuntu 12.04 64bit)只是运行:

    sudo apt-get install libgl1-mesa-dev

I found that libGL.soexists in directory /usr/lib/x86_64-linux-gnu/

我发现libGL.so存在于目录中/usr/lib/x86_64-linux-gnu/

Installation of 32 bit version was not working.

安装 32 位版本不起作用。

回答by inder

On 64 bit Ubuntu 12.04, there is no /usr/lib64. It is /usr/lib only. Also, on my machine, libGL.so isn't present. Instead the file is libGLEW.so

在 64 位 Ubuntu 12.04 上,没有 /usr/lib64。它只是/usr/lib。另外,在我的机器上,libGL.so 不存在。相反,文件是 libGLEW.so

To install /usr/lib/LibGL.so you can run: sudo apt-get install libgl1-mesa-dev

要安装 /usr/lib/LibGL.so 你可以运行: sudo apt-get install libgl1-mesa-dev

However, it didn't solve the problem for me. In fact, it probably screwed up my system.

但是,它并没有为我解决问题。事实上,它可能搞砸了我的系统。

回答by sergio91pt

I think I got it right, no warnings and no slowness... This might not work with proprietary drivers, though.

我想我做对了,没有警告,也没有缓慢……不过,这可能不适用于专有驱动程序。

Make sure libgl1-mesa-glx:i386 is installed (even if you got a x64 SO file). Then do:

确保安装了 libgl1-mesa-glx:i386(即使您有 x64 SO 文件)。然后做:

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2 /usr/lib/libGL.so

回答by marcantonio

This worked for me on 64 bit Ubuntu 12.10 and the ADT bundle:

这在 64 位 Ubuntu 12.10 和 ADT 包上对我有用:

ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 ~/adt-bundle-linux-x86_64/sdk/tools/lib/libGL.so

If you don't have /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1just install libgl1-mesa-glx

如果你没有/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1刚刚安装libgl1-mesa-glx

sudo apt-get install libgl1-mesa-glx

回答by jAbreu

I use Linux Mint14 - 64 bit and for me, it worked :) :

我使用Linux Mint14 - 64 位,对我来说,它有效:):

sudo apt-get install libgl1-mesa-glx libgl1-mesa-dev

回答by user1860888

NVidia Optimus:

英伟达擎天柱:

Running on dual graphics (intel and nvidia), I used the following:

在双显卡(英特尔和英伟达)上运行,我使用了以下内容:

  1. Install Bumblebee (see: https://wiki.ubuntu.com/Bumblebee#Installation)
  2. Install the required lib.
  3. Run the emulator on the nvidia discrete card.
  1. 安装 Bumblebee(参见:https: //wiki.ubuntu.com/Bumblebee#Installation
  2. 安装所需的库。
  3. 在 nvidia 独立卡上运行模拟器。

This should do the trick:

这应该可以解决问题:

sudo add-apt-repository ppa:bumblebee/stable
sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update 
sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic 
sudo apt-get install ia32-libs

Whenever you wish to run the emulator, just use optirun:

每当您希望运行模拟器时,只需使用 optirun:

optirun emulator @<avd_name>

I should give a warning that I only installed Linux yesterday. So I don't really know what I'm doing….

我应该警告我昨天才安装了 Linux。所以我真的不知道我在做什么......