top bar

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

(update instructions to make sure it compiles correctly and simplify java installation)
m (Debian notice)
 
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Preparation ==
+
Intallation notes to install micro-manager from source on Ubuntu systems. These instructions can also be used without modifications for installations on [http://debian.org Debian systems] (tested on Debian Wheezy and Debian Jessy).
  
=== Install JDK ===
+
{{Note|This page has been updated for the build system changes of r13120, based on testing on Ubuntu 12.04 LTS.}}
  
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]:
+
See also: <code>doc/how-to-build.md</code> in the source tree.
  
{{MessageBox|1=Commandline|2=<pre>
+
= Preparation =
  
sudo add-apt-repository ppa:webupd8team/java
+
== Install JDK ==
sudo apt-get install oracle-java7-installer
+
</pre>}}
+
  
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 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 OpenJDK:
  
{{Note|It may be worth trying to use [[#OpenJDK instead of Sun JDK]]}}
+
{{MessageBox|1=Commandline|2=<pre>
  
=== Install ImageJ ===
+
sudo apt-get install openjdk-6-jdk
 +
</pre>}}
  
Ensure you don't have the Ubuntu package installed:
+
(You can also use <code>openjdk-7-jdk</code>.)
  
{{MessageBox|1=Commandline|2=<pre>
+
== Install ImageJ ==
 
+
sudo apt-get purge imagej
+
</pre>}}
+
  
[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:
+
[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 remove the embedded JRE, as we already have one installed.
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
Line 30: Line 26:
 
cd ~/Downloads/
 
cd ~/Downloads/
 
sudo unzip ij*-linux*.zip -d /usr/local/
 
sudo unzip ij*-linux*.zip -d /usr/local/
sudo rm -rf /usr/local/ImageJ/jre # we don't need the Java runtime
+
sudo rm -rf /usr/local/ImageJ/jre
 
sudo chmod a+Xr /usr/local/ImageJ
 
sudo chmod a+Xr /usr/local/ImageJ
 
</pre>}}
 
</pre>}}
  
=== Install Build Programs and Libraries ===
+
== Install Build Programs and Libraries ==
  
 
You will need a subversion client to checkout the source code, several libraries, and build tools.  Install them with:
 
You will need a subversion client to checkout the source code, several libraries, and build tools.  Install them with:
Line 40: Line 36:
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
sudo apt-get install subversion build-essential automake libtool \
+
sudo apt-get install subversion build-essential autoconf automake libtool \
                     libboost-all-dev zlib1g-dev swig
+
                     libboost-all-dev zlib1g-dev swig ant
 
</pre>}}
 
</pre>}}
  
 
You may also need to install additional packages (for cameras and special hardware).  See the full list in [[#Dependencies]]
 
You may also need to install additional packages (for cameras and special hardware).  See the full list in [[#Dependencies]]
  
=== Fetch Source Repositories ===
+
== Fetch Source Repositories ==
  
 
Create a directory for the the subversion repositories, such as <code>~/mm</code>.  Besides the source tree, additional binary dependencies are stored in the <code>3rdpartypublic</code> repository.  The build scripts in the source tree assume <code>3rdpartypublic</code> is in the same parent folder level:
 
Create a directory for the the subversion repositories, such as <code>~/mm</code>.  Besides the source tree, additional binary dependencies are stored in the <code>3rdpartypublic</code> repository.  The build scripts in the source tree assume <code>3rdpartypublic</code> is in the same parent folder level:
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
 
 
mkdir ~/mm
 
mkdir ~/mm
 
cd ~/mm
 
cd ~/mm
svn co https://valelab.ucsf.edu/svn/micromanager2/trunk/ micro-manager1.4
+
svn co https://valelab4.ucsf.edu/svn/micromanager2/trunk/ micro-manager1.4
svn co https://valelab.ucsf.edu/svn/3rdpartypublic/
+
svn co https://valelab4.ucsf.edu/svn/3rdpartypublic/
 
</pre>}}
 
</pre>}}
  
Line 64: Line 59:
 
</pre>
 
</pre>
  
Add the Beanshell and SwingX to the ImageJ plugins directory:
+
Subversion (svn) will likely complain saying that it cannot verify the https certificate. Typing **t** to temporarily trust the certificate allows to retrieve the repository.
  
{{MessageBox|1=Commandline|2=<pre>
+
Also, when retrieving large repository (like the 3rdpartypublic/ repository), svn can hung in the middle of the process, with an error message:
  
sudo cp 3rdpartypublic/classext/bsh-2.0b4.jar 3rdpartypublic/classext/swingx-0.9.5.jar /usr/local/ImageJ/plugins/
+
<pre>
</pre>}}
+
svn: REPORT de '/svn/3rdpartypublic/!svn/vcc/default':
 +
