guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling for Android


From: beuc
Subject: Re: Compiling for Android
Date: Wed, 25 Jun 2014 23:23:40 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hey,

On Tue, Jun 24, 2014 at 09:56:07AM +0200, Ludovic Courtès wrote:
> address@hidden skribis:
> > Hey,
> >
> > On Mon, Jun 23, 2014 at 09:59:24AM +0200, Ludovic Courtès wrote:
> >> address@hidden skribis:
> >> > Another issue: ./configure went well but I wasn't told iconv.h was
> >> > required:
> >> > ../../libguile/print.c:27:19: fatal error: iconv.h: No such file or 
> >> > directory
> >> 
> >> Hmm, could you run “grep -i 'iconv.h' config.log”?  There is a check for
> >> that, and normally Gnulib provides a replacement if needed.
> >> 
> >> Apparently lib/iconv.h doesn’t exist here, right?
> >
> > Not if I don't install it.
> 
> I was referring to $top_builddir/lib/iconv.h in Guile.  Normally Gnulib
> would create it as it sees fit.  Is it the case here?
> 
> > $ grep -i -C2 'iconv\.h' config.log  # tests excerpts removed
> 
> Hmm, I don’t see GL_GENERATE_ICONV_H_TRUE here.

config.h seems consistent, it seems gnulib didn't bother creating it
actually:

/* Define if you have the iconv() function and it works. */
/* #undef HAVE_ICONV */

/* Define to 1 if you have the <iconv.h> header file. */
/* #undef HAVE_ICONV_H */


> >> > There's also an issue in libffi.pc where a '(libdir)' is copied
> >> > verbatim in LIBS, causing bash error at link time, which I hand-fixed
> >> > for now.
> >> 
> >> What does libffi.pc look like?
> >
> > prefix=/usr/src/ndk-standalone-12-arm/sysroot/usr
> > exec_prefix=${prefix}
> > libdir=${exec_prefix}/lib
> > toolexeclibdir=$(libdir)
> > ...
> > (instead of ${libdir})
> 
> That’s weird, libffi 3.0.13 doesn’t have this problem.  What version is it?

v3.1.  That seems to be an issue in pkgconf:
https://github.com/pkgconf/pkgconf/issues/67

(before you ask, pkgconf is a reimplementation of pkg-config that
 doesn't depend on itself and whose maintainer is more willing to
 implement changes)


