Project

General

Profile

Actions

Feature #8338

closed

compilation failure in nkf with Bionic (Android's libc)

Added by akr (Akira Tanaka) almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
[ruby-dev:47301]

Description

buildroot 以外での cross compile もしてみようかと思って、
Android を試したところ、nkf のところで compile に失敗します。

Bionic (Android の libc) には langinfo.h がないのが原因のようです。

nkf.h を見たところ、どう修正するのが適切なのかわからなかったので
issue としておきます。

私の環境 (x86_64 な Debian GNU/Linux (squeeze)) では以下のようにすれば再現できます。
(wget しているのは Android NDK で、
http://developer.android.com/tools/sdk/ndk/index.html に載っていたものです。
Linux 64-bit (x86) 以外のものもあるので、他の環境でも試せるかもしれません)

% ruby -v
ruby 2.1.0dev (2013-04-24 trunk 40443) [x86_64-linux]
% A=$HOME/a
% mkdir $A
% cd $A
% wget http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2
% tar xf android-ndk-r8e-linux-x86_64.tar.bz2
% android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -v |& grep Target
Target: arm-linux-androideabi
% svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
...
Checked out revision 40502.
% cd ruby
% autoconf
% ./configure --prefix=$A --host=arm-linux-androideabi CC="$A/android-ndk-r8e/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=$A/android-ndk-r8e/platforms/android-14/arch-arm"
% make
...
gmake[2]: Entering directory /home/akr/a/ruby/ext/nkf' compiling nkf.c In file included from nkf-utf8/nkf.c:30:0, from nkf.c:62: nkf-utf8/nkf.h:166:22: fatal error: langinfo.h: No such file or directory compilation terminated. gmake[2]: *** [nkf.o] Error 1 gmake[2]: Leaving directory /home/akr/a/ruby/ext/nkf'
gmake[1]: *** [ext/nkf/all] Error 2
gmake[1]: Leaving directory `/home/akr/a/ruby'
gmake: *** [build-ext] Error 2
zsh: exit 2

langinfo.h というファイルを探してみると、たしかにないようです。

% find $A -name langinfo.h
%

また、
https://android.googlesource.com/platform/bionic/+/android-4.2.2_r1.2/libc/README
とかには

  • no support for locales
    と書いてあるのでないのはそういうものなのでしょう。

なお、現状ではそもそも Android で動くべきということないと思うので、Feature にしておきます。

Updated by naruse (Yui NARUSE) almost 11 years ago

  • Category set to ext
  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)
  • Target version set to 2.1.0

こんな感じで通りますかね

diff --git a/nkf.h b/nkf.h
index cbe5f56..af44320 100755
--- a/nkf.h
+++ b/nkf.h
@@ -152,6 +152,7 @@ void setbinmode(FILE *fp)

ifndef HAVE_LOCALE_H

define HAVE_LOCALE_H

endif

+#elif defined(BIONIC) /* bionic doesn't have locale */
#else

ifndef HAVE_LANGINFO_H

define HAVE_LANGINFO_H

Updated by akr (Akira Tanaka) almost 11 years ago

そのパッチを当てると、make, make install まで通るようになります。
(もちろん動かしていないので、そこから先は知りません)

Actions #3

Updated by naruse (Yui NARUSE) almost 11 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40520.
Akira, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/nkf/nkf-utf8/nkf.h: Bionic libc doesn't have locale.
    [Feature #8338]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0