top bar

Difference between revisions of "Linux installation from source (Ubuntu)"

(Note Java compilation failure.)
Line 1: Line 1:
{{Note|These instructions are mostly complete, but the Java part does not compile due to it not finding <code>jni.h</code> [[User:P.nanda|P.nanda]] 17:04, 23 August 2013 (PDT)}}
+
{{Note|These instructions are mostly complete, but the Java part does not compile due to it not finding <code>jni.h</code> [[User:P.nanda|P.nanda]] 17:04, 23 August 2013 (PDT)
 +
<br />To allow the build to find jni.h, the --with-javaincl flag to ./configure can be used. I haven't tested it on Ubuntu. --[[User:Mark Tsuchida|Mark Tsuchida]] ([[User talk:Mark Tsuchida|talk]]) 17:56, 25 September 2013 (PDT)}}
  
 
== Preparation ==
 
== Preparation ==

Revision as of 16:56, 25 September 2013

Note
These instructions are mostly complete, but the Java part does not compile due to it not finding jni.h P.nanda 17:04, 23 August 2013 (PDT)
To allow the build to find jni.h, the --with-javaincl flag to ./configure can be used. I haven't tested it on Ubuntu. --Mark Tsuchida (talk) 17:56, 25 September 2013 (PDT)

Preparation

Install ImageJ

Download the Linux version of ImageJ from the NIH website. From a terminal, unzip to /usr/local/ and test that it runs:

Commandline

cd ~/Downloads/
sudo unzip ij*-linux*.zip -d /usr/local/
sudo chmod +r /usr/local/ImageJ
cd /usr/local/ImageJ/
./jre/bin/java -jar ij.jar

Install JDK

If you are building the Micro-Manager Java GUI, Java 1.6 is recommended[1]. Download and run jdk-6*-linux-*.bin per the JDK Ubuntu instructions. This file has to be fetched from Oracle's website since their licensing prohibits redistribution in Linux repositories. Download the latest jdk-6*-linux-*.bin from the archives (you must click "Accept License Agreement"). It may be worth using #OpenJDK instead of Sun JDK

In spite of using Sun JDK, Micro-Manager fails to compile:

make[1]: Entering directory `/home/andor/mm/micro-manager1.4/MMCoreJ_wrap' /bin/bash ../libtool --tag=CXX --mode=compile g++ -DPACKAGE_NAME=\"Micro-Manager\" -DPACKAGE_TARNAME=\"micro-manager\" -DPACKAGE_VERSION=\"1.4\" -DPACKAGE_STRING=\"Micro-Manager\ 1.4\" -DPACKAGE_BUGREPORT=\"info@micro-manager.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"micro-manager\" -DVERSION=\"1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_BOOST=/\*\*/ -DHAVE_BOOST_DATE_TIME=/\*\*/ -DHAVE__USR_INCLUDE_ZLIB_H=1 -DHAVE_LIBDL=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DSTDC_HEADERS=1 -DHAVE_MEMSET=1 -I. -I/usr/include -g -O -MT MMCoreJ_wrap.lo -MD -MP -MF .deps/MMCoreJ_wrap.Tpo -c -o MMCoreJ_wrap.lo MMCoreJ_wrap.cxx libtool: compile: g++ -DPACKAGE_NAME=\"Micro-Manager\" -DPACKAGE_TARNAME=\"micro-manager\" -DPACKAGE_VERSION=\"1.4\" "-DPACKAGE_STRING=\"Micro-Manager 1.4\"" -DPACKAGE_BUGREPORT=\"info@micro-manager.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"micro-manager\" -DVERSION=\"1.4\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" "-DHAVE_BOOST=/**/" "-DHAVE_BOOST_DATE_TIME=/**/" -DHAVE__USR_INCLUDE_ZLIB_H=1 -DHAVE_LIBDL=1 -DSTDC_HEADERS=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DSTDC_HEADERS=1 -DHAVE_MEMSET=1 -I. -I/usr/include -g -O -MT MMCoreJ_wrap.lo -MD -MP -MF .deps/MMCoreJ_wrap.Tpo -c MMCoreJ_wrap.cxx -fPIC -DPIC -o .libs/MMCoreJ_wrap.o MMCoreJ_wrap.cxx:160:17: fatal error: jni.h: No such file or directory compilation terminated. make[1]: *** [MMCoreJ_wrap.lo] Error 1 make[1]: Leaving directory `/home/andor/mm/micro-manager1.4/MMCoreJ_wrap' make: *** [all-recursive] Error 1

Install Build Programs and Libraries

You will need a subversion client to checkout the source code, several libraries, and build tools. Install them with:

Commandline

sudo apt-get install subversion build-essential automake libtool \
                     libboost-all-dev zlib1g-dev swig

You may also need to install additional packages (for cameras and special hardware). See the full list in #Dependencies

Fetch Source Repositories

Create a directory for the the subversion repositories, such as ~/mm. Besides the source tree, additional binary dependencies are stored in the 3rdpartypublic repository. The build scripts in the source tree assume 3rdpartypublic is in the same parent folder level:

Commandline

mkdir ~/mm
cd ~/mm
svn co https://valelab.ucsf.edu/svn/micromanager2/trunk/ micro-manager1.4
svn co https://valelab.ucsf.edu/svn/3rdpartypublic/

This creates 2 new folders in the mm directory:

    ~/mm/micro-manager1.4
    ~/mm/3rdpartypublic

Add the Beanshell and SwingX to the ImageJ plugins directory:

Commandline

cd ~/mm/3rdpartypublic/classext
sudo cp bsh-2.0b4.jar swingx-0.9.5.jar /usr/local/ImageJ/plugins/

Create a new micro-manager directory in /usr/lib/

Commandline

sudo mkdir /usr/lib/micro-manager

Building Micro-Manager

Create the Autotools files

configure uses the bundled version of ImageJ:

Commandline

cd ~/mm/micro-manager1.4
./mmUnixBuild.sh
./configure --with-imagej=/usr/local/ImageJ

Compile

Commandline

make

Install

Commandline

sudo make install
sudo ldconfig

Post Install

Create the startup script

Micro-Manager requires the path to /usr/lib/micro-manager. Create the 4 line Bash script below in /usr/local/ImageJ and save it as, say, mmscript.

File: mmscript

#!/bin/bash
cd /usr/local/ImageJ
export LD_LIBRARY_PATH=.:/usr/local/lib:/usr/lib/micro-manager:/usr/local/ImageJ
java -mx1200m \
     -Djava.library.path=/usr/lib/micro-manager:/usr/local/ImageJ \
     -Dplugins.dir=/usr/local/ImageJ \
     -cp /usr/local/ImageJ/ij.jar:usr/local/jdk1.5.0_04/lib/tools.jar \
      ij.ImageJ

Make the script executable:

Commandline

sudo chmod +x mmscript

Running Micro-Manager

Start ImageJ with your new script:

Commandline

./mmscript &

Run Plugins > Micro-Manager > Micro-Manager Studio

Appendix

Dependencies

You need the following packages:
Name Equivalent Synaptic package name
Required Dependencies:
Subversion subversion
GNU C++ build-essential
GNU Autotools automake
GNU Libtool libtool
Boost libraries libboost-all-dev
zlib compression library zlib1g-dev
Simplified Wrapper and Interface Library swig
Sun Java SDK N/A - manually fetch from Oracle website
Optional Dependencies:
Firewire Camera Library libdc1394-*-dev
Open Source Computer Vision Library libopencv-dev

OpenJDK instead of Sun JDK

It may be possible to also use the distro-friendly OpenJDK (default-jdk) without too much effort. To start, you would have to patch the Micro-Manager configure.in file to find jni.h[2] and possibly apply other fixes.

© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact