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

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)

[Nest.js] Use WebSocket with ws

Intro Until last time , I had used node-web-rtc to try WebRTC. But because the example was a little complicated for I understood the core functions of using WebRTC. So I look for other frameworks or libraries. PeerJS is a famous library for WebRTC. peers/peerjs: Peer-to-peer data in the browser. - GitHub peers/peerjs-server: Server for PeerJS - GitHub PeerJS - Simple peer-to-peer with WebRTC A problem is I don't know how to integrate to the Nest.js project. I couldn't find examples. So I don't choose at least this time. What shall I choose? According MDN, WebRTC doesn't specify strictly what technology is used on server application for connecting two devices. Signaling and video calling - Web APIs | MDN But in many examples include MDN's one use WebSocket. samples-server/s/webrtc-from-chat at master · mdn/samples-server · GitHub So I try WebSocket in the Nest.js project. Use WebSocket in a Nest.js project Nest.js has a function for using We

[Nest.js] Show static files

Intro I wanted to use Nest.js and WebRTC(node-webrtc). NestJS - A progressive Node.js framework Documentation | NestJS - A progressive Node.js framework And because I wanted to try with simple page(not use JavaScript frameworks), I added static HTML, CSS, JavaScript into a Nest.js project. Prepare Install First, I installed @nestjs/cli. First steps | NestJS - A progressive Node.js framework As same as last time , I couldn't do global install because I had used Volta. But I could installed by volta. volta install @nestjs/cli Create project nest new nest-web-rtc-sample volta pin node@12 Run npm start After doing "npm start", I could getting "Hello World!" from http://localhost:3000. Add static files I could add static files by two ways. @nestjs/serve-static First one of them was using "serve-static". Serve Static | NestJS - A progressive Node.js framework npm install --save @nestjs/serve-static And I needed adding a module into app.modu