Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

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

Description

@GoogleCodeExporter
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:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions