Re: compiling JCHEVM with GCC/Cygwin
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
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 None77520 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 None36069 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 None42354 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 None25836 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 None67398 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 None38220 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 None38852 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 None52886 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
Hi Salikh , Do you have cygwin1.dll in the PATH? yes you may want to use 'depends.exe' or 'dumpbin.exe /dependents' from Microsoft SDK or 'objdump --private-headers' from Cygwin distribution to find out what specific dynamic libraries jc.exe depends on. Thanks for the suggestion. I'll use them during the weekend. Enrico
Re: compiling JCHEVM with GCC/Cygwin
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
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
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
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
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_FMTlib%s.so Add: #define _JC_LIBRARY_FMTlib%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
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_FMTlib%s.so Add: #define _JC_LIBRARY_FMTlib%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
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
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
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: compiling JCHEVM with GCC/Cygwin
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