You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by snowdosker <sn...@academ.org> on 2006/02/13 18:43:28 UTC

compiling JCHEVM with GCC/Cygwin

Hello Enrico

I'm trying to build JCHEVM following your steps described at
http://www.mail-archive.com/harmony-dev@incubator.apache.org/msg03212.html

I was able to build Classpath sucsesfuly, but
fail making JCHEVM

In result I have

native/java_lang_VMThread.c: In function `JCNI_java_lang_VMThread_start':
native/java_lang_VMThread.c:388: warning: implicit declaration of 
function `pthread_attr_setstackaddr'
native/java_lang_VMThread.c:388: warning: nested extern declaration of 
`pthread_attr_setstackaddr'
make[2]: *** [java_lang_VMThread.o] Error 1
make[2]: Leaving directory `/home/ivan/jchevm/libjc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ivan/jchevm/libjc'
make: *** [all-recursive] Error 1


Can you help me, please.
Thanks, Ivan



Re: compiling JCHEVM with GCC/Cygwin

Posted by Archie Cobbs <ar...@dellroad.org>.
snowdosker wrote:
> vm.c - line 46
> message = "assertion failure: _JC_FULL_ALIGNMENT <= (sizeof(_jc_word))"

This assertion is there because we align the start of an object
with the first reference (which is in front of the object header).

The fix for this is to modify the code to align non-array objects
on 8 byte boundaries even if they have an odd number of reference words
(yuck). This requires changing the algorithm for determining object
size and heap block size, as well as "skip word" handling, etc.
(blah blah gnarly internals).

However, I'm curious why double alignment is 8 under Cygwin but
only 4 under Linux but both are x86. Obviously that can't derive
only from the hardware.

So for now I'd say just comment out that assertion and proceed.
If you get funny floating point results then we'll know why :-)

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

Re: compiling JCHEVM with GCC/Cygwin

Posted by snowdosker <sn...@academ.org>.
Hello, Enrico

>
> are you saying that, even though the permissions of libjavanio.dll.a 
> are -r-xr-xr-x,
> you got the same message? Please, let me know.

Yes,  I just set all x  rights /usr/local/classpath/lib/classpath/
on all files in  and up directory tree  (on winXP logged with full admin 
rights)

$ ls -l /usr/local/classpath/lib/classpath/
----------------------------------------------------------------
-rwxr-xr-x 1 ivan None    77520 Feb 16 01:17 cygjavaio-0.dll
-rwxr-xr-x 1 ivan None   209670 Feb 16 01:17 cygjavalang-0.dll
-rwxr-xr-x 1 ivan None    36069 Feb 16 01:17 cygjavalangreflect-0.dll
-rwxr-xr-x 1 ivan None   103623 Feb 16 01:18 cygjavanet-0.dll
-rwxr-xr-x 1 ivan None   121948 Feb 16 01:18 cygjavanio-0.dll
-rwxr-xr-x 1 ivan None    42354 Feb 16 01:18 cygjavautil-0.dll
-rwxr-xr-x 1 ivan None 11183676 Feb 16 01:18 libgtkpeer.a
-rwxr-xr-x 1 ivan None     1345 Feb 16 01:18 libgtkpeer.la
-rwxr-xr-x 1 ivan None    25836 Feb 16 01:17 libjavaio.dll.a
-rwxr-xr-x 1 ivan None      802 Feb 16 01:17 libjavaio.la
-rwxr-xr-x 1 ivan None    67398 Feb 16 01:17 libjavalang.dll.a
-rwxr-xr-x 1 ivan None      810 Feb 16 01:17 libjavalang.la
-rwxr-xr-x 1 ivan None     1688 Feb 16 01:17 libjavalangreflect.dll.a
-rwxr-xr-x 1 ivan None      838 Feb 16 01:17 libjavalangreflect.la
-rwxr-xr-x 1 ivan None    38220 Feb 16 01:18 libjavanet.dll.a
-rwxr-xr-x 1 ivan None      806 Feb 16 01:18 libjavanet.la
-rwxr-xr-x 1 ivan None    38852 Feb 16 01:18 libjavanio.dll.a
-rwxr-xr-x 1 ivan None      827 Feb 16 01:18 libjavanio.la
-rwxr-xr-x 1 ivan None     1632 Feb 16 01:18 libjavautil.dll.a
-rwxr-xr-x 1 ivan None      810 Feb 16 01:18 libjavautil.la
-rwxr-xr-x 1 ivan None    52886 Feb 16 01:19 libjawtgnu.a
-rwxr-xr-x 1 ivan None     1394 Feb 16 01:19 libjawtgnu.la

Still have  the same  exception