> >> > In the end, I got a classical Android issue:
> >> >     CCLD     guile
> >> >   
> >> > /usr/src/ndk-standalone-12-arm/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
> >> >  ./.libs/libguile-2.0.a(libguile_2.0_la-threads.o): in function 
> >> > scm_cancel_thread:../../libguile/threads.c:1175: error: undefined 
> >> > reference to 'pthread_cancel'
> >> >
> >> > ... classical because Bionic intentionally doesn't implement this 
> >> > function.
> >> 
> >> You could either comment out the related code in libguile, or build
> >> Guile --without-threads.
> >
> > libguile-2.0 builds (yay!) and we start getting interesting errors:
> 
> Cool!  :-)
> 
> > make[2]: Entering directory '/mnt/workdir/guile/cross-android/module'
> >   GUILEC ice-9/eval.go
> > Backtrace:
> > In ice-9/boot-9.scm:
> >  157: 8 ;;; note: source file 
> > /home/personnel/workdir/guile/cross-android/../module/system/vm/frame.scm
> > ;;;       newer than compiled /usr/lib/guile/2.0/ccache/system/vm/frame.go
> > ;;; note: source file 
> > /home/personnel/workdir/guile/cross-android/../module/system/vm/program.scm
> > ;;;       newer than compiled /usr/lib/guile/2.0/ccache/system/vm/program.go
> > ;;; note: source file 
> > /home/personnel/workdir/guile/cross-android/../module/system/vm/instruction.scm
> > ;;;       newer than compiled 
> > /usr/lib/guile/2.0/ccache/system/vm/instruction.go
> > ;;; note: source file 
> > /home/personnel/workdir/guile/cross-android/../module/system/vm/objcode.scm
> > ;;;       newer than compiled /usr/lib/guile/2.0/ccache/system/vm/objcode.go
> > ;;; note: source file 
> > /home/personnel/workdir/guile/cross-android/../module/srfi/srfi-26.scm
> > ;;;       newer than compiled /usr/lib/guile/2.0/ccache/srfi/srfi-26.go
> > [catch #t #<catch-closure 179d080> ...]
> > In unknown file:
> >    ?: 7 [apply-smob/1 #<catch-closure 179d080>]
> > In ice-9/boot-9.scm:
> >   63: 6 [call-with-prompt prompt0 ...]
> > In ice-9/eval.scm:
> >  432: 5 [eval # #]
> >  387: 4 [eval # #]
> > In srfi/srfi-1.scm:
> >  619: 3 [for-each #<procedure 1894f00 at scripts/compile.scm:179:14 (file)> 
> > #]
> > In scripts/compile.scm:
> >  182: 2 [#<procedure 1894f00 at scripts/compile.scm:179:14 (file)> 
> > "../../module/ice-9/eval.scm"]
> > In system/base/target.scm:
> >   57: 1 [with-target "arm-unknown-linux-androideabi" ...]
> > In unknown file:
> >    ?: 0 [scm-error misc-error #f "~A ~S" ("unknown CPU endianness" "arm") 
> > #f]
> >
> > ERROR: In procedure scm-error:
> > ERROR: unknown CPU endianness "arm"
> > Makefile:2167: recipe for target 'ic
> 
> This patch should solve the problem:
> 

> diff --git a/module/system/base/target.scm b/module/system/base/target.scm
> index c74ae67..cefa951 100644
> --- a/module/system/base/target.scm
> +++ b/module/system/base/target.scm
> @@ -1,6 +1,6 @@
>  ;;; Compilation targets
>  
> -;; Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
> +;; Copyright (C) 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
>  
>  ;; This library is free software; you can redistribute it and/or
>  ;; modify it under the terms of the GNU Lesser General Public
> @@ -72,6 +72,8 @@
>               (endianness big))
>              ((string-match "^arm.*el" cpu)
>               (endianness little))
> +            ((string=? "arm" cpu)                ;ARMs are LE by default
> +             (endianness little))
>              (else
>               (error "unknown CPU endianness" cpu)))))
>  

It is worth noting that this patch is required for the native,
pre-existing guile that is used for cross-compiling (I didn't realize
my system guile was in use).

After quite some compilation time I now get:
In ice-9/eval.scm:
 411: 5 [eval # #]
In ice-9/psyntax.scm:
1106: 4 [expand-top-sequence ((eval-when # #)) () ((top)) ...]
 989: 3 [scan ((eval-when # #)) () ((top)) ...]
 279: 2 [scan ((load-extension # "scm_init_foreign_object")) () ((top)) ...]
In unknown file:
   ?: 1 [load-extension "libguile-2.0" "scm_init_foreign_object"]
In ice-9/boot-9.scm:
 106: 0 [#<procedure 144d8c0 at ice-9/boot-9.scm:97:6 (thrown-k . args)> 
misc-error ...]

ice-9/boot-9.scm:106:20: In procedure #<procedure 144d8c0 at 
ice-9/boot-9.scm:97:6 (thrown-k . args)>:
ice-9/boot-9.scm:106:20: In procedure dynamic-pointer: Symbol not found: 
scm_init_foreign_object
Makefile:2167: recipe for target 'system/foreign-object.go' failed


I'm not sure I'm interested in compiling all guile modules myself
though.  I haven't thought about it much but I intend to ship a pretty
minimal guile in GNU FreeDink so user can script their game, without
being able to e.g. mess with the player's filesystem.


> Just to be sure, could you run config.guess on the target machine?

armv7l-unknown-linux-gnueabihf - but I had to some much trouble
running config.guess that you should take it with a grain salt.  In
particular there's no /tmp, or about anything FHS-compliant for that
matter.  Android ain't POSIX.  The host type I use when
cross-compiling is 'arm-unknown-linux-androideabi'.


> >> Is the rest of pthreads implemented?  If yes, then we should add a test
> >> for pthread_cancel and arrange for that.
> >
> > Apparently yes and that'd be the only missing function.
> 
> OK, I’ll commit something to disable handle that case.

Nice!

-- 
Sylvain



reply via email to

[Prev in Thread] Current Thread [Next in Thread]