CENTOS/RHEL: How to build V8 and then link to it?

577 views
Skip to first unread message

kent williams

unread,
Dec 7, 2016, 12:31:38 PM12/7/16
to v8-users

What I've done so far:
Based on what I've gathered from the v8 WIKI combined with trial and error I use this script

export PATH="$(pwd)/depot_tools:${PATH}"
gclient sync
fetch v8
cd v8
gn gen out.gn/x64.debug --args='is_debug=true target_cpu="x64" is_component_build=false'
#tools/dev/v8gen.py x64.debug

That works, but in my opinion this is a whole load of hand waving and nonsense.  I'm using depot_tools which has a whole giant CLang++ toolset as binaries.  This is no way to run a railroad in my opinion but this is Google, they do what they want.

Then I tried the simplest possible thing -- copy shell.cc out of v8/samples, and make a CMake project to build it.

project(v8Shell)
link_directories(${V8_DIR}/out.gn/x64.debug/obj)
link_directories(${V8_DIR}/out.gn/x64.release/obj)
link_directories(${V8_DIR}/out.gn/x64.debug/obj/third_party)
link_directories(${V8_DIR}/out.gn/x64.release/obj/third_party)
include_directories(SYSTEM BEFORE
  ${V8_DIR}/include
  ${CMAKE_CURRENT_BINARY_DIR})

set(V8_LIBRARY v8_libplatform v8_libbase icui18n icuuc pthread)
add_executable(shell shell.cc)
target_link_libraries(shell ${V8_LIBRARY})

What happens then is a ton of undefined symbols (output at the end of this e-mail).

I've tried the obvious solution -- just install the system v8 package -- but the version of v8 that's in the Centos repos is way too old. It doesn't support the currently documented API.

Is there a way to just BUILD THE V8 Libraries and link them without depot_tools?  Why is this so complicated and obscure?