java.lang.UnsatisfiedLinkError: failed to open native library 
`/usr/local/classpath/lib/classpath/libjavanio.dll.a': Per
mission denied
        at java.lang.VMThrowable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Throwable.java:498)
        at java.lang.Throwable.<init>(Throwable.java:159)
        at java.lang.Error.<init>(Error.java:81)
        at java.lang.LinkageError.<init>(LinkageError.java:72)
        at 
java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:72)
        at java.lang.VMRuntime.nativeLoad(Native Method)
        at java.lang.Runtime.loadLib(Runtime.java:698)
        at java.lang.Runtime.loadLibrary(Runtime.java:760)
        at java.lang.System.loadLibrary(System.java:512)
        at 
gnu.java.nio.channels.FileChannelImpl.<clinit>(FileChannelImpl.java:86)
        at java.io.FileDescriptor.<clinit>(FileDescriptor.java:63)
        at java.lang.VMSystem.makeStandardInputStream(VMSystem.java)
        at java.lang.System.<clinit>(System.java)
        at java.lang.Math.<clinit>(Math.java:70)
        at java.util.WeakHashMap.hash(WeakHashMap.java)
        at java.util.WeakHashMap.internalGet(WeakHashMap.java:655)
        at java.util.WeakHashMap.get(WeakHashMap.java:763)
        at java.lang.VMString.intern(VMString.java:77)
        at java.lang.String.intern(String.java)
        at java.lang.String.<clinit>(String.java)
jc: failed to create VM

Any thougths?
May be the problem is in *.dll.a extension so under win it's not treated 
as executable?










Re: compiling JCHEVM with GCC/Cygwin

Posted by Enrico Migliore <en...@fatti.com>.
snowdosker wrote:

> Thank you Enrico and Archie.
>
> So now with assertions disabled  I faced next problem, Enrico 
> mentioned in his email.
> The same
> "failed to open native library 
> /usr/local/classpath/lib/classpath/libjavanio.dll.a: permission denied"
>
> I'm trying to run it under XP professional so I had no problem to set 
> exec flags in permissions
> but this do not help.
> Still the same problem.
>
> Please, let me know if you will find solution.
>
> Thanks, Ivan
>
>
Hi Ivan,

are you saying that, even though the permissions of libjavanio.dll.a are 
-r-xr-xr-x,
you got the same message? Please, let me know.

If so, then I think we have to ask for help in the Classpath mailing list,
because I really got no clue :-)

--------------------------------------------------------------------------------
In the mean time, I'm studying the JCHEVM source code, in order to 
figure out:
 
          1. JCHEVM' OS dependancies
          2. the way JCHEVM access the Classpath library

The study would much easies if I could use the debugger, and I think I'm 
gonna
have to set up a Linux machine.


 Enrico


Re: compiling JCHEVM with GCC/Cygwin

Posted by snowdosker <sn...@academ.org>.
Thank you Enrico and Archie.

So now with assertions disabled  I faced next problem, Enrico mentioned 
in his email.
The same
"failed to open native library 
/usr/local/classpath/lib/classpath/libjavanio.dll.a: permission denied"

I'm trying to run it under XP professional so I had no problem to set 
exec flags in permissions
but this do not help.
Still the same problem.

Please, let me know if you will find solution.

Thanks, Ivan


Re: compiling JCHEVM with GCC/Cygwin

Posted by Enrico Migliore <en...@fatti.com>.
snowdosker wrote:

> Hi, Enrico.
>
> Thank you for your help.
> Looks like I am following you step by step and now have the same error 
> which you discussed with Archie few days ago =)
>
> 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
>
>
>
> But unfortunately this mail-list do not contain solution for it.
> I can not figure out how to solve it. Can you help me, please?
>
> Ivan
>
>
Hi Ivan,

 try this, in the autogen.sh file:

 CONFIGFLAGS=" --disable-assertions"

After disabling the assertions, you should be face the same problem 
where I'm currently stuck at:

   http://cygwin.com/ml/cygwin/2006-02/msg00570.html

That problem, I think, should disappear on a WindowsXP Professional Edition.


Let me know how it goes.

Enrico

Re: compiling JCHEVM with GCC/Cygwin

Posted by snowdosker <sn...@academ.org>.
Hi, Enrico.

Thank you for your help.
Looks like I am following you step by step and now have the same error 
which you discussed with Archie few days ago =)

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



But unfortunately this mail-list do not contain solution for it.
I can not figure out how to solve it. Can you help me, please?

Ivan


Re: compiling JCHEVM with GCC/Cygwin

Posted by Enrico Migliore <en...@fatti.com>.
snowdosker wrote:

> Many thanks, Enrico and Archie.
>
> Finally I built JCHEVM.
>
> This two jcjavah.exe and cfdump.exe printout help text when started, 
> but jc.exe fail with message
> "The application failed to initialize properly (0xc0000005)".
> Any ideas what does it mean?
>
> I guess library linking problems. But have no ideas which one cause it.
>
> Thanks, Ivan
>
>
>
>
Hi Ivan,

 I got the same error two weeks ago :-)

To fix the problem, do the following things:

1)  open the following file:

       jc_invoke.c

2)   find the following declaration:

       static const struct poptOption jc_popt_options[] = {

3)  remove the following line:
       POPT_AUTOHELP

Afterwards, compile a HelloWorld.java class with any compiler,
and run: $jc HelloWorld

Enrico

Re: compiling JCHEVM with GCC/Cygwin

Posted by snowdosker <sn...@academ.org>.
Many thanks, Enrico and Archie.

Finally I built JCHEVM.

This two jcjavah.exe and cfdump.exe printout help text when started, but jc.exe fail with message
"The application failed to initialize properly (0xc0000005)".
Any ideas what does it mean?

I guess library linking problems. But have no ideas which one cause it.

Thanks, Ivan




Re: compiling JCHEVM with GCC/Cygwin

Posted by Enrico Migliore <en...@fatti.com>.
snowdosker wrote:

> Enrico Migliore wrote:
>
>> snowdosker wrote:
>>
>>> Hello Enrico
>>>
>>> I'm trying to build JCHEVM following your steps described at
>>> http://www.mail-archive.com/harmony-dev@incubator.apache.org/msg03212.html 
>>>
>>>
>>> I was able to build Classpath sucsesfuly, but
>>> fail making JCHEVM
>>>
>>> In result I have
>>>
>>> native/java_lang_VMThread.c: In function 
>>> `JCNI_java_lang_VMThread_start':
>>> native/java_lang_VMThread.c:388: warning: implicit declaration of 
>>> function `pthread_attr_setstackaddr'
>>> native/java_lang_VMThread.c:388: warning: nested extern declaration 
>>> of `pthread_attr_setstackaddr'
>>> make[2]: *** [java_lang_VMThread.o] Error 1
>>> make[2]: Leaving directory `/home/ivan/jchevm/libjc'
>>> make[1]: *** [all-recursive] Error 1
>>> make[1]: Leaving directory `/home/ivan/jchevm/libjc'
>>> make: *** [all-recursive] Error 1
>>>
>>>
>>> Can you help me, please.
>>> Thanks, Ivan
>>>
>>>
>>>
>> Hi Ivan,
>>
>> if you're building JCHEVM with Cygwin, modify the following file:
>>
>>                         .\libjc\arch\arch_definitions.h
>>
>> at line 95.
>>
>> Remove:
>> #define _JC_LIBRARY_FMT        "lib%s.so"
>>
>> Add:
>> #define _JC_LIBRARY_FMT        "lib%s.dll.a"
>>
>> In order to achieve a successfull build, I had to change a few other 
>> things.
>> Before I post them here, let's see how it goes your build.
>> Are you using a Home or a Professional Windows edition?
>>
>> Enrico
>>
>>
>>
>>
>>
> Hi Enrico,
>
> This trik doesn't work :(
> I changed .\libjc\arch\arch_definitions.h as you say but in result I 
> have the same
>
> native/java_lang_VMThread.c: In function `JCNI_java_lang_VMThread_start':
> native/java_lang_VMThread.c:388: warning: implicit declaration of 
> function `pthread_attr_setstackaddr'
> native/java_lang_VMThread.c:388: warning: nested extern declaration of 
> `pthread_attr_setstackaddr'
> make[2]: *** [java_lang_VMThread.o] Error 1
> make[2]: Leaving directory `/home/ivan/jchevm/libjc'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/ivan/jchevm/libjc'
> make: *** [all-recursive] Error 1
>
>
> PS: I am using a Home Windows edition.
>
> Ivan
>
>
Hi Ivan,

 it seems to me that what stops your compilation task is a warning, 
