Trunk builds fail when using --enable-cpp-rtti

RESOLVED FIXED

Status

()

RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: smichaud, Assigned: smichaud)

Tracking

({regression})

Trunk
All
Mac OS X
regression
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Starting fairly recently (in the last month or so), trunk builds now
fail (at least on OS X) when you have the following line in your
mozconfig file:

ac_add_options --enable-cpp-rtti

The following error occurs while trying to build (i.e. to link) the
XUL module:

Undefined symbols:
  "typeinfo for JSCrossCompartmentWrapper", referenced from:
      typeinfo for xpc::CrossOriginWrapperin CrossOriginWrapper.o
      typeinfo for xpc::FilteringWrapper<JSCrossCompartmentWrapper,
                     xpc::ExposedPropertiesOnly>in FilteringWrapper.o
      typeinfo for xpc::FilteringWrapper<JSCrossCompartmentWrapper,
                     xpc::OnlyIfSubjectIsSystem>in FilteringWrapper.o
      typeinfo for xpc::XrayWrapper<JSCrossCompartmentWrapper>in XrayWrapper.o
ld: symbol(s) not found

I've tried and failed to find a solution.  The
JSCrossCompartmentWrapper symbols are all exported ("external") in
libmozjs.dylib (and jswrapper.o), and the command to build the XUL
module does link in libmozjs.dylib ("-lmozjs").  I can't figure out
what else might be wrong.

Possibly this is a compiler error -- I'm using gcc 4.2.  The same
error happens on both OS X 10.5.8 and OS X 10.6.4.

Comment 1

8 years ago
Currently each method of JSCrossCompartmentWrapper is exported, but the better way to do this is probably just use

class JS_FRIEND_API JSCrossCompartmentWrapper, which will export not only all the members, but also the typeinfo.
Assignee: nobody → general
Component: XPConnect → JavaScript Engine
QA Contact: xpconnect → general
(Assignee)

Comment 2

8 years ago
I used the syntax "class JS_FRIEND_API(JSCrossCompartmentWrapper)", and removed the JS_FRIEND_API() wrapper from all of this class's methods.  This seems to work just fine.

Comment 3

8 years ago
Hi,

This fails also on Linux since (at least) FF4 Beta 2 and is very annoying for embedders like me... I cannot link our sources, which use RTTI. 

Thanks for the workaround, Benjamin, I will use that while waiting for the official fix.


Error under Linux is very similar to what reported by Steven:

---------------------------------------------------------------------
../../staticlib/components/libgklayout.a(CrossOriginWrapper.o):(.data.rel.ro._ZTIN3xpc18CrossOriginWrapperE[typeinfo for xpc::CrossOriginWrapper]+0x8): undefined reference to `typeinfo for JSCrossCompartmentWrapper'
../../staticlib/components/libgklayout.a(FilteringWrapper.o):(.data.rel.ro._ZTIN3xpc16FilteringWrapperI25JSCrossCompartmentWrapperNS_21ExposedPropertiesOnlyEEE[typeinfo for xpc::FilteringWrapper<JSCrossCompartmentWrapper, xpc::ExposedPropertiesOnly>]+0x8): undefined reference to `typeinfo for JSCrossCompartmentWrapper'
../../staticlib/components/libgklayout.a(FilteringWrapper.o):(.data.rel.ro._ZTIN3xpc16FilteringWrapperI25JSCrossCompartmentWrapperNS_21OnlyIfSubjectIsSystemEEE[typeinfo for xpc::FilteringWrapper<JSCrossCompartmentWrapper, xpc::OnlyIfSubjectIsSystem>]+0x8): undefined reference to `typeinfo for JSCrossCompartmentWrapper'
../../staticlib/components/libgklayout.a(XrayWrapper.o):(.data.rel.ro._ZTIN3xpc11XrayWrapperI25JSCrossCompartmentWrapperEE[typeinfo for xpc::XrayWrapper<JSCrossCompartmentWrapper>]+0x8): undefined reference to `typeinfo for JSCrossCompartmentWrapper'
------------------------------------------------------------
(Assignee)

Comment 4

8 years ago
Created attachment 463582 [details] [diff] [review]
Fix (follow bsmedberg's suggestion)

This fix works fine on OS X.

Thanks, bsmedberg, for your suggestion!
Assignee: general → smichaud
Status: NEW → ASSIGNED
Attachment #463582 - Flags: review?
(Assignee)

Updated

8 years ago
Attachment #463582 - Flags: review? → review?(gal)

Updated

8 years ago
Attachment #463582 - Flags: review?(gal) → review+
(Assignee)

Comment 5

8 years ago
Comment on attachment 463582 [details] [diff] [review]
Fix (follow bsmedberg's suggestion)

This patch makes a small change which is very unlikely to cause
trouble, but fixes a problem (a recent regression) that significantly
impacts embedders and those who (like myself) use rtti for debug
logging.
Attachment #463582 - Flags: approval2.0?
(Assignee)

Updated

8 years ago
Keywords: regression

Updated

8 years ago
Attachment #463582 - Flags: approval2.0? → approval2.0+
(Assignee)

Comment 6

8 years ago
Comment on attachment 463582 [details] [diff] [review]
Fix (follow bsmedberg's suggestion)

Landed on trunk:
http://hg.mozilla.org/mozilla-central/rev/634d179da621
(Assignee)

Updated

8 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.