/usr/bin/c++    -std=c++11 -pthread -DLeepDebug -DLeepDebug -g   CMakeFiles/shell.dir/shell.cc.o  -o shell  -L/onderon-home/kwilliams/develop/pagewiz.v8/build/dependencies-install/lib  -L/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.debug/obj  -L/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.release/obj  -L/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.debug/obj/third_party -rdynamic -lv8_libplatform -lv8_libbase -licui18n -licuuc -lpthread -Wl,-rpath,/onderon-home/kwilliams/develop/pagewiz.v8/build/dependencies-install/lib:/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.debug/obj:/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.release/obj:/onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.debug/obj/third_party 
CMakeFiles/shell.dir/shell.cc.o: In function `main':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:67: undefined reference to `v8::V8::InitializeICUDefaultLocation(char const*, char const*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:68: undefined reference to `v8::V8::InitializeExternalStartupData(char const*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:70: undefined reference to `v8::V8::InitializePlatform(v8::Platform*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:71: undefined reference to `v8::V8::Initialize()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:72: undefined reference to `v8::V8::SetFlagsFromCommandLine(int*, char**, bool)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:75: undefined reference to `v8::ArrayBuffer::Allocator::NewDefaultAllocator()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:76: undefined reference to `v8::Isolate::New(v8::Isolate::CreateParams const&)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:81: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
CMakeFiles/shell.dir/shell.cc.o: In function `Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8027: undefined reference to `v8::Context::Enter()'
CMakeFiles/shell.dir/shell.cc.o: In function `~Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8029: undefined reference to `v8::Context::Exit()'
CMakeFiles/shell.dir/shell.cc.o: In function `main':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8029: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `main':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:91: undefined reference to `v8::Isolate::Dispose()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:92: undefined reference to `v8::V8::Dispose()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:93: undefined reference to `v8::V8::ShutdownPlatform()'
CMakeFiles/shell.dir/shell.cc.o: In function `~Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8029: undefined reference to `v8::Context::Exit()'
CMakeFiles/shell.dir/shell.cc.o: In function `main':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:81: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:110: undefined reference to `v8::ObjectTemplate::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:115: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:115: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:115: undefined reference to `v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:119: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:119: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:119: undefined reference to `v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:123: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:123: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:123: undefined reference to `v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:127: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:127: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:127: undefined reference to `v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:132: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:132: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `CreateShellContext(v8::Isolate*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:132: undefined reference to `v8::Template::Set(v8::Local<v8::Name>, v8::Local<v8::Data>, v8::PropertyAttribute)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:134: undefined reference to `v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>)'
CMakeFiles/shell.dir/shell.cc.o: In function `Print(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:144: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:150: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:150: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:153: undefined reference to `v8::HandleScope::~HandleScope()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:150: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:153: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:166: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:166: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:169: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:173: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:173: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:180: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:180: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8655: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
CMakeFiles/shell.dir/shell.cc.o: In function `Read(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:183: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
CMakeFiles/shell.dir/shell.cc.o: In function `Load(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:192: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:193: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:197: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Load(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:197: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:204: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Load(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:204: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:210: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `Load(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:210: undefined reference to `v8::Isolate::ThrowException(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:211: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:193: undefined reference to `v8::HandleScope::~HandleScope()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:193: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:213: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `Quit(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:223: undefined reference to `v8::Isolate::GetCurrentContext()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:223: undefined reference to `v8::Value::Int32Value(v8::Local<v8::Context>) const'
CMakeFiles/shell.dir/shell.cc.o: In function `Version(v8::FunctionCallbackInfo<v8::Value> const&)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:233: undefined reference to `v8::V8::GetVersion()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:233: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReadFile(v8::Isolate*, char const*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:257: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `RunMain(v8::Isolate*, v8::Platform*, int, char**)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:281: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunMain(v8::Isolate*, v8::Platform*, int, char**)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:285: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:295: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunShell(v8::Local<v8::Context>, v8::Platform*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:312: undefined reference to `v8::V8::GetVersion()'
CMakeFiles/shell.dir/shell.cc.o: In function `Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8027: undefined reference to `v8::Context::Enter()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunShell(v8::Local<v8::Context>, v8::Platform*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:318: undefined reference to `v8::Context::GetIsolate()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:318: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunShell(v8::Local<v8::Context>, v8::Platform*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:324: undefined reference to `v8::Context::GetIsolate()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:324: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:328: undefined reference to `v8::Context::GetIsolate()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:329: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int)'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunShell(v8::Local<v8::Context>, v8::Platform*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:329: undefined reference to `v8::Context::GetIsolate()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:330: undefined reference to `v8::Context::GetIsolate()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:332: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `~Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8029: undefined reference to `v8::Context::Exit()'
CMakeFiles/shell.dir/shell.cc.o: In function `RunShell(v8::Local<v8::Context>, v8::Platform*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:332: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `~Scope':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8029: undefined reference to `v8::Context::Exit()'
CMakeFiles/shell.dir/shell.cc.o: In function `ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::Value>, bool, bool)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:341: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:342: undefined reference to `v8::TryCatch::TryCatch(v8::Isolate*)'
CMakeFiles/shell.dir/shell.cc.o: In function `ScriptOrigin':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8828: undefined reference to `v8::Value::IsTrue() const'
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8827: undefined reference to `v8::Value::IsTrue() const'
CMakeFiles/shell.dir/shell.cc.o: In function `ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::Value>, bool, bool)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:344: undefined reference to `v8::Isolate::GetCurrentContext()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:346: undefined reference to `v8::Script::Compile(v8::Local<v8::Context>, v8::Local<v8::String>, v8::ScriptOrigin*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:353: undefined reference to `v8::Script::Run(v8::Local<v8::Context>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:354: undefined reference to `v8::TryCatch::HasCaught() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:360: undefined reference to `v8::TryCatch::HasCaught() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:364: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:366: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:342: undefined reference to `v8::TryCatch::~TryCatch()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:370: undefined reference to `v8::HandleScope::~HandleScope()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:366: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:342: undefined reference to `v8::TryCatch::~TryCatch()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:370: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReportException(v8::Isolate*, v8::TryCatch*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:375: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:376: undefined reference to `v8::TryCatch::Exception() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:376: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:378: undefined reference to `v8::TryCatch::Message() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:385: undefined reference to `v8::Message::GetScriptOrigin() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:385: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:386: undefined reference to `v8::Isolate::GetCurrentContext()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:388: undefined reference to `v8::Message::GetLineNumber(v8::Local<v8::Context>) const'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Maybe<int>::FromJust() const':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:7620: undefined reference to `v8::V8::FromJustIsNothing()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReportException(v8::Isolate*, v8::TryCatch*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:392: undefined reference to `v8::Message::GetSourceLine(v8::Local<v8::Context>) const'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::MaybeLocal<v8::String>::ToLocalChecked()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:8459: undefined reference to `v8::V8::ToLocalEmpty()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReportException(v8::Isolate*, v8::TryCatch*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:392: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:396: undefined reference to `v8::Message::GetStartColumn(v8::Local<v8::Context>) const'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Maybe<int>::FromJust() const':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:7620: undefined reference to `v8::V8::FromJustIsNothing()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReportException(v8::Isolate*, v8::TryCatch*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:400: undefined reference to `v8::Message::GetEndColumn(v8::Local<v8::Context>) const'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Maybe<int>::FromJust() const':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:7620: undefined reference to `v8::V8::FromJustIsNothing()'
CMakeFiles/shell.dir/shell.cc.o: In function `ReportException(v8::Isolate*, v8::TryCatch*)':
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:406: undefined reference to `v8::TryCatch::StackTrace(v8::Local<v8::Context>) const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:408: undefined reference to `v8::String::Length() const'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:409: undefined reference to `v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:411: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:392: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:412: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:376: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:413: undefined reference to `v8::HandleScope::~HandleScope()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:411: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:392: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:412: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:376: undefined reference to `v8::String::Utf8Value::~Utf8Value()'
/onderon-home/kwilliams/develop/pagewiz.v8/pagewiz/shell.cc:413: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Isolate::CreateParams::CreateParams()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:6249: undefined reference to `v8::ResourceConstraints::ResourceConstraints()'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Isolate::Scope::Scope(v8::Isolate*)':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:6321: undefined reference to `v8::Isolate::Enter()'
CMakeFiles/shell.dir/shell.cc.o: In function `v8::Isolate::Scope::~Scope()':
/usr/local/kwilliams/develop/pagewiz.v8/build/v8/include/v8.h:6324: undefined reference to `v8::Isolate::Exit()'
collect2: error: ld returned 1 exit status
make[2]: *** [shell] Error 1
make[2]: Leaving directory `/usr/local/kwilliams/develop/pagewiz.v8/build/PageWiz-build'
make[1]: *** [CMakeFiles/shell.dir/all] Error 2
make[1]: Leaving directory `/usr/local/kwilliams/develop/pagewiz.v8/build/PageWiz-build'
make: *** [all] Error 2

Compilation exited abnormally with code 2 at Wed Dec  7 11:17:52

Ben Noordhuis

unread,
Dec 7, 2016, 12:48:30 PM12/7/16
to v8-users
The link order is fairly crucial. Try adding -Wl,--no-as-needed. If
linking now succeeds, you know you need to rearrange the -l<lib>
switches until it works.

kent williams

unread,
Dec 7, 2016, 1:14:59 PM12/7/16
to v8-users
On Wednesday, December 7, 2016 at 11:48:30 AM UTC-6, Ben Noordhuis wrote:


The link order is fairly crucial.  Try adding -Wl,--no-as-needed.  If 
linking now succeeds, you know you need to rearrange the -l<lib> 
switches until it works. 
 
Makes no difference.  I can see why there's a problem -- the first few undefined symbols reported are defined in api.cc, but the libraries built don't include that object file (see below).

The problem is that the build system based on gn doesn't make sense to me, and I have a hard time working out how to debug what it's doing.  Not including important files in the libraries would explain a lot. Why that's happening? no clue

ar -t obj/libv8_libbase.a 
bits.o
cpu.o
stack_trace.o
division-by-constant.o
file-utils.o
functional.o
ieee754.o
logging.o
once.o
condition-variable.o
mutex.o
semaphore.o
time.o
sys-info.o
random-number-generator.o
platform-posix.o
stack_trace_posix.o
platform-linux.o
onderon /onderon-home/kwilliams/develop/pagewiz.v8/build/v8/out.gn/x64.debug $ ar -t obj/libv8_libplatform.a 
default-platform.o
task-queue.o
trace-buffer.o
trace-config.o
trace-object.o
trace-writer.o
tracing-controller.o
worker-thread.o

kent williams

unread,
Dec 7, 2016, 3:35:19 PM12/7/16
to v8-users
OK so I solved this more or less.

1. The GN build is broken with respect to building static libraries.  Once you leave 'gn land' and try and build something you're kind of screwed.
2. The deprecated GYP build does the right thing. For the moment I don't care if it's deprecated, since I'm going to pick a release tag and stick with it.

To build v8:
export PATH="$(pwd)/depot_tools:$PATH"
gclient sync
git clone -b 5.7.99 --single-branch https://chromium.googlesource.com/v8/v8.git
cd v8
make -j4 native

To build shell.cc with cmake:

project(shell)
cmake_minimum_required(VERSION 2.8)

link_directories(${V8_DIR}/out/native/obj.target/src)
link_directories(${V8_DIR}/out/native/obj.target/third_party)
link_directories(${V8_DIR}/out/native/obj.target/third_party/icu)

set(V8_LIBRARY v8_libplatform v8_base v8_libbase v8_nosnapshot v8_libsampler icui18n icuuc pthread)

include_directories(SYSTEM BEFORE ${V8_DIR} ${V8_DIR}/include
  ${CMAKE_CURRENT_BINARY_DIR})

Reply all
Reply to author
Forward
0 new messages