Author Topic: Compiling BitShares X on Ubuntu 14.04, and RPC errors with web wallet  (Read 5673 times)

0 Members and 1 Guest are viewing this topic.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
1) run "npm install" without sudo
2) you need to make a links of you nodejs binary in your system to also be called node .. just like
ln -s /usr/bin/nodejs /usr/bin/node
but that is a distribution issue .. nothing from bitshares toolkit

Offline josojo

  • Newbie
  • *
  • Posts: 8
    • View Profile
Hey,

I tried this well done how-to-do.
At first, I had a problem:
got following error while running
sudo npm install -g lineman  ----- this one has no problem.
sudo npm install --- got following error

Code: [Select]

> lineman-less@0.0.1 postinstall /home/ubuntu/bitsharesx/programs/web_wallet/node_modules/lineman-less
> node script/postinstall.js

sh: 1: node: not found
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
 
npm ERR! weird error 127
npm ERR! not ok code 0
But I found the solution over here:
https://bitsharestalk.org/index.php?topic=6109.msg81741#msg81741

I am posting this, just in case other people have the same issue.
« Last Edit: August 15, 2014, 03:21:16 pm by josojo »

Offline valzav

  • Sr. Member
  • ****
  • Posts: 294
    • View Profile
I don't know why lineman is giving me this problem. If I comment out the offending console.log function in web_wallet/config/server.js, I don't get that particular error anymore but the web wallet still doesn't work because the HTTP POST requests to /rpc don't get any response back. Have I not set things up correctly? In particular, I am wondering how the web wallet (the lineman process) knows what RPC username and password to use when making the requests.

arhag, if "lineman build" works for you and you are not planning making live changes to web interface, just edit your config.json in data directory and specify path to web_wallet/dist in htdocs key.

Offline vertoe

  • Jr. Member
  • **
  • Posts: 30
  • i'm here
    • View Profile
Wow thanks for that. Took me half an hour to find out you need to build the web wallet first. Will create an AUR package now.

Edit https://aur.archlinux.org/packages/bitshares-x/
« Last Edit: July 25, 2014, 10:25:27 am by vertoe »

Offline arhag

  • Hero Member
  • *****
  • Posts: 1214
    • View Profile
    • My posts on Steem
  • BitShares: arhag
  • GitHub: arhag
I initially had some trouble getting the Qt client to compile on Linux, but I finally figured it out. I wrote this detailed guide on the steps I took to get the client to compile on my system (Ubuntu 14.04 x86_64). It might be useful to other people who are having compilation problems, but it's also part of a question I have regarding errors that I am still experiencing with the web wallet (web wallet errors are at the bottom of this post).


The following is the procedure I followed to build on x86_64 Ubuntu 14.04 (3.13.0-27-generic):

Install prerequisite packages from repository (according to BUILD_UBUNTU.md):
Code: [Select]
sudo apt-get update
sudo apt-get install cmake git libreadline-dev uuid-dev g++ libdb++-dev libdb-dev zip libssl-dev openssl build-essential python-dev autotools-dev libicu-dev libbz2-dev libboost-dev libboost-all-dev

Download latest BitShares X code from GitHub:
Code: [Select]
mkdir ~/bitshares
cd ~/bitshares
git clone https://github.com/dacsunlimited/bitsharesx.git
cd bitsharesx
git checkout 0.2.1
git submodule init
git submodule update

Download and install Qt 5.3.1 for Linux 64-bit from http://qt-project.org/downloads:
Code: [Select]
cd ~/bitshares
wget http://download.qt-project.org/official_releases/online_installers/qt-opensource-linux-x64-1.6.0-4-online.run
chmod +x qt-opensource-linux-x64-1.6.0-4-online.run
./qt-opensource-linux-x64-1.6.0-4-online.run
I used the GUI installer to install to ~/bitshares/Qt with the default installation options.

Download and install Node.js v0.10.29 from http://nodejs.org/download:
Code: [Select]
cd ~/bitshares
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29-linux-x64.tar.gz
tar xzf node-v0.10.29-linux-x64.tar.gz
cd node-v0.10.29-linux-x64
export PATH=/home/$USER/bitshares/node-v0.10.29-linux-x64/bin:$PATH

Install lineman and its dependencies in web_wallet folder using npm:
Code: [Select]
cd ~/bitshares/bitsharesx/programs/web_wallet
npm install -g lineman
npm install

Then, following directions from bitsharesx/programs/qt_wallet/README.md,
I configure using CMake:
Code: [Select]
cd ~/bitshares/
mkdir bitsharesx-build
cd bitsharesx-build
export CMAKE_PREFIX_PATH=/home/$USER/bitshares/Qt/5.3/gcc_64/
cmake -DINCLUDE_QT_WALLET=ON ../bitsharesx

