[Open Office] JRE register fails when building 2.0.4 on Mandriva 2007 x86_64

Atle Nissestad atle.nissestad at norbit.no
Thu Oct 26 06:01:15 EDT 2006


Caolan McNamara wrote:

> So then we're looking for libgcj.so...
>
> If you save this as findhome.java
>
> class findhome
> {
>         public static void main(String args[])
>         {
>                 System.out.println(System.getProperty("java.home"));
>
> System.out.println(System.getProperty("gnu.classpath.home.url"));
>         }
> }
>
> gcj -C findhome.java
> gij findhome
>
> what does it say ?
>   
I'm at work now, and do not have access to my build computer. I'll try
this when I  come home tonight.
> e.g. mine (on i386) is 
> /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
> file:///usr/lib
>
> while on x86_64 it says...
> /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
> file:///usr/lib64
>
> Now the first line is java.home and the second is gnu.classpath.home.url
> and in jvmfwk/plugins/sunmajor/pluginlib/gnujre.cxx we assign java.home
> as m_sJavaHome and the other as m_sHome. We try m_sHome first and search
> for libjvm.so and the other various libgcj.sos, and then we search under
> m_sJavaHome.
>
> If for some reason we have *no* m_sJavaHome value, we set it to a
> default of /usr/lib. Depending on what you get as the results above it
> might be the case that we might need to change... 
>
> if (!m_sJavaHome.getLength())
>     m_sJavaHome = "file:///usr/lib";
>
> to
>
> if (!m_sJavaHome.getLength())
> #ifdef X86_64
>     m_sJavaHome = "file:///usr/lib64";
> #else
>     m_sJavaHome = "file:///usr/lib";
> #endif
>
>   
Yepp, but for me m_sJavaHome was set, so my ugly hack ended up like this:

#ifndef X86_64
if (!m_sJavaHome.getLength())
    m_sJavaHome = "file:///usr/lib";
#else
    m_sJavaHome = "file:///usr/lib64";
#endif

This apparently caused both /usr/lib and /usr/lib64 to be used as lib
search path.

> but then we might fall afoul of gcj's on x86_64 where there isn't a
> java.home set, but libgcj.so has been put into /usr/lib in which case we
> might need an additional
>
> #ifdef X86_64
>     if (!bRt)
>     {
>         m_sHome = "file:///usr/lib64";
>         for(i_path ip = libpaths.begin(); ip != libpaths.end(); ip++)
>         {
>             //Construct an absolute path to the possible runtime
>             OUString usRt= m_sHome + *ip;
>             DirectoryItem item;
>             if(DirectoryItem::get(usRt, item) == File::E_None)
>             {
>                 //found runtime lib
>                 m_sRuntimeLibrary = usRt;
>                 bRt = true;
>                 break;
>             }
>         }
>     }
> #endif
>
> after the existing last 
> if (!bRt) ...
>
>   
Ok, maybe that's the way to go. Thanks for the explanation (code hacking
is not my strong side ..).

Atle


More information about the Openoffice mailing list