Re: Problem loading GCC 4.0 libraries on Mac

Zoltan Foley-Fisher <[email protected]> Thu, 12 Jul 2007 11:04:51 -0700
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
--===============1854921963==
Content-Type: multipart/alternative; boundary=Apple-Mail-2--202138318


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


The root of this issue: in the JRex makefile there is a build  
variable SHARED_LIBRARY_LIBS which links mozilla object files  
directly into the JRex dylib.. but the JRex code we have also loads  
mozilla libraries dynamically, duplicating some symbols.

Removing the SHARED_LIBRARY_LIBS variable solves the issues.

Somehow we were getting away lightly when using GCC 3.3..

Zoltan



On 28 Jun 2007, at 15:07, Zoltan Foley-Fisher wrote:

> 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-2--202138318
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><br class=3D"webkit-block-placeholder"></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">The root of this issue: in the JRex makefile there =
is a build variable SHARED_LIBRARY_LIBS which links mozilla object files =
directly into the JRex dylib.. but the JRex code we have also loads =
mozilla libraries dynamically, duplicating some symbols.</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><br class=3D"webkit-block-placeholder"></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Removing the=A0SHARED_LIBRARY_LIBS variable solves =
the issues.</div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "><br =
class=3D"webkit-block-placeholder"></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Somehow we =
were getting away lightly when using GCC 3.3..</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><br class=3D"webkit-block-placeholder"></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Zoltan</div> <div><div><br =
class=3D"webkit-block-placeholder"></div><div><br =
class=3D"webkit-block-placeholder"></div><div><br =
class=3D"webkit-block-placeholder"></div><div>On 28 Jun 2007, at 15:07, =
Zoltan Foley-Fisher wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"> <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> </blockquote></div><br></body></html>=

--Apple-Mail-2--202138318--

--===============1854921963==
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

--===============1854921963==--