On 7/13/06, Anton Luht <[EMAIL PROTECTED]> wrote:

Hello,

Some time ago I installed FreeBSD 6.1-RELEASE on my home computer and
tried to build original Harmony VM donation [1] + corresponding
classlib on it. In the end of the efforts I've managed to build it and
print something with '-?' argument, but unfortunately an attempt to
run 'Hello, world' app failed.

The algorithm was straighforward - when a compile error happened, I've
tried to fix it in a straightforward way just to make build pass this
stage, and I'm not surprised that the resulted VM doesn't work :)

Maybe the list of those changes will give an idea what things should
be modified to run Harmony on another platform.

Details:

- I've installed FreeBSD with complete sources (compat included).
- JRE was Diablo-JRE from [2].
- added packages (pkg_add -r) libiconv and libxml2
- linker complained about -ldl missing in many places - I've tried to
removed all -ldl entries but finally gave up and symlinked libdl.so
to libc.so
- replaced everywhere #include <malloc.h> with #include <stdlib.h>
- paths to some include files changed and some other includes changed, too
- replaced PTHREAD_MUTEX_RECURSIVE_NP with PTHREAD_MUTEX_RECURSIVE
(_NP stands for non-portable, so I believe it's not a big crime)
- mcontext_t has a slighly different structure, for example
   uc_mcontext.gregs[REG_EAX] -> uc_mcontext.mc_eax
- sigcontext has a slighly different structure, for example
   sigcontext.edi -> sigcontext.sc_edi
- flag for shmem SHM_HUGETLB is missing on FreeBSD - I've just removed it
- hysysinfo.c: changed hysysinfo_get_physical_memory to code taken from
[3]
- hysock.c - undefined HAS_RTNETLINK, changed SOL_IPV6 to IPPROTO_IPV6
- hysock.h - undefined GLIBC_R and defined NO_R (maybe better solution
would be ORIGINAL_R and linking with lc_r)
   changed
  #define OS_IPV6_ADD_MEMBERSHIP IPV6_ADD_MEMBERSHIP
  #define OS_IPV6_DROP_MEMBERSHIP IPV6_DROP_MEMBERSHIP
   to
   #define OS_IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
   #define OS_IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
- thrdsup.c - commented out _FPU_GETCW and _FPU_SETCW
- hysiglinux.c - changed sigvec signature
  sigvec (int sig, const struct sigvec *invec, struct sigvec *outvec)
  to
  sigvec (int sig, struct sigvec *invec, struct sigvec *outvec)
- pdsimpl.c - removed option SO_BINDTODEVICE (changed to 0). As far as
I understand, code with that flag returns available network interfaces
- I believe there's a possibility to rewrite in in a FreeBSD way.


Threads are a big problem. On Linux pthread_t is an unsigned int, on
FreeBSD - pthread* .

So things like code from gc_v4.cpp :

   for (unsigned int i = 0; i < get_num_worker_threads() ; i++) {

       // Point the GC thread to the GC object
       _gc_threads[i] = new GC_Thread(this, i);
       assert(_gc_threads[i]);
   }


won't work. I've just added cast to pthread_t but obviously this is
not a proper solution.

After  these modifications all modules compiled but linker complained
that some log4cxx functions with wchar_t couldn't be found. Adding
-DLOG4CXX_HAS_WCHAR_T=1 and -D__STDC_ISO_10646__=1 flags to log4xcc
compilation helped . After that ij compiled but attempt to run it
crashed on mutexes. Those calls to mutexes were in sections surrounded
with #if APR_HAS_THREADS and it's no wonder I've recompiled log4cxx
with -DAPR_HAS_THREADS=0 . After that ij finally printed the list of
its options given the -? argument.

I've tried to play with the code further trying to make it run 'Hello,
world' app but failed.

Hope it makes some sence.



Yep, it doesJ. Thanks for your efforts and letting us know about all
problems you faced with.

Sometimes even small fixes for the build system can be a cause of the big
issues to find not easily.

You've made a lot of things are not obvious at first glance and demand an
additional investigation.
In any case your information is very valuable.

Thanks,
Vladimir.

[1] http://issues.apache.org/jira/browse/HARMONY-438
[2] http://www.freebsdfoundation.org/downloads/java.shtml
[3]
http://lists.freebsd.org/pipermail/freebsd-hackers/2005-December/014733.html

--
Regards,
Anton Luht,
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to