New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link error on "html_minifier_main" using GCC 4.9.0 + [Gold] Linker (binutils = release.binutils-2.24.51.0.3) #915

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
Copy link

GoogleCodeExporter commented Apr 6, 2015

Actual compile / link error is:

================================================================================

LINK(target) out/Release/html_minifier_main
out/Release/obj.target/pagespeed/../pagespeed_html/pagespeed/kernel/html/remove_
comments_filter.o: In function 
`net_instaweb::RemoveCommentsFilter::OptionsImpl::IsRetainedComment(base::BasicS
tringPiece<std::string> const&) const':

/root/mod_pagespeed/src/./pagespeed/kernel/html/remove_comments_filter.h:66: 
undefined reference to 
`net_instaweb::FastWildcardGroup::Match(base::BasicStringPiece<std::string> 
const&, bool) const'

/root/mod_pagespeed/src/./pagespeed/kernel/html/remove_comments_filter.h:66: 
undefined reference to 
`net_instaweb::FastWildcardGroup::Match(base::BasicStringPiece<std::string> 
const&, bool) const'

collect2: error: ld returned 1 exit status
make[1]: *** [out/Release/html_minifier_main] Error 1

================================================================================

Basically, the symbol for 'net_instaweb::FastWildcardGroup::Match' is not 
found. The required library for this is in the "libpagespeed_base.a" - and not 
the already included "libpagespeed_base_core.a".

The solution (I found and used), is to patch both files; 
src/net/instaweb/html_minifier_main.target.mk and 
src/net/instaweb/html_minifier_main_dependency_check.target.mk, and add the 
library -> libpagespeed_base.a.

1) ~/mod_pagespeed/src/net/instaweb/html_minifier_main.target.mk

Add: $(obj).target/pagespeed/libpagespeed_base.a
     ^---------------- [ADD ] -----------------^

2) 
~/mod_pagespeed/src/net/instaweb/html_minifier_main_dependency_check.target.mk

Mod: "$(obj).$(TOOLSET)/pagespeed/libpagespeed_base.a" 
     ^------------------- [ADD ] -------------------^

The above patch is to be done just after the "gclient runhooks" stage (or 
gclient sync --force --jobs=1).

I know patching the automatically "gyp" generated *.mk (make files) is a bit 
'backward', however - I have not (yet) traced back to what build *.gyp file to 
patch to achieve this change. I have attached the patch I used here:

Notes:

The 'Gold' Linker (HJ Lu's Linux binutils at 
https://www.kernel.org/pub/linux/devel/binutils/ ) is known to be more critical 
about unresolved
symbols using indirect dependent shared libraries. See 
https://sourceware.org/bugzilla/show_bug.cgi?id=10238 for some history.

It seems that the 'Gold' linker gold was not intended to be a precise 
replacement for the GNU linker...

Quoting a gold linker developers here: "What gold requires is that you 
enumerate all direct dependencies of the program itself.  If your program calls 
foo(), then you must explicitly link against some library which defines foo().  
The GNU linker permits foo() to be defined indirectly, by a dependency of some 
shared library which you do explicitly link against.  gold does not search 
those indirect dependencies for symbol definitions."

Original issue reported on code.google.com by peterbowey on 24 Mar 2014 at 2:34

Attachments:

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Thanks for the report. Actually it's supposed to be buildable with base_core 
alone, that's kinda the point of building. It's odd that I am not seeing the 
error...
It sounds like RemoveCommentsFilter::OptionsImpl needs to move out someplace, 
though.

Original comment by morlov...@google.com on 24 Mar 2014 at 5:02

@GoogleCodeExporter

This comment has been minimized.

Copy link

GoogleCodeExporter commented Apr 6, 2015

Should be fixed in r3878. Thanks again for reporting this!

Original comment by morlov...@google.com on 24 Mar 2014 at 7:26

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment