Search code examples
c++ubuntuclangv8

libv8_libplatform.a: error adding symbols: Malformed archive


I have built and linked against v8 successfully on Windows and Mac, but with Ubuntu 18.04, I get the following error when I try to link against libv8_libplatform.a that was built:

../../lib/Linux/libv8_libplatform.a: error adding symbols: Malformed archive
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/v8_test_project.dir/build.make:86: recipe for target 'v8_test_project' failed
make[2]: *** [v8_test_project] Error 1

Here are the gn arguments I used:

is_component_build = false
is_debug = false
target_cpu = x64
use_custom_libcxx = false
v8_monolithic = true
v8_use_external_startup_data = false
is_clang = true
use_lld = true
use_sysroot = false
linux_use_bundled_binutils = true

The v8 documentation doesn't seem to indicate that I need to do anything particular to setup the build chain for Ubuntu, but I may have missed something.

Here is my clang version:

Ubuntu clang version 10.0.1-++20200708123507+ef32c611aa2-1~exp1~20200707224105.191 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64

Edit:

I created a new install of Ubuntu 18.04 and followed the tutorial here with the same results.


Solution

  • The error still exists, but I found that when building on Ubuntu, you seemingly do not need to link against libv8_libplatform.a in order to build, so the error can be avoided.