[ruby-dev:47302] [ruby-trunk - Feature #8338][Assigned] compilation failure in nkf with Bionic (Android's libc)

From: "naruse (Yui NARUSE)" <naruse@...>
Date: 2013-04-27 20:15:39 UTC
List: ruby-dev #47302
Issue #8338 has been updated by naruse (Yui NARUSE).

Category set to ext
Status changed from Open to Assigned
Assignee set to naruse (Yui NARUSE)
Target version set to current: 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
----------------------------------------
Feature #8338: compilation failure in nkf with Bionic (Android's libc)
https://bugs.ruby-lang.org/issues/8338#change-38959

Author: akr (Akira Tanaka)
Status: Assigned
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: ext
Target version: current: 2.1.0


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 にしておきます。



-- 
http://bugs.ruby-lang.org/

In This Thread