Could not read chunk delimiter: Secure connection truncated (https://valelab4.ucsf.edu)
 +
</pre>
  
== Building Micro-Manager ==
+
This can be [http://stackoverflow.com/questions/4031845/svn-resuming-aborted-checkout#13789596 solved] by typing:
 +
 
 +
{{MessageBox|1=Commandline|2=
 +
<pre>
 +
svn cleanup 3rdpartypublic/
 +
svn update 3rdpartypublic/ # This command might be executed several times
 +
</pre>}}
  
=== Create the Autotools files ===
+
= Building Micro-Manager =
  
<code>configure</code> uses the bundled version of ImageJ:
+
== Create the Autotools files ==
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
 
cd ~/mm/micro-manager1.4
 
cd ~/mm/micro-manager1.4
./mmUnixBuild.sh
+
./autogen.sh
./configure --with-imagej=/usr/local/ImageJ --with-javaincl=/usr/lib/jvm/java-7-oracle/include/
+
./configure --enable-imagej-plugin=/usr/local/ImageJ
 
</pre>}}
 
</pre>}}
  
=== Compile ===
+
== Download build dependencies ==
 +
 
 +
{{MessageBox|1=Commandline|2=<pre>
 +
 
 +
make fetchdeps  # Required since SVN r14001-r14016
 +
</pre>}}
 +
 
 +
== Compile ==
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
Line 91: Line 101:
 
</pre>}}
 
</pre>}}
  
=== Install ===
+
== Install ==
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
 
sudo make install
 
sudo make install
sudo ldconfig
 
 
</pre>}}
 
</pre>}}
  
== Post Install ==
+
= Post Install =
  
=== Create the startup script ===
+
== Editing the startup script ==
  
Micro-Manager requires the path to <code>/usr/lib/micro-manager</code>. Create the 4 line Bash script below in <code>/usr/local/ImageJ</code> and save it as, say, <code>mmscript</code>.
+
A script named <code>mmimagej</code> will have been installed in <code>/usr/local/ImageJ</code>. You might want to edit its contents to pass extra flags to Java. You may also want to put this script in your <code>PATH</code>.
  
{{MessageBox|1=File: mmscript|2=<pre>
+
= Running Micro-Manager =
  
#!/bin/bash
+
Start Micro-Manager by typing:
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
+
</pre>}}
+
 
+
Make the script executable:
+
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
sudo chmod +x mmscript
+
/usr/local/ImageJ/mmimagej 2>&1 >/dev/null &
 
</pre>}}
 
</pre>}}
  
== Running Micro-Manager ==
+
To view the Core logging in the terminal while Micro-Manager is running, start simply as:
 
+
Start ImageJ with your new script:
+
  
 
{{MessageBox|1=Commandline|2=<pre>
 
{{MessageBox|1=Commandline|2=<pre>
  
./mmscript &
+
/usr/local/ImageJ/mmimagej
 
</pre>}}
 
</pre>}}
  
Run <code>Plugins > Micro-Manager > Micro-Manager Studio</code>
+
= Appendix =
  
== Appendix ==
+
== Dependencies ==
 
+
=== Dependencies ===
+
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 149: Line 144:
 
| GNU C++ || <code>build-essential</code>
 
| GNU C++ || <code>build-essential</code>
 
|-
 
|-
| GNU Autotools || <code>automake</code>
+
| GNU Autotools || <code>autoconf</code>, <code>automake</code>
 
|-
 
|-
 
| GNU Libtool || <code>libtool</code>
 
| GNU Libtool || <code>libtool</code>
Line 159: Line 154:
 
| Simplified Wrapper and Interface Library || <code>swig</code>
 
| Simplified Wrapper and Interface Library || <code>swig</code>
 
|-
 
|-
| Sun Java SDK || N/A - manually fetch from Oracle website
+
| OpenJDK || <code>openjdk-6-jdk</code> or <code>openjdk-7-jdk</code>
 
|-
 
|-
 
|colspan="2"  style="background: #ddd; border-top: 1px solid gray; padding: 5px; text-align: center"| Optional Dependencies:
 
|colspan="2"  style="background: #ddd; border-top: 1px solid gray; padding: 5px; text-align: center"| Optional Dependencies:
 +
|-
 +
| Python || <code>python-dev</code>, <code>python-numpy-dev</code>
 
|-
 
