public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* Mixed java and kawa support on Android with gradle
@ 2014-02-28 17:38 Marius Kjeldahl
  2014-02-28 18:25 ` Per Bothner
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Kjeldahl @ 2014-02-28 17:38 UTC (permalink / raw)
  To: kawa

I'm really close to getting it working, but I keep hitting weird bugs.
This one is the one I am currently struggling with:

https://gist.github.com/mariusk/9275594

That gist contains the error (first file) and the kawa source file
used when it happens (the second file). You will notice that the first
file also shows the details on how the kawa compiler gets invoked.
I've verified that the build creates the proper class files in what I
believe are the proper locations (essentially I've instructed kawa to
output the class files into the same directory as the java class
files).

Parts of the stacktrace (see first file in gist for complete details) shows:

   Caused by: java.lang.RuntimeException: no mapping specified for register
  at com.android.dx.ssa.BasicRegisterMapper.map(BasicRegisterMapper.java:63)
  at com.android.dx.ssa.SsaInsn.mapRegisters(SsaInsn.java:159)
  at com.android.dx.ssa.SsaMethod.mapRegisters(SsaMethod.java:394)
  at com.android.dx.ssa.back.SsaToRop.moveParametersToHighRegisters(SsaToRop.java:235)
  at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:118)
  at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:69)
  at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:101)
  at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
  at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
  ... 15 more
  ...while processing lambda10
(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  ...while processing gnu/kawa/slib/ralists$frame1.class

  1 error; aborting

If you have anything to contribute, I'm all ears!

Thanks,

Marius K.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixed java and kawa support on Android with gradle
  2014-02-28 17:38 Mixed java and kawa support on Android with gradle Marius Kjeldahl
@ 2014-02-28 18:25 ` Per Bothner
       [not found]   ` <CAHdMyC+L9isGjEAAzNM5oRH2VYxGkESPK1gTO6KjOoBUqc76qA@mail.gmail.com>
  2014-03-02  0:17   ` Per Bothner
  0 siblings, 2 replies; 6+ messages in thread
From: Per Bothner @ 2014-02-28 18:25 UTC (permalink / raw)
  To: Marius Kjeldahl, kawa

