[gambit-list] trying to make Blackhole work with Android

Álvaro Castro-Castilla alvaro.castro.castilla at gmail.com
Sun Jan 8 17:45:58 EST 2012


Hi,

Yes, I'm using parameters in module-compile! to handle C compilation. There
are issues with this though, but is not the problem right now. I'm
generating all 5 files like BH usually does.
These 4 files are the part of Blackhole I understand least, but they are
all needed for the module to be defined in C. According to Per:

"When compiling modules for use in development (as opposed to "bh exe"),
Black Hole works internally by compiling every module into *4* Gambit
modules (c files if you will):

1) runtime code
2) compiletime code (this is essentially the same code as the runtime code,
but does not use the global namespace and is thus slower but it's required
to be able to create an unbound number of instances of the same module at
any given time)
3) visit-time code (these are the macros)
4) module metadata (this is pretty much a compiled a-list)

If you want to retain the development information, you will need 4 .c files
per Black Hole module. If you want to strip development information, you
will only need one (the runtime code)."

I'm trying both with the 4 files and the only one option. The multiple
definition of symbols happens in both situations, but an undefined
reference happens for each one of the 3 files (I think that is due to the
link file referencing them, I could take care of that). But the core of the
problem is with the multiple definition of ___G_list, ___S_list,
___G_void and ___S_void
How can this happen?

I attach the generated files. In order to try it, you can just use:
g++ test.o1.c test-ct.c test-rt.c test-vt.c test-mi.c -lm -lutil -ldl
-lgambc -o test.o
...and you'll get an (expected) undefined reference to main and all the
multiple definitions I talk about.


Best regards



On Sun, Jan 8, 2012 at 8:00 PM, Mikael <mikael.rcv at gmail.com> wrote:

> As to make BH compile to C rather than object files, pass to-c: #t to
> module-compile! .
>
> What's the first 4 of the 5 files you mention below? (Format, content,
> when needed / scope of use, and so on)
>
> The link file is produced by BH at some point (presuming by link file you
> mean link file as per Gambit's definition). To make a C link file out of
> Gambit, I don't remember, either there's a special BH procedure for it, or
> you do it the general way it's done in Gambit, please let the ml know what
> you got to, and if it's not obvious please query again.
>
> Mikael
>
> 2012/1/8 Álvaro Castro-Castilla <alvaro.castro.castilla at gmail.com>
>
>>  Hi!
>>
>> I'm trying (again) to make Blackhole work with Android. For that purpose
>> I need to make it compile to C, instead of its normal *.o files. BH needs
>> to compile 5 files for each module:
>> - a compile-time file
>> - a real-time file
>> - a visit-time file
>> - a module metadata file
>> - the link file
>>
>> Based on https://github.com/seoushi/gambit-android-example but using the
>> newer "Native Activity" I'm trying to compile an example. First, I'm trying
>> to compile an example with just one file, importing no modules.
>>
>> I'm getting:
>>      [exec] ./jni/ext/libgambc.a(_gambc.o):(.data+0x4854c): multiple
>> definition of `___G_list'
>>      [exec]
>> ./obj/local/armeabi/objs/native-activity/main.o1.o:(.data+0x3c): first
>> defined here
>>      [exec] ./jni/ext/libgambc.a(_gambc.o):(.data.rel+0x13708): multiple
>> definition of `___S_list'
>>      [exec]
>> ./obj/local/armeabi/objs/native-activity/main.o1.o:(.data.rel+0xb0): first
>> defined here
>>      [exec] ./jni/ext/libgambc.a(_gambc.o):(.data+0x5ae40): multiple
>> definition of `___G_void'
>>      [exec]
>> ./obj/local/armeabi/objs/native-activity/main.o1.o:(.data+0x54): first
>> defined here
>>      [exec] ./jni/ext/libgambc.a(_gambc.o):(.data.rel+0x19138): multiple
>> definition of `___S_void'
>>      [exec]
>> ./obj/local/armeabi/objs/native-activity/main.o1.o:(.data.rel+0xe0): first
>> defined here
>>
>> I would like to know if any of you had similar experiences, and why I'm
>> getting this multiple definitions? The link file (called main.o1.c) seems
>> to redefine these symbols, but they are also defined in libgambc.a (which
>> is compiled for ARM architecture)
>> Why could this be happening?
>>
>> I'd appreciate any pointers. Thanks a lot for your help,
>>
>> Álvaro Castro-Castilla
>>
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-ct.c
Type: text/x-csrc
Size: 6425 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-mi.c
Type: text/x-csrc
Size: 4190 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-rt.c
Type: text/x-csrc
Size: 3120 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment-0002.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-vt.c
Type: text/x-csrc
Size: 2331 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment-0003.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.scm
Type: text/x-scheme
Size: 23 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.o1.c
Type: text/x-csrc
Size: 2306 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120108/faba3001/attachment-0004.c>


More information about the Gambit-list mailing list