treated as an error.

 Try to build JCHEVM without --enable-werror

1. Open the following file:

        autogen.sh

2. Replace the following line:

       CONFIGFLAGS="--enable-werror --disable-assertions"

with this one

       CONFIGFLAGS=" --disable-assertions"

3. Run again autogen.sh from the Cygwin shell


Note that you will need the following macro:

#define _JC_LIBRARY_FMT        "lib%s.dll.a"

once you've built JCHEVM.


 Enrico


Re: compiling JCHEVM with GCC/Cygwin

Posted by snowdosker <sn...@academ.org>.
Enrico Migliore wrote:

> snowdosker wrote:
>
>> Hello Enrico
>>
>> I'm trying to build JCHEVM following your steps described at
>> http://www.mail-archive.com/harmony-dev@incubator.apache.org/msg03212.html 
>>
>>
>> I was able to build Classpath sucsesfuly, but
>> fail making JCHEVM
>>
>> In result I have
>>
>> native/java_lang_VMThread.c: In function 
>> `JCNI_java_lang_VMThread_start':
>> native/java_lang_VMThread.c:388: warning: implicit declaration of 
>> function `pthread_attr_setstackaddr'
>> native/java_lang_VMThread.c:388: warning: nested extern declaration 
>> of `pthread_attr_setstackaddr'
>> make[2]: *** [java_lang_VMThread.o] Error 1
>> make[2]: Leaving directory `/home/ivan/jchevm/libjc'
>> make[1]: *** [all-recursive] Error 1
>> make[1]: Leaving directory `/home/ivan/jchevm/libjc'
>> make: *** [all-recursive] Error 1
>>
>>
>> Can you help me, please.
>> Thanks, Ivan
>>
>>
>>
> Hi Ivan,
>
> if you're building JCHEVM with Cygwin, modify the following file:
>
>                         .\libjc\arch\arch_definitions.h
>
> at line 95.
>
> Remove:
> #define _JC_LIBRARY_FMT        "lib%s.so"
>
> Add:
> #define _JC_LIBRARY_FMT        "lib%s.dll.a"
>
> In order to achieve a successfull build, I had to change a few other 
> things.
> Before I post them here, let's see how it goes your build.
> Are you using a Home or a Professional Windows edition?
>
> Enrico
>
>
>
>
>
Hi Enrico,

This trik doesn't work :(
I changed .\libjc\arch\arch_definitions.h as you say but in result I 
have the same

native/java_lang_VMThread.c: In function `JCNI_java_lang_VMThread_start':
native/java_lang_VMThread.c:388: warning: implicit declaration of 
function `pthread_attr_setstackaddr'
native/java_lang_VMThread.c:388: warning: nested extern declaration of 
`pthread_attr_setstackaddr'
make[2]: *** [java_lang_VMThread.o] Error 1
make[2]: Leaving directory `/home/ivan/jchevm/libjc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ivan/jchevm/libjc'
make: *** [all-recursive] Error 1


PS: I am using a Home Windows edition.

Ivan


Re: compiling JCHEVM with GCC/Cygwin

Posted by Enrico Migliore <en...@fatti.com>.
snowdosker wrote:

> Hello Enrico
>
> I'm trying to build JCHEVM following your steps described at
> http://www.mail-archive.com/harmony-dev@incubator.apache.org/msg03212.html 
>
>
> I was able to build Classpath sucsesfuly, but
> fail making JCHEVM
>
> In result I have
>
> native/java_lang_VMThread.c: In function `JCNI_java_lang_VMThread_start':
> native/java_lang_VMThread.c:388: warning: implicit declaration of 
> function `pthread_attr_setstackaddr'
> native/java_lang_VMThread.c:388: warning: nested extern declaration of 
> `pthread_attr_setstackaddr'
> make[2]: *** [java_lang_VMThread.o] Error 1
> make[2]: Leaving directory `/home/ivan/jchevm/libjc'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/ivan/jchevm/libjc'
> make: *** [all-recursive] Error 1
>
>
> Can you help me, please.
> Thanks, Ivan
>
>
>
Hi Ivan,

 if you're building JCHEVM with Cygwin, modify the following file:

                         .\libjc\arch\arch_definitions.h

at line 95.

Remove:
#define _JC_LIBRARY_FMT        "lib%s.so"

Add:
 #define _JC_LIBRARY_FMT        "lib%s.dll.a"

In order to achieve a successfull build, I had to change a few other things.
Before I post them here, let's see how it goes your build.
Are you using a Home or a Professional Windows edition?

Enrico




Re: compiling JCHEVM with GCC/Cygwin

Posted by Archie Cobbs <ar...@dellroad.org>.
snowdosker wrote:
> Hello Enrico
> 
> I'm trying to build JCHEVM following your steps described at
> http://www.mail-archive.com/harmony-dev@incubator.apache.org/msg03212.html
> 
> I was able to build Classpath sucsesfuly, but
> fail making JCHEVM
> 
> In result I have
> 
> native/java_lang_VMThread.c: In function `JCNI_java_lang_VMThread_start':
> native/java_lang_VMThread.c:388: warning: implicit declaration of 
> function `pthread_attr_setstackaddr'
> native/java_lang_VMThread.c:388: warning: nested extern declaration of 
> `pthread_attr_setstackaddr'
> make[2]: *** [java_lang_VMThread.o] Error 1
> make[2]: Leaving directory `/home/ivan/jchevm/libjc'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/ivan/jchevm/libjc'
> make: *** [all-recursive] Error 1

You can workaround the lack of pthread support in cygwin by defining
_JC_NO_THREAD_ATTRIBUTES at the top of that file.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com