Building JBidwatcher from git.

Subscribe to Building JBidwatcher from git. 4 post(s), 3 voice(s)

 
Avatar Watched2 3 post(s)

Hi all,

There are a few posts asking how to compile JBidwatcher from source. For example:

Requirements for compiling recent Master branch
http://forum.jbidwatcher.com/forums/7/topics/5226

Tips on compiling JBidwatcher?
http://forum.jbidwatcher.com/forums/7/topics/5147

I had not run jbidwatcher for a long long time on my Gentoo Linux distribution due to errors. However, I thought I’ll try to compile from source to see if the errors went away. After many weeks of on/off debugging to get it to work on a Gentoo Linux distribution, I’ve written up a rough guide on how to compile JBidwatcher from git.

This guide is for installing JBidwatcher in the Gentoo linux distribution.

Requirements:

  1. Java SDK 1.8
  2. Ant
  3. JRuby + plus some other packages.

Install ant for building JBid

As root, emerge ant:

# emerge ant-core

Check the installed java environment with ant.

# ant -diagnostics

Java SDK version 1.8

Stable Gentoo does not have the latest Icedtea 3 (Java 1.8) so I had to install the java overlay using layman. The details of which are outside the scope of this guide. However, you’ll need to unmask the latest ebuilds provided by the Java overlay.

Yes, I could have install the official Sun JavaSDK, but I’d prefer to use the free-software version of java.

If you don’t have a java sdk yet, install the bin version first.

# emerge -v icedtea-bin

Remove icedtea-web package due to the version conflict with the newer icedtea you are about to install.
# emerge -C icedtea-web

Install the source version of icedtea-3 ebuild (which builds icedtea-8…) by install the virtual/jdk package.
# emerge -vp jdk

Select the new java-vm for the system.
# eselect java-vm set system 1

As a normal user select the icedtea-8 vm.

$ eselect java-vm set user 1
$ eselect java-vm show
Current system-vm
icedtea-8
Current user-vm
icedtea-8

Build JBidwatcher from source

As root, pull the latest git version of jbidwatcher.

# cd /usr/src/
# git clone https://github.com/cyberfox/jbidwatcher.git
# cd jbidwatcher
# ant clean
# ant

