Problem loading GCC 4.0 libraries on Mac

Zoltan Foley-Fisher <[email protected]> Thu, 28 Jun 2007 15:07:32 -0700
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
--===============1846134496==
Content-Type: multipart/alternative; boundary=Apple-Mail-17-750305699


--Apple-Mail-17-750305699
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Hello there,

We are having an issue with compilation differences between GCC 3.3  
and 4.0, Mac OS 10.4.10, on PowerPC using 10.3.9 SDK, on Intel using  
10.4u SDK.

We are working with the JRex library to embed Gecko framework in a  
Universal Java application. When we compile using GCC 3.3, the  
appropriate dynamic libraries are created without problem and  
packaged into a Java application bundle, which launches correctly.

But when we compile the same code with GCC 4.0, the dynamic libraries  
are created, but fail to load into our Java application correctly. We  
see some strange behaviours when using GDB, that occur every time the  
program is run, and in only very specific places in the large codebase:


On PPC, a C++ function is called

nsIXPConnect *xpc = nsContentUtils::XPConnect();

but returns null. nsContentUtils::XPConnect is defined as:

static nsIXPConnect *XPConnect()
   {
     return sXPConnect;
   }

  When we follow the call with GDB we notice that there are two  
sXPConnect symbols...




On Intel, another C++ function is called:

nsresult rv = CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,  
&sSecurityManager);

but the call results in sSecurityManager null. We follow the call  
with GDB and see correct values and code flow until this function  
return, where it mysteriously "drops" the value to be assigned to  
sSecurityManager.

Even more mysteriously, if we move the program counter back with GDB  
and repeat the function a second time, it returns the value for  
sSecurityManager correctly!




Have you guys encountered such behaviour before?

Thanks for any help,
Zoltan Foley-Fisher

Atimi Software Inc.

--Apple-Mail-17-750305699
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">
<div style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">Hello there,</font></div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: =
normal normal normal 12px/normal Helvetica; min-height: 14px; =
"><br></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "><font face=3D"Helvetica" =
size=3D"3" style=3D"font: 12.0px Helvetica">We are having an issue with =
compilation differences between GCC 3.3 and 4.0, Mac OS 10.4.10,=A0on =
PowerPC=A0using 10.3.9 SDK, on Intel using=A010.4u SDK.</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font =
face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px Helvetica">We are =
working with the JRex=A0library to embed Gecko framework in a Universal =
Java application. When we compile using GCC 3.3, the appropriate dynamic =
libraries are created without problem and packaged into a Java =
application bundle, which launches correctly.</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font =
face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px Helvetica">But when =
we compile the same code with GCC 4.0, the dynamic libraries are =
created, but fail to load into our Java application correctly. We see =
some strange behaviours when using GDB, that occur every time the =
program is run, and in only very specific places in the large =
codebase:</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font =
face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px Helvetica">On PPC, a =
C++ function is called</font></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Monaco" size=3D"2" style=3D"font: =
10.0px Monaco">nsIXPConnect *xpc =3D =
nsContentUtils::XPConnect();</font></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">but returns null.=A0</font><font face=3D"Monaco" =
size=3D"2" style=3D"font: 10.0px =
Monaco">nsContentUtils::XPConnect</font><font face=3D"Helvetica" =
size=3D"3" style=3D"font: 12.0px Helvetica">=A0is defined =
as:</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Monaco" size=3D"2" color=3D"#6b1b4f" =
style=3D"font: 10.0px Monaco; color: #6b1b4f">static</font><font =
face=3D"Monaco" size=3D"2" style=3D"font: 10.0px Monaco"> nsIXPConnect =
*XPConnect()</font></div><div style=3D"margin-top: 0px; margin-right: =
0px; margin-bottom: 0px; margin-left: 0px; "><font face=3D"Monaco" =
size=3D"2" style=3D"font: 10.0px Monaco">=A0 {</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Monaco" size=3D"2" style=3D"font: =
10.0px Monaco">=A0 =A0 </font><font face=3D"Monaco" size=3D"2" =
color=3D"#6b1b4f" style=3D"font: 10.0px Monaco; color: =
#6b1b4f">return</font><font face=3D"Monaco" size=3D"2" style=3D"font: =
10.0px Monaco"> sXPConnect;</font></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font =
face=3D"Monaco" size=3D"2" style=3D"font: 10.0px Monaco">=A0 =
}</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
10px/normal Monaco; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">=A0When we follow the call with GDB we notice that =
there are two sXPConnect symbols...</font></div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: =
normal normal normal 10px/normal Monaco; min-height: 14px; =
"><br></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
10px/normal Monaco; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 10px/normal Monaco; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 10px/normal Monaco; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">On Intel, another C++ function is =
called:</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
10px/normal Monaco; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Monaco" size=3D"2" style=3D"font: =
10.0px Monaco">nsresult rv =3D =
CallGetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,=A0&amp;sSecurityManage=
r);</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">but the call results in sSecurityManager null. We =
follow the call with GDB and see correct values and code flow until this =
function return, where it mysteriously "drops" the value to be assigned =
to sSecurityManager.</font></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">Even more mysteriously, if we move the program counter =
back with GDB and repeat the function a second time, it returns the =
value for=A0sSecurityManager=A0correctly!</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal =
normal normal 12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">Have you guys encountered such behaviour =
before?</font></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; font: normal normal normal =
12px/normal Helvetica; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">Thanks for any help,</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
12.0px Helvetica">Zoltan Foley-Fisher</font></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; font: normal normal normal 12px/normal Helvetica; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font =
face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px Helvetica">Atimi =
Software Inc.</font></div> </body></html>=

--Apple-Mail-17-750305699--

--===============1846134496==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
JRex mailing list
[email protected]
http://mozdev.org/mailman/listinfo/jrex

--===============1846134496==--