On 02/28/2014 09:38 AM, Marius Kjeldahl wrote:
> Parts of the stacktrace (see first file in gist for complete details) shows:
>
>     Caused by: java.lang.RuntimeException: no mapping specified for register
>    at com.android.dx.ssa.BasicRegisterMapper.map(BasicRegisterMapper.java:63)
> ....
>    ...while processing lambda10
> (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
>    ...while processing gnu/kawa/slib/ralists$frame1.class
>
>    1 error; aborting

You need to show us the .class files.  Dex is the program that converts
from JVM-style class files to Dalvik files.  There is something in the
class file dex doesn't like.  Most likely a limitation/bug in dex, but 
it is also
possible Kawa is generating invalid .class files that doesn't been caught in
normal usage.

Googling yields:
    "Argh, that old stupid thing. Dex doesn't like two arguments with 
the same name."

If that's the problem, it can probably be fixed easily, but I need to see
the class files first.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Fwd: Mixed java and kawa support on Android with gradle
       [not found]   ` <CAHdMyC+L9isGjEAAzNM5oRH2VYxGkESPK1gTO6KjOoBUqc76qA@mail.gmail.com>
@ 2014-02-28 18:33     ` Marius Kjeldahl
  2014-02-28 18:56     ` Per Bothner
  1 sibling, 0 replies; 6+ messages in thread
From: Marius Kjeldahl @ 2014-02-28 18:33 UTC (permalink / raw)
  To: kawa

---------- Forwarded message ----------
From: Marius Kjeldahl <marius.kjeldahl@gmail.com>
Date: Fri, Feb 28, 2014 at 7:33 PM
Subject: Re: Mixed java and kawa support on Android with gradle
To: Per Bothner <per@bothner.com>


Thanks, you can (hopefully) find the files here (the whole slib
directory from the kawa build):

https://www.dropbox.com/sh/h9i6407z2j9yrsk/0y22tLdU_P/kawa

Thanks,

Marius K.

On Fri, Feb 28, 2014 at 7:24 PM, Per Bothner <per@bothner.com> wrote:
> On 02/28/2014 09:38 AM, Marius Kjeldahl wrote:
>>
>> Parts of the stacktrace (see first file in gist for complete details)
>> shows:
>>
>>     Caused by: java.lang.RuntimeException: no mapping specified for
>> register
>>    at
>> com.android.dx.ssa.BasicRegisterMapper.map(BasicRegisterMapper.java:63)
>> ....
>>
>>    ...while processing lambda10
>> (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
>>    ...while processing gnu/kawa/slib/ralists$frame1.class
>>
>>    1 error; aborting
>
>
> You need to show us the .class files.  Dex is the program that converts
> from JVM-style class files to Dalvik files.  There is something in the
> class file dex doesn't like.  Most likely a limitation/bug in dex, but it is
> also
> possible Kawa is generating invalid .class files that doesn't been caught in
> normal usage.
>
> Googling yields:
>    "Argh, that old stupid thing. Dex doesn't like two arguments with the
> same name."
>
> If that's the problem, it can probably be fixed easily, but I need to see
> the class files first.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixed java and kawa support on Android with gradle
       [not found]   ` <CAHdMyC+L9isGjEAAzNM5oRH2VYxGkESPK1gTO6KjOoBUqc76qA@mail.gmail.com>
  2014-02-28 18:33     ` Fwd: " Marius Kjeldahl
@ 2014-02-28 18:56     ` Per Bothner
  2014-02-28 19:12       ` Marius Kjeldahl
  1 sibling, 1 reply; 6+ messages in thread
From: Per Bothner @ 2014-02-28 18:56 UTC (permalink / raw)
  To: Marius Kjeldahl, kawa

[-- Attachment #1: Type: text/plain, Size: 128 bytes --]

As a work-around, try the attached patch, until I decide on a fix.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

[-- Attachment #2: ralists.patch --]
[-- Type: text/x-patch, Size: 1153 bytes --]

Index: gnu/kawa/slib/ralists.scm
===================================================================
--- gnu/kawa/slib/ralists.scm	(revision 7834)
+++ gnu/kawa/slib/ralists.scm	(working copy)
@@ -65,7 +65,7 @@
  (rename ra-reverse reverse)
  (rename ra-list-tail list-tail)
  (rename ra-list-ref list-ref)
- (rename ra-list-set list-set)
+ ;(rename ra-list-set list-set)
  (rename ra-list-ref/update list-ref/update)
  (rename ra-map map)
  (rename ra-for-each for-each)
@@ -332,9 +332,11 @@
             (make-kons s (kons-tree xs) (recr (kons-rest xs) (- j s)))))))
 |#
 
+#|
   ;; [RaListof X] Nat X -> (values X [RaListof X])
   (define (ra-list-ref/set ls i v)
     (ra-list-ref/update ls i (lambda (_) v)))
+|#
 
   ;; X ... -> [RaListof X]
   (define (ra-list #!rest xs::java.lang.Object[])
@@ -462,9 +464,11 @@
           (loop (kons-rest xs) (- j (kons-size xs))))))
 |#
   
+#|
   ;; [RaListof X] Nat X -> [RaListof X]
   (define (ra-list-set ls i v)
     (let-values (((_ l*) (ra-list-ref/set ls i v))) l*))
+|#
   
   ;; [X ... -> y] [RaListof X] ... -> [RaListof Y]
   ;; Takes advantage of the fact that map produces a list of equal size.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixed java and kawa support on Android with gradle
  2014-02-28 18:56     ` Per Bothner
@ 2014-02-28 19:12       ` Marius Kjeldahl
  0 siblings, 0 replies; 6+ messages in thread
From: Marius Kjeldahl @ 2014-02-28 19:12 UTC (permalink / raw)
  To: kawa

Perfect, that works.

FWIW I am now able to build a mixed source project (java+kawa) on
Android using gradle android builds. I've got some more testing to do,
but if everything goes well I hope do package everything up on github
and do a writeup on how to get started using "simple" tools such as
Android Studio (well you might want to use another editor for the
scheme files, but other than that everything integrates well with the
resources that Android projects typically makes use of).

Thanks,

Marius K.

On Fri, Feb 28, 2014 at 7:55 PM, Per Bothner <per@bothner.com> wrote:
> As a work-around, try the attached patch, until I decide on a fix.
>
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Mixed java and kawa support on Android with gradle
  2014-02-28 18:25 ` Per Bothner
       [not found]   ` <CAHdMyC+L9isGjEAAzNM5oRH2VYxGkESPK1gTO6KjOoBUqc76qA@mail.gmail.com>
@ 2014-03-02  0:17   ` Per Bothner
  1 sibling, 0 replies; 6+ messages in thread
From: Per Bothner @ 2014-03-02  0:17 UTC (permalink / raw)
  To: Marius Kjeldahl, kawa

On 02/28/2014 10:24 AM, Per Bothner wrote:
> On 02/28/2014 09:38 AM, Marius Kjeldahl wrote:
>> Parts of the stacktrace (see first file in gist for complete details)
>> shows:
>>
>>     Caused by: java.lang.RuntimeException: no mapping specified for
>> register
>>    at
>> com.android.dx.ssa.BasicRegisterMapper.map(BasicRegisterMapper.java:63)
>> ....
>>    ...while processing lambda10
>> (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
>>    ...while processing gnu/kawa/slib/ralists$frame1.class
>>
>>    1 error; aborting
>
> You need to show us the .class files.  Dex is the program that converts
> from JVM-style class files to Dalvik files.  There is something in the
> class file dex doesn't like.  Most likely a limitation/bug in dex, but
> it is also
> possible Kawa is generating invalid .class files that doesn't been
> caught in
> normal usage.
>
> Googling yields:
>     "Argh, that old stupid thing. Dex doesn't like two arguments with
> the same name."
>
> If that's the problem, it can probably be fixed easily, but I need to see
> the class files first.

I checked in a fix.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-03-02  0:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-28 17:38 Mixed java and kawa support on Android with gradle Marius Kjeldahl
2014-02-28 18:25 ` Per Bothner
     [not found]   ` <CAHdMyC+L9isGjEAAzNM5oRH2VYxGkESPK1gTO6KjOoBUqc76qA@mail.gmail.com>
2014-02-28 18:33     ` Fwd: " Marius Kjeldahl
2014-02-28 18:56     ` Per Bothner
2014-02-28 19:12       ` Marius Kjeldahl
2014-03-02  0:17   ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).