top bar

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

(update instructions to make sure it compiles correctly and simplify java installation)
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)
 
<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 ==
  
=== Install ImageJ ===
+
=== Install JDK ===
  
[http://rsb.info.nih.gov/ij/download.html Download the Linux version of ImageJ] from the NIH website. From a terminal, unzip to <code>/usr/local/</code> and test that it runs:
+
If you are building the Micro-Manager Java GUI, Java 1.6 or 1.7 is recommended[http://imagej.1557.x6.nabble.com/Java-error-when-compiling-a-plugin-tp5004378p5004386.html]. The simplest way is to use [https://launchpad.net/~webupd8team/+archive/java webupd8team PPA]:
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
cd ~/Downloads/
+
sudo add-apt-repository ppa:webupd8team/java
sudo unzip ij*-linux*.zip -d /usr/local/
+
sudo apt-get install oracle-java7-installer
sudo chmod +r /usr/local/ImageJ
+
cd /usr/local/ImageJ/
+
./jre/bin/java -jar ij.jar
+
 
</pre>}}
 
</pre>}}
  
=== Install JDK ===
+
Alternatively, you can download and run <code>jdk-7*-linux-*.bin</code> per the [https://help.ubuntu.com/community/Java#JDK_or_JRE JDK Ubuntu instructions].  [http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Download the latest jdk-7*-linux-*.bin] from the archives (you must click "Accept License Agreement").
  
If you are building the Micro-Manager Java GUI, Java 1.6 is recommended[http://imagej.1557.x6.nabble.com/Java-error-when-compiling-a-plugin-tp5004378p5004386.html].  Download and run <code>jdk-6*-linux-*.bin</code> per the [https://help.ubuntu.com/community/Java#JDK_or_JRE JDK Ubuntu instructions].  This file has to be fetched from Oracle's website since their licensing prohibits redistribution in Linux repositories.  [http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR 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]]
+
{{Note|It may be worth trying to use [[#OpenJDK instead of Sun JDK]]}}
  
In spite of using Sun JDK, Micro-Manager fails to compile:
+
=== Install ImageJ ===
  
<code>
+
Ensure you don't have the Ubuntu package installed:
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
+
{{MessageBox|1=Commandline|2=<pre>
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
+
sudo apt-get purge imagej
compilation terminated.
+
</pre>}}
make[1]: *** [MMCoreJ_wrap.lo] Error 1
+
 
make[1]: Leaving directory `/home/andor/mm/micro-manager1.4/MMCoreJ_wrap'
+
[http://rsb.info.nih.gov/ij/download.html Download the Linux version of ImageJ] from the NIH website. From a terminal, unzip to <code>/usr/local/</code> and test that it runs:
make: *** [all-recursive] Error 1
+
 
</code>
+
{{MessageBox|1=Commandline|2=<pre>
 +
 
 +
cd ~/Downloads/
 +
sudo unzip ij*-linux*.zip -d /usr/local/
 +
sudo rm -rf /usr/local/ImageJ/jre # we don't need the Java runtime
 +
sudo chmod a+Xr /usr/local/ImageJ
 +
</pre>}}
  
 
=== Install Build Programs and Libraries ===
 
=== Install Build Programs and Libraries ===
Line 68: Line 68:
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
cd ~/mm/3rdpartypublic/classext
+
sudo cp 3rdpartypublic/classext/bsh-2.0b4.jar 3rdpartypublic/classext/swingx-0.9.5.jar /usr/local/ImageJ/plugins/
sudo cp bsh-2.0b4.jar swingx-0.9.5.jar /usr/local/ImageJ/plugins/
+
</pre>}}
+
 
+
Create a new micro-manager directory in /usr/lib/
+
 
+
{{MessageBox|1=Commandline|2=<pre>
+
 
+
sudo mkdir /usr/lib/micro-manager
+
 
</pre>}}
 
</pre>}}
  
Line 89: Line 81:
 
cd ~/mm/micro-manager1.4
 
cd ~/mm/micro-manager1.4
 
./mmUnixBuild.sh
 
./mmUnixBuild.sh
./configure --with-imagej=/usr/local/ImageJ
+
./configure --with-imagej=/usr/local/ImageJ --with-javaincl=/usr/lib/jvm/java-7-oracle/include/
 
</pre>}}
 
</pre>}}
  
Line 117: Line 109:
 
#!/bin/bash
 
#!/bin/bash
 
cd /usr/local/ImageJ
 
cd /usr/local/ImageJ
export LD_LIBRARY_PATH=.:/usr/local/lib:/usr/lib/micro-manager:/usr/local/ImageJ
+
export LD_LIBRARY_PATH=/usr/local/lib/micro-manager:/usr/local/ImageJ
 
java -mx1200m \
 
java -mx1200m \
     -Djava.library.path=/usr/lib/micro-manager:/usr/local/ImageJ \
+
     -Djava.library.path=/usr/local/lib/micro-manager:/usr/local/ImageJ \
 
     -Dplugins.dir=/usr/local/ImageJ \
 
     -Dplugins.dir=/usr/local/ImageJ \
     -cp /usr/local/ImageJ/ij.jar:usr/local/jdk1.5.0_04/lib/tools.jar \
+
     -cp /usr/local/ImageJ/ij.jar:/usr/lib/jvm/java-7-oracle/lib/tools.jar \
 
       ij.ImageJ
 
       ij.ImageJ
 
</pre>}}
 
</pre>}}

Revision as of 03:46, 19 November 2013

Preparation

Install JDK

If you are building the Micro-Manager Java GUI, Java 1.6 or 1.7 is recommended[1]. The simplest way is to use webupd8team PPA:

Commandline

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get install oracle-java7-installer

Alternatively, you can download and run jdk-7*-linux-*.bin per the JDK Ubuntu instructions. Download the latest jdk-7*-linux-*.bin from the archives (you must click "Accept License Agreement").

Note
It may be worth trying to use #OpenJDK instead of Sun JDK

Install ImageJ

Ensure you don't have the Ubuntu package installed:

Commandline

sudo apt-get purge 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 rm -rf /usr/local/ImageJ/jre # we don't need the Java runtime
sudo chmod a+Xr /usr/local/ImageJ

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

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

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 --with-javaincl=/usr/lib/jvm/java-7-oracle/include/

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/micro-manager:/usr/local/ImageJ
java -mx1200m \
     -Djava.library.path=/usr/local/lib/micro-manager:/usr/local/ImageJ \
     -Dplugins.dir=/usr/local/ImageJ \
     -cp /usr/local/ImageJ/ij.jar:/usr/lib/jvm/java-7-oracle/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