LoginSignup
14
13

More than 5 years have passed since last update.

CentOS6系にanrdoid-ndk-10eをインストール(ビルドは未検証)

Posted at

anrdoid-ndk-10e(64bit)をCentOS6系にインストールする必要があったがその場合に色々はまったのでメモ。

あくまでインストールまでの確認。そのあと実際に利用できるかまではまだ未検証なので注意

そもそも可能ならば

後述するがandroid-ndk-r10eではglibc2.14以上が要求される。
色々面倒なことをしたくないのであれば(というか可能だったら極力)OSのglibcのバージョンが2.14より大きいものを使えば良い。

RedHat系でのglibcの脆弱性(GHOST)への対応方法

上記に記載されている様にCentOS7やAmazonLinux、新しいUbuntuであればglibcが新しいので本当はそれを使ったほうが良さそう。ビルドしたりするとインストール後も色々はまりそう。。。(あとのメンテなども大変)

やってみる

$./android-ndk-r10e-linux-x86_64.bin
./android-ndk-r10e-linux-x86_64.bin: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./android-ndk-r10e-linux-x86_64.bin)

なるほど。GLIBCのバージョンが古いのでだめだと。

GLIBCのバージョンを確認

$ /lib64/libc.so.6
GNU C Library stable release version 2.12, by Roland McGrath et al.
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-11).
Compiled on a Linux 2.6.32 system on 2015-05-27.
Available extensions:
    The C stubs add-on version 2.1.2.
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
    RT using linux kernel aio
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

GLIBCで2.14以上が必要だけど実際には2.12なのでエラーだと

GLIBCをビルドしてみる

事前準備。ビルド時に必要なものをまとめてインストール。

$sudo yum groupinstall "Development Tools"

chroot 環境に glibc を突っ込むメモ

本当はやりたくないけど、しょうがないのでビルド。

$wget https://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz
$tar -zxvf glibc-2.14
$cd glibc-2.14
$mkdir BUILD
$cd BUILD
$../configure --prefix=${HOME}/local/glibc
$make
$make check
$make install

確認してみる。

~/local/glibc/lib/libc.so.6
GNU C Library stable release version 2.14, by Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-11).
Compiled on a Linux 2.6.32 system on 2015-08-06.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

2.14として認識しているので良さそう。

ndkの再インストール

まずは環境変数を設定。

$export LD_LIBRARY_PATH=~/local/glibc/lib/

ダウンロードして、実行してみる

$wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
$chmod a+x android-ndk-r10e-linux-x86_64.bin
$./android-ndk-r10e-linux-x86_64.bin
・・・
Sub items Errors: 1332

Archive Errors: 1

Sub items Errors: 1332

実行(解凍)ができるようになったけどエラーが出てしまった。。。

Error encountered installing Android NDK

同じことが起きている人がいるっぽい。
色々試行錯誤してみてもしかしてと思ってmd5sumしてみたら全然違ったので再度取得。。。

$wget http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
$chmod a+x android-ndk-r10e-linux-x86_64.bin
$md5sum android-ndk-r10e-linux-x86_64.bin
19af543b068bdb7f27787c2bc69aba7f  android-ndk-r10e-linux-x86_64.bin
$./android-ndk-r10e-linux-x86_64.bin
・・・
Everything is Ok

よさそう。

$android-ndk-r10e/ndk-build -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

認識できた。ビルドできるかの確認はできていないが、恐らく$export LD_LIBRARY_PATH=~/local/glibc/lib/を事前に設定してからビルドしないとダメだと思われる。

参考

ちなみにCentOS5系でも同じようにやってみたが、何かしらが足りずglibcのビルドに失敗。

$../configure --prefix=${HOME}/local/glibc
・・・
checking for symlinks in /home/vagrant/local/glibc/include... ok
running configure fragment for nptl/sysdeps/x86_64
checking for .cfi_personality and .cfi_lsda pseudo-ops... no
configure: error: assembler too old, .cfi_personality support missing

同じ問題になっている人もいた

[SOLVED] Problem with the configuration step of the Glibc 2.11

上記も最終的にOSのバージョンあげてるっぽいし、やはり可能ならば最新のOS使ったほうが手っ取り早いし、余計なトラブルとか発生しなさそうだし、その方が絶対いい。

14
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13