スキップしてメイン コンテンツに移動

Try V8 on Ubuntu

Intro

Because I had wanted to know how JavaScript worked, I tried to build and use V8.

I used Ubuntu19.10 what installed on Mac mini.
Because its Mac OS already hadn't been updated.

Install and build V8

After installing Ubuntu, I installed git, vim, Python(ver.2.7.17) for building V8.
sudo apt install git vim python

Most of all software for building V8, I installed after a while by following the documents.
But these had been needed at the begining of building.

build V8

Most of all steps had been on the documents.
But because I forgot some of them, So I got some errors :P

1. clone depot_tools and add installed path.
depot_tools tutorial(7)
2. make a directory for installing v8 and move to there
"mkdir ~/v8" & "cd ~/v8"
3. "fetch v8"
Checking out the V8 source code - v8
4. update files
"git pull --rebase origin" & "gclient sync"
5. install dependencies with "./build/install-build-deps.sh"
Building V8 from source - v8
6. add the alias for gm and v8gen.
"alias gm=~/v8/v8/tools/dev/gm.py" & "alias v8gen=~/v8/v8/tools/dev/v8gen.py"
Building V8 with GN - v8
7. build v8 with gm
"gm x64.release" & "gm x64.release.check"

Because I had forgotten step 5, so I failed building v8.
After buiding v8, I built the hello-world.cc by the document.
Getting started with embedding V8 - v8

Finally I could get this message.
Hello, World!
3 + 4 = 7

Good :)

process.cc and shell.cc also could be built by the same way.

Install cquery

Next, I installed VSCode and cquery.
GUI and IDE setup - V8

VSCode

I just downloaded the deb file and installed.
Visual Studio Code - Code Editing. Redefined

cquery

Before install cquery, I had had to install some software.
sudo apt install clang clang-tools llvm llvm-6.0-tools libclang-6.0-dev libncurses5
Most important was libncurses5.
Before I had installed it, I got an error when I executed cmake command.
...
CMake Error at cmake/FindClang.cmake:95 (message):
  Error retrieving Clang resource directory with Clang executable.  Output:
   /home/example/cquery/build/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang++: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
Call Stack (most recent call first):
  CMakeLists.txt:108 (find_package)
-- Configuring incomplete, errors occurred!
...
Building cquery · cquery-project/cquery Wiki · GitHub
android - clang: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory - Stack Overflow

add cquery settings to VSCode

To use cquery for v8, I added settings to VSCode.
1. I opened v8 folder by VSCode.
2. I opened settings by ctrl + ,
3. I opened settings.json by "Open Settings(JSON)"
4. I added below and saved

settings.json


{
    "cquery.launch.command": "~/cquery/build/release/bin/cquery",
    "cquery.cacheDirectory": "~/v8/v8/.vscode/cquery_cached_index/",
    "cquery.completion.include.blacklist": [".*/.vscache/.*", "/tmp.*", "build/.*"],
}

Next time, I would read samples or write some codes to try.

コメント

このブログの人気の投稿

[Angular][ASP.NET Core] Upload chunked files

Intro I wanted to send files to Web application (made by ASP.NET Core). If the file size had been small, I didn't need do any special things. But when I tried to send a large file, the error was occurred by ASP.NET Core's limitation. Though I could change the settings, but I didn't want to do that, because I hadn't known the file sizes what would been actually using. So I splitted the data into chunks first, and sent them. After receiving all chunks, I merged them into one file. There might be some libraries or APIs (ex. Stream API) what did them automatically, but I couldn't find them. What I did [ASP.NET Core] Make CORS enabled [Angular] Split a large file into chunks [Angular][ASP.NET Core] Send and receive data as form data [ASP.NET Core] Merge chunks into one file [ASP.NET Core] Make CORS enabled Because the client side application(Angular) and the server side application(ASP.NET Core) had been separated, I had to make CORS(Cross-Origin Requests) ...

[PostgreSQL] Play with TypeORM 1

Intro This time, I tried accessing Database by TypeORM. Because I wanted to manage Database tables by ORM, I created a table first.  GitHub - typeorm/typeorm   TypeORM - Amazing ORM for TypeScript and JavaScript (ES7, ES6, ES5). Installation and creating a project Installation TypeORM needed "reflect-metadata" and database driver. npm install --save typeorm reflect-metadata pg typescript tsc npm install --save-dev @types/node And I also installed "ts-node" to skip compiling. npm install --save ts-node Preparing References I could generate a TypeORM project by TypeORM command. npx typeorm init --name gen-typeorm-sample --database postgres I refered Most of all settings from it. Adding files and folders First, I added tsconfig.json. npx tsc --init And I edited like below. tsconfig.json { "compilerOptions": { /* Basic Options */ "incremental": true, "target": "es5", "module": "comm...

[Ubuntu] Install Docker, PostgreSQL(From DockerHub), PgAdmin4 + SELECT ALL

Intro I build development of PostgreSQL environment on Ubuntu this time. Because I haven't wanted to install PostgreSQL directly, I use Docker to install it. After installing them, I will try some SQL. Build development environments Docker According to the documents, I add repository and install "docker-ce", "docker-ce-cli", "containerd.io" Get Docker Engine - Community for Ubuntu | Docker Documentation When I had installed "Docker for Windows" on Windows, it had the GUI application. But maybe there is no GUI application for Ubuntu or I need installing another package? PostgreSQL(Docker Hub) Because I have wanted to use latest version, I just do "docker pull postgres". postgres - Docker Hub After getting PostgreSQL, I made mistake when I did "docker run". docker run (failed) docker run --name sample-shop -e POSTGRES_PASSWORD=postgres -d postgres -p 5432:5432 There are no any errors, but I can't access to...