However, CMake gave me an error with the following output:
Code: [Select]
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
-- Configuring BitShares on Linux
-- Using  as BerkeleyDB root
-- Looking for: db_cxx-6.0
-- debug/usr/lib/x86_64-linux-gnu/libdb_cxx.sooptimized/usr/lib/x86_64-linux-gnu/libdb_cxx.so
-- Found BerkeleyDB: /usr/include 
-- Using custom FindBoost.cmake
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   filesystem
--   program_options
--   signals
--   serialization
--   chrono
--   unit_test_framework
--   context
--   locale
-- Using custom FindBoost.cmake
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   coroutine
-- Configuring project fc located in: /home/arhag/bitshares/bitsharesx/libraries/fc
-- Configuring fc to build on Unix/Apple
-- Using custom FindBoost.cmake
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   filesystem
--   program_options
--   signals
--   serialization
--   chrono
--   unit_test_framework
--   context
--   locale
--   iostreams
--   coroutine
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.a;/usr/lib/x86_64-linux-gnu/libcrypto.a (found version "1.0.1f")
** for a debug build: cmake -DCMAKE_BUILD_TYPE=Debug ..
-- Finished fc module configuration...
-- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)
-- Found Readline: /usr/include 
-- Using  as BerkeleyDB root
-- Looking for: db_cxx-6.0
-- debug/usr/lib/x86_64-linux-gnu/libdb_cxx.sooptimized/usr/lib/x86_64-linux-gnu/libdb_cxx.so
-- Found BerkeleyDB: /usr/include 
-- Enabling Bitcoin Core Wallet Imports
CMake Error at /home/arhag/bitshares/Qt/5.3/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:15 (message):
  The imported target "Qt5::Gui" references the file

     "Qt5Gui_EGL_LIBRARY-NOTFOUND"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/arhag/bitshares/Qt/5.3/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/arhag/bitshares/Qt/5.3/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:31 (_qt5_Gui_check_file_exists)
  /home/arhag/bitshares/Qt/5.3/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:58 (_qt5gui_find_extra_libs)
  /home/arhag/bitshares/Qt/5.3/gcc_64/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:143 (include)
  programs/qt_wallet/CMakeLists.txt:16 (find_package)


-- Configuring incomplete, errors occurred!

A little bit of searching later and I figured out I needed another dependency:
Code: [Select]
sudo apt-get install libgl1-mesa-dev libegl1-mesa-dev
And, now CMake successfully finishes. It seems Qt's CMake would fail because it couldn't find libGl.so and libEGL.so on my system. They were located at /usr/lib/x86_64-linux-gnu/mesa/libGL.so and /usr/lib/x86_64-linux-gnu/mesa-egl/libEGL.so, but for some reason CMake refuses to
search for them there. Adding the above packages created symlinks to the libraries at the proper locations /usr/lib/x86_64-linux-gnu/libGl.so and /usr/lib/x86_64-linux-gnu/libEGL.so. Perhaps the symlinks alone would have been enough, but installing the packages is simpler. So, it seems these two packages should be included in the list of prerequisite packages to initially install.

I then make the web wallet first, and then the rest of the system.
Code: [Select]
cd ~/bitshares/bitsharesx-build
make buildweb
make
The compilation seems to work fine with the exception of some annoying compiler warnings which seem to me to be mostly benign.

Finally, I run the Qt client and everything appears to be working.
Code: [Select]
cd ~/bitsharesx-build/programs/qt_wallet
./BitSharesX

At this point, everything is working fine, and there is no need for the user to go further. However, I wanted to explore the other options available, such as using the web wallet through the browser directly and not needing Qt, and that is where I got errors.

I first modified "~/BitShares X/config.json" according to bitsharesx/programs/web_wallet/README.md to contain:
Code: [Select]
{
  "rpc": {
    "rpc_user": "test",
    "rpc_password": "test",
    "rpc_endpoint": "127.0.0.1:0",
    "httpd_endpoint": "127.0.0.1:0",
    "htdocs": "/home/arhag/bitshares/bitsharesx/programs/web_wallet/generated"
  },
...

Then, I run the bitshares_client with the following options:
Code: [Select]
cd ~/bitshares/bitsharesx-build/programs/client
./bitshares_client --data-dir ~/BitShares\ X/ --server --httpport 9989
The client seems to be working fine. I can use all the commands. Only problems seem to be a regularly repeating message that says a peer disconnected me because of an invalid block:
Code: [Select]
Peer <IP address>:<port> disconnected us: You offered us a block that we reject as invalid
I am not sure if this is normal behavior or not. Also when stopping the client, it crashes with a segmentation fault.

Now, with the bitshares_client running, I also run the web wallet:
Code: [Select]
cd ~/bitshares/bitsharesx/programs/web_wallet
lineman run

I am able to use my web browser to connect to http://localhost:8000/ and see the GUI interface, however nothing actually works because it gives me an RPC error at the lower left corner with an error about prefixMatchingApiProxy not being defined. The lineman process prints the following error in the terminal:
Code: [Select]
ReferenceError: prefixMatchingApiProxy is not defined
  at /home/arhag/bitshares/bitsharesx/programs/web_wallet/config/server.js:21:57
  at callbacks (/home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/lib/router/index.js:164:37)
  at multipart (/home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/node_modules/connect/lib/middleware/multipart.js:81:27)
  at /home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:57:9
  at urlencoded (/home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/node_modules/connect/lib/middleware/urlencoded.js:46:27)
  at /home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/node_modules/connect/lib/middleware/bodyParser.js:55:7
  at IncomingMessage.<anonymous> (/home/arhag/bitshares/bitsharesx/programs/web_wallet/node_modules/lineman/node_modules/express/node_modules/connect/lib/middleware/json.js:72:9)
  at IncomingMessage.emit (events.js:92:17)
  at _stream_readable.js:929:16
  at process._tickCallback (node.js:419:13)

I don't know why lineman is giving me this problem. If I comment out the offending console.log function in web_wallet/config/server.js, I don't get that particular error anymore but the web wallet still doesn't work because the HTTP POST requests to /rpc don't get any response back. Have I not set things up correctly? In particular, I am wondering how the web wallet (the lineman process) knows what RPC username and password to use when making the requests.