You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Enrico Migliore <en...@fatti.com> on 2006/01/19 11:58:49 UTC
compiling JCHEVM with GCC/Cygwin
Hi Archie
In order to build JCHEVM with Cygwin I took the following steps:
1. Built Classpath 0.20 with Cygwin, with the following options:
$./configure --with-jikes gtk-peer-enable
2. Downloaded JCHEVM and read Apache.README and INSTALL
3. Ran successfully the following script:
$sh autogen.sh
4. Ran the following command:
$make
After compiling some C source files, thoug, it stopped saying:
jcjavah: can't load class 'gnu/classpath/VMStackWalker':
java/io/IOException: error reading entry
'gnu/classpath/VMStackWalker.class'
in ZIP file 'usr/local/classpath/share/classpath/glibj.zip': No error
make[2]: *** [gnu_classpath_VMStackWalker.h] Error 1
(Note that VMStackWalker.class is present in my zip file:
/usr/local/classpath/share/classpath/glibj.zip)
Can anybody help me out?
ciao,
Enrico
P.S.
During the compilation phase, that is, before stopping on the
mentioned error,
the compiler issues the following warning: gcc: unrecognized option
'-pthread'
P.S.
I put the ucontext.h file in the dirs: /include and /include/sys
at the moment they are empty
Re: compiling JCHEVM with GCC/Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> After compiling some C source files, thoug, it stopped saying:
>
> jcjavah: can't load class 'gnu/classpath/VMStackWalker':
>
> java/io/IOException: error reading entry
> 'gnu/classpath/VMStackWalker.class'
> in ZIP file 'usr/local/classpath/share/classpath/glibj.zip': No error
>
> make[2]: *** [gnu_classpath_VMStackWalker.h] Error 1
>
> (Note that VMStackWalker.class is present in my zip file:
> /usr/local/classpath/share/classpath/glibj.zip)
Looks like the pread(3) function is not working properly under Cygwin.
This error occurs on line 373 of zip.c if you want to try to debug it
(sorry, I'm Windows illiterate).
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
Re: [jchevm] building jchevm on Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Archie Cobbs wrote:
> What does this program print?
>
> /*
> * Compile me from the top jchevm directory like this:
> *
> * cc -I libjc -I include -I libjc/native -I libjc/arch -o xx xx.c
> */
> #include "libjc.h"
> int
> main(int ac, char **av)
> {
> printf("_JC_FULL_ALIGNMENT=%u\n", _JC_FULL_ALIGNMENT);
> return 0;
> }
>
> -Archie
Hi Archie,
here are the messages and the value of ALIGNMENT.
As far as the Classpath problem is concerned, I posted a thread on
the Classpath mailing list.
Keep in mind that I haven't yet merged your latest pacth (replacement
of the ucontext functions with setjmp() - longjmp). with my source tree.
assertion failure 1
-----------------
vm.c - line 46
message = "assertion failure: _JC_FULL_ALIGNMENT <= (sizeof(_jc_word))"
When I add the following:
printf("_JC_FULL_ALIGNMENT=%u\n", _JC_FULL_ALIGNMENT);
jchevm prints: 8
assertion failure 2
-----------------
vm.c - line 176
message = "assertion failure: vm->threads.pro_min <= assertion
failure:vm->threads.pro_max"
assertion failure 3
-----------------
heap.c - line 238
message = "assertion failure: bs->hint == NULL || (((_jc_word) bs->hint
& (_JC_PAGE_SIZE - 1) %
bs->size) == _JC_HEAP_BLCOK_OFFSET)
assertion failure 4
-----------------
thread.c - line 1023
/* _JC_COND_SIGNAL(vm->vm_destruction);*/
message = "assertion failure: _r == 0"
Your comments are welcome :-)
Enrico
Re: [jchevm] building jchevm on Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> The result is that the following assertions fail:
>
> 1. vm.c - line 46
What does this program print?
/*
* Compile me from the top jchevm directory like this:
*
* cc -I libjc -I include -I libjc/native -I libjc/arch -o xx xx.c
*/
#include "libjc.h"
int
main(int ac, char **av)
{
printf("_JC_FULL_ALIGNMENT=%u\n", _JC_FULL_ALIGNMENT);
return 0;
}
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
[jchevm] building jchevm on Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Archie,
GNU/Classpath problem
-------------------------
at the moment, when I run:
$jc HelloWorld
I got the following exception:
java.lang.UnsatisfiedLinkError: failed to open native library:
'usr/local/classpath/lib/classpath/libjavanio.so'
The reason is simple: Classpath doesn't know it's running on Cygwin,
therefore it looks for "libjavanio.so" instead of "libjavanio.dll" (which
exists on the filesytem). I'll post a thread on the Classpath list in order
to fix this problem.
Assertion failures on Cygwin
-----------------------------
I compiled the distribution with all assertions enabled and ran:
$jc HelloWorld
The result is that the following assertions fail:
1. vm.c - line 46
2. vm.c - line 176
3. heap.c - line 238
4. thread.c - line 1023
Of course, to get to assertions 2 I had to comment assertion 1 and so on.
Segmentation fault problem on Cygwin
---------------------------------------
While debugging JCHEVM with DDD I noticed that the pthread library issues
a segmentation fault signal. In order to proceed, I instructed DDD to
ignore the signal.
To fix the problem, I'll have to compile the pthread library in debug
mode and sneak in
the source code.
Comment
----------
Even if I fix all of these problems, JCHEVM will always need Cygwin to
run on top
of Windows. That is acceptable for now, but someday, if we want JCHEVM to
became a fully fladged VM we'll have to make a native port to Windows.
Enrico
Re: JCHEVM built on GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Geir,
>
> Now lets get JCHEVM to also use the Harmony Classlib :) It will be
> great for A/B testing.
It's a task that Archie and I would like to accomplish in the near
future, when time permits.
Enrico
Re: JCHEVM built on GCC/Cygwin
Posted by Geir Magnusson Jr <ge...@pobox.com>.
Hey, that's great!
Now lets get JCHEVM to also use the Harmony Classlib :) It will be
great for A/B testing.
geir
Enrico Migliore wrote:
> Hi folks,
>
> I've finally built JCHEVM and Classpath 0.20 on GCC/Cygwin/Windows.
>
> There are still a few things to fix and port but the main job is done.
>
> At the moment, when calling:
>
> $jc HelloWorld.class
>
> jc throws an exception because it can't find a .so library in Classpath.
>
>
> ciao,
> Enrico
>
>
>
>
JCHEVM built on GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi folks,
I've finally built JCHEVM and Classpath 0.20 on GCC/Cygwin/Windows.
There are still a few things to fix and port but the main job is done.
At the moment, when calling:
$jc HelloWorld.class
jc throws an exception because it can't find a .so library in Classpath.
ciao,
Enrico
Re: compiling JCHEVM with GCC/Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> I tried to debug it with DDD (Data display debugger) which is a GUI
> based debugger which,
> in turn, uses GDB. I was tired last night and wasn't able to take any
> step forward.
> What's your GUI front end for writing and debugging JC? Are you using
> xemacs?
Um, vi.. does that count? :-)
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
Re: compiling JCHEVM with GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Archie,
> Enrico Migliore wrote:
>
>> pread() problem
>> -----------------
>> In the zip.c file, I temporarily substituted the pread() call
>> with the following two calls:
>>
>> lseek(fd,offset,SEEK_SET);
>> read(fd,buf,len);
>>
>> Those are perfectly equivalent to pread() except that
>> they are not atomic
>
>
> That is a reasonable workaround; it's not thread safe however.
> In practice is probably won't matter though. You'd have to be
> loading the same class at the same time from two different
> class loaders for that to matter (highly unlikely).
>
Let's use this workaround for now. I'll go through the pread() function,
on Cygwin.
>> problems
>> ----------
>> jc.exe enters the main function and crashes at the first call,
>> which is _jc_invoke();
>>
>> In order to investigate the problem I did the following thngs:
>>
>> 1. Commented _jc_invoke() and added a dummy poptGetContext() call.
>> It crashes
>>
>> 2. Commented _jc_invoke() and added a printf("Hello World!");
>> It doesn't crash and print the message to the stdandard output
>>
>> It seems to me that the problem is the calling convention.
>
>
> I don't know enough about Windows or Cygwin to help here.
> Can you run it under GDB?
>
> -Archie
I tried to debug it with DDD (Data display debugger) which is a GUI
based debugger which,
in turn, uses GDB. I was tired last night and wasn't able to take any
step forward.
What's your GUI front end for writing and debugging JC? Are you using
xemacs?
Enrico
Re: compiling JCHEVM with GCC/Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> pread() problem
> -----------------
> In the zip.c file, I temporarily substituted the pread() call
> with the following two calls:
>
> lseek(fd,offset,SEEK_SET);
> read(fd,buf,len);
>
> Those are perfectly equivalent to pread() except that
> they are not atomic
That is a reasonable workaround; it's not thread safe however.
In practice is probably won't matter though. You'd have to be
loading the same class at the same time from two different
class loaders for that to matter (highly unlikely).
> problems
> ----------
> jc.exe enters the main function and crashes at the first call,
> which is _jc_invoke();
>
> In order to investigate the problem I did the following thngs:
>
> 1. Commented _jc_invoke() and added a dummy poptGetContext() call.
> It crashes
>
> 2. Commented _jc_invoke() and added a printf("Hello World!");
> It doesn't crash and print the message to the stdandard output
>
> It seems to me that the problem is the calling convention.
I don't know enough about Windows or Cygwin to help here.
Can you run it under GDB?
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
Re: compiling JCHEVM with GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Archie,
I took some steps forward.
pread() problem
-----------------
In the zip.c file, I temporarily substituted the pread() call
with the following two calls:
lseek(fd,offset,SEEK_SET);
read(fd,buf,len);
Those are perfectly equivalent to pread() except that
they are not atomic
ucontext problem
-----------------
I commented out the code where there was any reference
to the ucontext library, in ordere GCC to continue compiling.
Fortunately, the number of references are very few and as
soon as I port the ucontext library to Cygwin, I will restore
the original code.
good news
-----------
I'm able to build JCHEVM with Cygwin and
the builder produces the following three executables:
jc.exe
jcjavah.exe
cfdump.exe
jcjavah.exe and cfdump.exe seem to work.
I called:
$jcjavah --help
$cfdump --help
and both show the command options
problems
----------
jc.exe enters the main function and crashes at the first call,
which is _jc_invoke();
In order to investigate the problem I did the following thngs:
1. Commented _jc_invoke() and added a dummy poptGetContext() call.
It crashes
2. Commented _jc_invoke() and added a printf("Hello World!");
It doesn't crash and print the message to the stdandard output
It seems to me that the problem is the calling convention.
Got any hints?
Enrico
P.S.
I'm reading the HTML documentation you wrote
Re: compiling JCHEVM with GCC/Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> The bad news is that the RedHat guys hasn't ported ucontext library to
> Cygwin.
>
> The good one is that:
>
> 1. You call just one of the 4 ucontext library functions, and you call it
> in just one source file (stack.c)
>
> 2. I've found an example explaining how to port the ucontext library in
> Cygwin
> (Don't know if it works though)
Good, hopefully #2 will work. The use of ucontext is pretty critical,
because otherwise we could leak references and accidentally GC an object
still in use. Actually there could be an alternative implementation using
setjmp(), I'll look into that if time permits.
> zip problem
> ------------
> I downloaded the source code of zip-2.3 and,
> at line 373 of zip.c, I got this:
>
> #ifdef MACOS
Sorry, I meant JCHEVM's zip,c: jchevm/libjc/zip.c.
> > Looks like the pread(3) function is not working properly under Cygwin.
> > This error occurs on line 373 of zip.c if you want to try to debug it
> > (sorry, I'm Windows illiterate).
>
> Yet, I can't find, in the Zip source files, the the pread( ) function
> that you told me about
pread(3) is something that Cygwin would supply, not zip. I.e., it's
part of the standard C library (per Unix98).
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com
Re: compiling JCHEVM with GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Archie,
ucontext library
---------------
The ./configure script refuses to complete successfully if I don't put
the ucontext.h header file,
in the following places: /usr/include and /usr/include/sys
Therefore, the ucontext library must be present.
The bad news is that the RedHat guys hasn't ported ucontext library to
Cygwin.
The good one is that:
1. You call just one of the 4 ucontext library functions, and you call it
in just one source file (stack.c)
2. I've found an example explaining how to port the ucontext library in
Cygwin
(Don't know if it works though)
zip problem
------------
I downloaded the source code of zip-2.3 and,
at line 373 of zip.c, I got this:
#ifdef MACOS
> Looks like the pread(3) function is not working properly under Cygwin.
> This error occurs on line 373 of zip.c if you want to try to debug it
> (sorry, I'm Windows illiterate).
Yet, I can't find, in the Zip source files, the the pread( ) function
that you told me about
Any suggestions?
Enrico
Re: compiling JCHEVM with GCC/Cygwin
Posted by Enrico Migliore <en...@fatti.com>.
Hi Archie,
> Enrico Migliore wrote:
>
>> P.S.
>> During the compilation phase, that is, before stopping on the
>> mentioned error,
>> the compiler issues the following warning: gcc: unrecognized
>> option '-pthread'
>
>
> I've removed this configure hack, which is no longer needed.
>
ok!
>> P.S.
>> I put the ucontext.h file in the dirs: /include and /include/sys
>> at the moment they are empty
>
>
> That's a bad sign.. :-)
>
> -Archie
I don't know whether the Cygwin guys has ported the functions
included in the ucontext.h header file, to Win32. I'll check it tonight.
Enrico
Re: compiling JCHEVM with GCC/Cygwin
Posted by Archie Cobbs <ar...@dellroad.org>.
Enrico Migliore wrote:
> P.S.
> During the compilation phase, that is, before stopping on the mentioned
> error,
> the compiler issues the following warning: gcc: unrecognized option
> '-pthread'
I've removed this configure hack, which is no longer needed.
> P.S.
> I put the ucontext.h file in the dirs: /include and /include/sys
> at the moment they are empty
That's a bad sign.. :-)
-Archie
__________________________________________________________________________
Archie Cobbs * CTO, Awarix * http://www.awarix.com