1. 程式人生 > >point_cloud_viewer編譯記錄

point_cloud_viewer編譯記錄

1.安裝 Rust,這是一個編譯工具包
  # curl https://sh.rustup.rs -sSf | sh
   這個需要下載一些包
安裝過程
Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin
directory, located at:

  /home/shen/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile file located at:

  /home/shen/.profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
     default toolchain: stable
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
320.1 KiB / 320.1 KiB (100 %) 182.6 KiB/s ETA:   0 s                
info: latest update on 2018-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
info: downloading component 'rustc'
 76.4 MiB /  76.4 MiB (100 %) 360.7 KiB/s ETA:   0 s                
info: downloading component 'rust-std'
 52.8 MiB /  52.8 MiB (100 %) 438.4 KiB/s ETA:   0 s                
info: downloading component 'cargo'
  4.4 MiB /   4.4 MiB (100 %) 143.5 KiB/s ETA:   0 s                
info: downloading component 'rust-docs'
  8.9 MiB /   8.9 MiB (100 %) 284.4 KiB/s ETA:   0 s                
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable'

  stable installed - rustc 1.30.1 (1433507eb 2018-11-07)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env

然後 執行# source $HOME/.cargo/env

2 按照ci/install_proto3.sh,安裝protobuf3
3.Install the rust gRPC protobuf plugin:
#cargo install grpcio-compiler
and make sure it is in your $PATH. This has more dependencies, it requires cmake and go. On mac: brew install cmake go.
這裡需要安裝一下Go語言
#sudo apt-get install golang-go
export GOROOT=$HOME/go
export PATH=$GOROOT/bin:$PATHU

二、creating octrees
4.進入point_cloud_viewer
   #cargo build --release
   執行以下命令,產生一個octree out of ply檔案
   #target/release/build_octree
   build_octree <input> --output_directory <output_directory> --resolution <resolution>


三 SDL client
1.安裝SDL2 #sudo apt-get install libsdl2-dev
2 #cd sdl_viewer/
3 # cargo build --release
編譯過程中會出錯:
I fail to build SDL client at step 3: cargo build --release. I got the following error msg:

cargo build --release
Compiling point_viewer_grpc_proto_rust v0.1.0 (file:///home/sean/sean/cartographer_ws/point_cloud_viewer-master/point_viewer_grpc_proto_rust)
Compiling collision v0.18.0
error: failed to run custom build command for point_viewer_grpc_proto_rust v0.1.0 (file:///home/sean/sean/cartographer_ws/point_cloud_viewer-master/point_viewer_grpc_proto_rust)
process didn't exit successfully: /home/sean/sean/cartographer_ws/point_cloud_viewer-master/target/release/build/point_viewer_grpc_proto_rust-d13b2a85d9c9c3b2/build-script-build (exit code: 101)
--- stdout
cargo:rerun-if-changed=point_viewer_proto_rust/src/proto.proto
--- stderr
thread 'main' panicked at 'called Option::unwrap() on a None value', libcore/option.rs:335:21
note: Run with RUST_BACKTRACE=1 for a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed

Before building sdl client, I have already installed "rust gRPC protobuf plugin". Under "${HOME}/.cargo/bin", I do see grpc_rust_plugin. Also, PATH variable has "/home/sean/.cargo/bin" section. Can someone give help on my issue?
解決方法:
I think I figure out the resaon:
build.rs is looking for '.git' file as a sign of root dir. However, I download the repro so there is no git file.

while !path.join(".git").exists() {
path = path.parent().unwrap();
}

#cd point_cloud_viewer
#git init .
then recompile

4 Run with ../target/release/sdl_viewer <octree directory>


四 web Viewer編譯
先編譯 client
1.cd octree_web_viewer/client
2.安裝 nvm  https://github.com/creationix/nvm
  1)install script
To install or update nvm, you can use the install script using cURL:

#curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
or Wget:

#wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

To build,

1.Change into the web viewer's client directory:
#cd octree_web_viewer/client.
2.Install npm. We strongly suggest using nvm. On Mac brew install nvm.
Install node version 8: #nvm install 8. Change to the web viewer's client directory:
# cd client
, then set node version to 8: #
#nvm use 8.
Install javascript dependencies: npm install.
Build the client:
#npm run build.
下面編譯server
Then build the server:
#cargo build --release
 Serve up the octree using
#../target/release/octree_web_viewer <octree directory>
開啟Chrome to http://localhost:5433,
使用W A S D按鍵 滑鼠左鍵拖動. 滑鼠滾輪改變移動速度.