|-
 
| Firewire Camera Library || <code>libdc1394-*-dev</code>
 
| Firewire Camera Library || <code>libdc1394-*-dev</code>
 
|-
 
|-
 
| Open Source Computer Vision Library || <code>libopencv-dev</code>
 
| Open Source Computer Vision Library || <code>libopencv-dev</code>
 +
|-
 +
| GPhoto2 || <code>libgphoto2-2-dev</code>
 +
|-
 +
| FreeImagePlus (used by GPhoto device adapter) || <code>libfreeimage-dev</code>
 +
|-
 +
| libusb 0.1 || <code>libusb-dev</code>
 +
|-
 +
| Andor SDK 2/3 || N/A - request from Andor website
 
|}
 
|}
 
=== OpenJDK instead of Sun JDK ===
 
 
It may be possible to also use the distro-friendly OpenJDK (<code>default-jdk</code>) without too much effort. To start, you would have to patch the Micro-Manager <code>configure.in</code> file to find <code>jni.h</code>[https://bugzilla.redhat.com/show_bug.cgi?id=498964#c2] and possibly apply other fixes.
 
  
 
{{Programming_Sidebar}}
 
{{Programming_Sidebar}}

Latest revision as of 16:04, 16 September 2016

Intallation notes to install micro-manager from source on Ubuntu systems. These instructions can also be used without modifications for installations on Debian systems (tested on Debian Wheezy and Debian Jessy).

Note
This page has been updated for the build system changes of r13120, based on testing on Ubuntu 12.04 LTS.

See also: doc/how-to-build.md in the source tree.

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 OpenJDK:

Commandline

sudo apt-get install openjdk-6-jdk

(You can also use openjdk-7-jdk.)

Install ImageJ

Download the Linux version of ImageJ from the NIH website. From a terminal, unzip to /usr/local/, and remove the embedded JRE, as we already have one installed.

Commandline

cd ~/Downloads/
sudo unzip ij*-linux*.zip -d /usr/local/
sudo rm -rf /usr/local/ImageJ/jre
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 autoconf automake libtool \
                     libboost-all-dev zlib1g-dev swig ant

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://valelab4.ucsf.edu/svn/micromanager2/trunk/ micro-manager1.4
svn co https://valelab4.ucsf.edu/svn/3rdpartypublic/

This creates 2 new folders in the mm directory:

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

Subversion (svn) will likely complain saying that it cannot verify the https certificate. Typing **t** to temporarily trust the certificate allows to retrieve the repository.

Also, when retrieving large repository (like the 3rdpartypublic/ repository), svn can hung in the middle of the process, with an error message:

svn: REPORT de '/svn/3rdpartypublic/!svn/vcc/default': 
Could not read chunk delimiter: Secure connection truncated (https://valelab4.ucsf.edu)

This can be solved by typing:

Commandline
svn cleanup 3rdpartypublic/
svn update 3rdpartypublic/ # This command might be executed several times

Building Micro-Manager

Create the Autotools files

Commandline

cd ~/mm/micro-manager1.4
./autogen.sh
./configure --enable-imagej-plugin=/usr/local/ImageJ

Download build dependencies

Commandline

make fetchdeps   # Required since SVN r14001-r14016

Compile

Commandline

make

Install

Commandline

sudo make install

Post Install

Editing the startup script

A script named mmimagej will have been installed in /usr/local/ImageJ. You might want to edit its contents to pass extra flags to Java. You may also want to put this script in your PATH.

Running Micro-Manager

Start Micro-Manager by typing:

Commandline

/usr/local/ImageJ/mmimagej 2>&1 >/dev/null &

To view the Core logging in the terminal while Micro-Manager is running, start simply as:

Commandline

/usr/local/ImageJ/mmimagej

Appendix

Dependencies

You need the following packages:
Name Equivalent Synaptic package name
Required Dependencies:
Subversion subversion
GNU C++ build-essential
GNU Autotools autoconf, automake
GNU Libtool libtool
Boost libraries libboost-all-dev
zlib compression library zlib1g-dev
Simplified Wrapper and Interface Library swig
OpenJDK openjdk-6-jdk or openjdk-7-jdk
Optional Dependencies:
Python python-dev, python-numpy-dev
Firewire Camera Library libdc1394-*-dev
Open Source Computer Vision Library libopencv-dev
GPhoto2 libgphoto2-2-dev
FreeImagePlus (used by GPhoto device adapter) libfreeimage-dev
libusb 0.1 libusb-dev
Andor SDK 2/3 N/A - request from Andor website
© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact