WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
147816
Enable optimization causes undefined reference error for debug build
https://bugs.webkit.org/show_bug.cgi?id=147816
Summary
Enable optimization causes undefined reference error for debug build
Ting-Wei Lan
Reported
2015-08-09 05:43:12 PDT
We usually disable optimization for debug build, but I hope it doesn't fail when optimization is enabled. I got these messages when my CXXFLAGS contains -O2: lib/libjavascriptcoregtk-4.0.so.18.2.4: undefined reference to 'JSC::JSCell::inherits(JSC::ClassInfo const*) const' lib/libjavascriptcoregtk-4.0.so.18.2.4: undefined reference to 'JSC::JSCell::structure() const' ../../Source/WebCore/editing/InsertNodeBeforeCommand.cpp:47: error: undefined reference to 'WebCore::ContainerNode::renderer() const' I will attach a patch that add 3 lines of include to fix this problem.
Attachments
Fix debug build when optimization is enabled
(2.78 KB, patch)
2015-08-09 05:47 PDT
,
Ting-Wei Lan
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ting-Wei Lan
Comment 1
2015-08-09 05:47:21 PDT
Created
attachment 258592
[details]
Fix debug build when optimization is enabled
Alexey Proskuryakov
Comment 2
2015-08-09 11:42:44 PDT
Comment on
attachment 258592
[details]
Fix debug build when optimization is enabled View in context:
https://bugs.webkit.org/attachment.cgi?id=258592&action=review
> Source/JavaScriptCore/ChangeLog:3 > + Fix debug build when optimization is enabled
This patch seems OK to land, however I'm not sure what problem you are solving here. My understanding is that debug build is by definition -O0, and I don't see why to change that. If you are trying to enable assertions, that should be done by fixing release build with ASSERT_DISABLED set to 0.
Ting-Wei Lan
Comment 3
2015-08-10 00:01:21 PDT
Yes, debug build should be -O0, but I think it should not fail just because optimization is accidentally enabled. I found this problem when I forgot to check my CXXFLAGS before starting a build.
Alexey Proskuryakov
Comment 4
2015-08-10 09:00:48 PDT
I can imagine how much time can be wasted on debugging an issue like this, and how annoying that would be. If this is not a configuration that needs to be built, I think that it's better to catch that with an explicit compile error, so that it's easy to detect and fix. What do you think?
Ting-Wei Lan
Comment 5
2015-08-10 11:24:16 PDT
I think we still need to fix undefined reference problems because they are all caused by assert. Should I change the commit message to 'Fix undefined reference errors when assertion is enabled'? I think we can add some warning messages in a cmake file or commonly-used header, so users can see a lot of warnings. They know they are probably doing wrong things because it is hard to ignore all messages. I think we can add an error message to stop the build in build-webkit script or other scripts that are not used in building distribution packages. It is possible for users of source-based package managers (ports, pkgsrc, portage) to set CXXFLAGS globally for all packages, and causing build failure is very annoying because it stops building of all packages depending on WebKit. Packages usually use release build, but it is still possible for users to set an option to change it to debug build. (This option is called FULLDEBUG in FreeBSD ports although it seldom works)
Alexey Proskuryakov
Comment 6
2015-08-10 13:44:43 PDT
Comment on
attachment 258592
[details]
Fix debug build when optimization is enabled Are you saying that exactly the same issue happens in a release build with ASSERT_DISABLED set to 0? Then yes, I agree that this should be done.
Ting-Wei Lan
Comment 7
2015-08-10 23:41:36 PDT
I think it should happen in release build with ASSERT_DISABLED=0 because all these problems are caused by function calls done in assert, but I cannot test it because it doesn't build: ../../Source/WTF/wtf/dtoa/bignum.cc:772:30: error: use of undeclared identifier 'a' ASSERT(Bignum::Equal(a, *this)); ^ ../../Source/WTF/wtf/Assertions.h:235:8: note: expanded from macro 'ASSERT' (!(assertion) ? \ ^ 1 error generated.
WebKit Commit Bot
Comment 8
2015-08-11 09:46:07 PDT
Comment on
attachment 258592
[details]
Fix debug build when optimization is enabled Clearing flags on attachment: 258592 Committed
r188256
: <
http://trac.webkit.org/changeset/188256
>
WebKit Commit Bot
Comment 9
2015-08-11 09:46:10 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug