Link failure with libv8

400 views
Skip to first unread message

Mark Tarrabain

unread,
Jul 30, 2016, 12:13:41 PM7/30/16
to v8-users
Is there anything special I need to be doing if I want to compile v8 as a static library on one system and then build an application that links to it on another (same OS and cpu, but possibly a different compiler or compiler version)?   I was trying this yesterday, and when I went to build my application that links to v8 (on a different system than the one that built the library), I  received the following error:

lib/libv8_base.a: error adding symbols: Malformed archive
collect2: error: ld returned 1 exit status

Thanks
Mark


Jochen Eisinger

unread,
Aug 1, 2016, 3:28:43 AM8/1/16
to v8-users
Maybe your target system doesn't have the gold linker?

ld -v should say something like: GNU gold (GNU Binutils 2.26.20160125) 1.11

You can also try to compile v8 without gold by setting linux_use_bundled_gold=0 and linux_use_gold_flags=0 in your GYP_DEFINES

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Tarrabain

unread,
Aug 2, 2016, 6:03:57 PM8/2/16
to v8-users
I found the problem, by the way.  Apparently, v8 builds something called a thin archive that will not work on another machine. 

Are there any options that you can use when building v8 so that it builds a full archive library instead of a thin one?

Ben Noordhuis

unread,
Aug 3, 2016, 4:52:12 AM8/3/16
to v8-users
On Wed, Aug 3, 2016 at 12:03 AM, Mark Tarrabain <ma...@nerdflat.com> wrote:
> I found the problem, by the way. Apparently, v8 builds something called a
> thin archive that will not work on another machine.
>
> Are there any options that you can use when building v8 so that it builds a
> full archive library instead of a thin one?

It's something of a hack but passing cmd_alink_thin='rm -f $@ &&
$(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)' should disable the thin
archive.

Alternatively, you can try patching toolchain.gypi. Inside the
target_conditions section, add this:

['_type=="static_library"', { 'standalone_static_library': 1 }]

Perhaps you can turn that into a CL to submit to the project. I'd
suggest adding a variable to the Makefile to control thin vs. fat
archives, with thin being the default.
Reply all
Reply to author
Forward
0 new messages