Ignore the error about Launch4j as this is used to create a windows EXE, but this is a linux system and we only need the jar file.
(See “Builds, Launch4J” http://forum.jbidwatcher.com/forums/7/topics/4380)

Copy the freshly built jar file to a suitable location for execution:

# cp JBidwatcher-2.99pre5.jar /opt/JBidwatcher/
# cd /opt/JBidwatcher/
# ln -s JBidwatcher-2.99pre5.jar JBidwatcher.jar

Running JBidwatcher

Jbidwatcher needs JRuby. From trial and error, JBidwatcher needs the a later version of JRuby than the version Gentoo has available. The background to the Gentoo/JRuby issue can be found here:
http://moving-innovations.com/blog/2014/04/23/the-precarious-state-of-jruby-in-gentoo

Hence, I installed the latest 1.7 series JRuby locally. It’s advised that jruby is installed from source and not a version package management system like RVM. Which I did originally and had other issues finding packages. As stated below (https://github.com/jruby/jruby/wiki/GettingStarted):

“On Linux and Mac, you can either install the JRuby binaries or use a Ruby version manager such as RVM. However, it’s best to avoid using a package manager because of issues with keeping the downloaded versions current. If you prefer to build your own JRuby, see Downloading JRuby Source and Building It Yourself.”

As a normal user you can execute the following commands to install JRuby locally:

$ wget https://s3.amazonaws.com/jruby.org/downloads/1.7.23/jruby-bin-1.7.23.tar.gz
$ tar -vxf jruby-bin-1.7.23.tar.gz
$ mv jruby-1.7.23/ ~/opt/
$ cd ~/opt/
ln -s jruby-1.7.23 jruby

In your .bashrc add the following path so the JRuby executable can be found:

export PATH=“${HOME}/opt/jruby/bin/:${PATH}” # Add jruby to PATH

You will also need to install the following jruby packages:

$ jruby -S gem install activesupport
$ jruby -S gem install logger
$ jruby -S gem install activerecord-jdbcderby-adapter

I’m assuming you are doing a clean install of jruby, and cleaning the global variables is a good idea.
$ unset RUBYLIB
$ unset GEM_PATH
$ unset GEM_HOME
$ unset IRBRC

For the source compiled JBidwatcher to work, you will need to set the RUBYLIB path with all the jruby packages it uses. After a lot of trial and error by running JBid and finding each missing package and adding it to the RUBYLIB cycle, I got this:

$ export RUBYLIB=“${HOME}/opt/jruby/lib/ruby/shared/:\
${HOME}/opt/jruby/lib/ruby/2.0/:\
${HOME}/opt/jruby/lib/ruby/1.9/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activesupport-4.2.5/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/thread_safe-0.3.5-java/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/i18n-0.7.0/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/logger-1.2.8/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/tzinfo-1.2.2/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activerecord-jdbcderby-adapter-1.3.19/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.19/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.3.19/lib/arjdbc/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.5/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activerecord-4.2.5/lib/active_record/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/activemodel-4.2.5/lib/:\
${HOME}/opt/jruby/lib/ruby/gems/shared/gems/arel-6.0.3/lib/”

Now a normal user can run JBidwatcher by executing the following command:

$ java -jar -Xms256m -Xmx512m /opt/JBidwatcher/JBidwatcher.jar

Hopefully, the JB application will start up and happy snipping.

I hope this helps and please add any other suggestions, corrections or tips.

Cheers

 
Avatar Morgan Schweers Administrator 1,200 post(s)

Greetings,
Wow! That’s a great write-up, and I appreciate it a lot!

I have to note, as a bit of caution, that I don’t support the IcedTea version of Java. Historically it’s been notoriously buggy, mostly in UI code that the majority of server-side Java devs don’t care about (and thus gets fewer eyes in an open source project). I don’t know what 8 is like, but it’s been a problem for me in the past.

JBidwatcher’s source tree does come with its own version of JRuby, and all those gems are packaged with it in the lib/jbidwatcher directory. Some in gems.jar, others expanded in the file system.

The amount of work that went into you putting that together is amazing, and I can’t thank you enough!

— Morgan

 
Avatar Watched2 3 post(s)

Hi Morgan,

Sorry for the late reply, been flat out with work and then a much needed holiday.

It’s we the users who should be grateful for the years of work you have put into Jbid. Countless people around the world sacrifice time with family, friends, opportunities or any number of things for others to create free-software for the freedom of users. They should be supported and thanked, and it’s not really recognised in society as much as it should.

As you can tell, I’m not a jruby expert and missed the obvious gems.jar in the lib directory. I’ll have a think about how it can be done more elegantly for linux users.

However, in the mean time I hope this helps others start testing or developing the software.

Cheers

 
Avatar Hartmut 3 post(s)

As an addition to the how-to-description of Watched2 I’d like to mention:

To find out the needed paths of “export RUBYLIB=…:…:…”
You can use do e.g.
gem which rubygems
gem which monitor
gem which …
and so forth.

After trying I got JBidWatcher finally running now on Debian 8.3 Linux:

current source codes from: https://github.com/cyberfox/jbidwatcher.git
git clone https://github.com/cyberfox/jbidwatcher.git

java 1.8.0_72
rvm 1.26.11 (latest)
jruby 1.5.6 (ruby 1.8.7 patchlevel 249)

to get it running I enter:

ant clean
ant linux
export RUBYLIB=“$HOME/.rvm/rubies/jruby-1.7.19/lib/ruby/shared:$HOME/.rvm/rubies/jruby-1.7.19/lib/ruby/1.9”
java -jar JBidwatcher-2.99pre5.jar