Installing_EMC2 - rmu75/linuxcnc-wiki GitHub Wiki
NOTE TO THE READER - With the release of LinuxCNC V2.5 this page has been superseded by Installing_LinuxCNC. The contents have been preserved to provide information of historical interest regarding the installation of prior versions known as EMC2. !!!PLEASE do not edit this page to reflect LinuxCNC Install procedures!!!
corsage plus size dresses cocktail dresses flower girl dresses mother of the bride dresses quotes about life
If you do not already have a Linux system, then you can install Ubuntu Linux and EMC2 at the same time. Just download the [EMC2 Live CD]. If you use this method, you don't need to read the rest of this page; just start Using EMC2. You can also use the CD to Install to CompactFlash.
If you have already installed Ubuntu 10.04 "Lucid Lynx", you can install emc2 without reinstalling your whole system. Simply download and run the installation scripts:
**<http://linuxcnc.org/lucid/emc2-install.sh>**
Then follow the instructions on [Installing EMC2]. If you use this method, you don't need to read the rest of this page; just start Using EMC2.
If you have already installed Ubuntu 8.04 "Hardy Heron", you can install emc2 without reinstalling your whole system. Simply download and run the installation script:
**<http://linuxcnc.org/hardy/emc2-install.sh>**
Then follow the instructions on [Installing EMC2]. If you use this method, you don't need to read the rest of this page; just start Using EMC2.
If all you want to do is run EMC2, you can stop reading this page now! The instructions above give you a standard, released version of EMC2, which is what most users have. It is the version with the best support from manuals, the mailing list, and the IRC channel.
If you want to compile additional components for EMC2, you can stop reading this page now! You do not have to recompile emc2 just to add components. For instructions on adding components, read [How to compile and install a component].
The instructions above give you a standard, released version of EMC2, which is what most users have. It is the version with the best support from manuals, the mailing list, and the IRC channel.
Precompiled packages of the most recent software in our [EMC2 git] repo are automatically built, and are available to be installed. The set of available packages and instructions on how to use them are available here on the [EMC2 buildbot].
Note: The following sections use the program "apt-get" to install software and "git" to download source code to your computer. Once you have installed a software package or used git clone, you do not need to repeat that step to build a new version of EMC2. You will be notified of available updates for any installed software. See the section "Getting the latest updates with git" to see how to get the latest emc2 source code.
You can skip this section if you have already installed EMC2 and the realtime kernel, or if you installed from a LiveCD downloaded from the linuxcnc.org website. If you wish to build emc2 from source, follow the steps given below. Indented text that looks like the text on this line is text that you type into the terminal or editor window.
First enable the universe repository (for lyx-qt, libpth-dev, and possibly other packages) [as explained here] if it is not already enabled.
You need to add the linuxcnc repository to your /etc/apt/sources.list. You may follow the last part of the [basic instructions] to do this or simply do (the following will also install emc2):
# For Ubuntu Lucid (10.04)
wget <http://www.linuxcnc.org/lucid/emc2-install.sh>
chmod 755 emc2-install.sh
./emc2-install.sh
# For Ubuntu Hardy Heron (8.04)
wget <http://www.linuxcnc.org/hardy/emc2-install.sh>
chmod 755 emc2-install.sh
./emc2-install.sh
Ubuntu will ask you for your root password in order for the emc2-install.sh script to modify /etc/apt/sources.list and install the new required packages. At this point, you must reboot and select the rtai kernel from the grub bootloader menu. Then, continue with the next step.
Use apt-get to install additional packages required to rebuild emc2 from source: sudo apt-get build-dep emc2 sudo apt-get install build-essential autoconf If you get an error like this one: Package libpth-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package libpth-dev has no installation candidate then you have not configured apt correctly and the compilation step will fail.
EMC2 source is stored in a system called Git. If you plan to make changes to emc2, it's highly recommended to use this method. With git, you can maintain your changes over time while getting bugfixes and new features. Git also makes it easy to submit your improvements to the linuxcnc.org team for inclusion in future versions of the software.
First, follow the steps above to get the extra packages needed to compile emc.
Before you can get a copy of EMC2 from our git server you will need to install the git program: sudo apt-get install git-core gitk git-gui
Once you have installed git, you will use one of the following forms of the git clone command: git clone git://git.linuxcnc.org/git/emc2.git emc2-dev This puts the project in the directory 'emc2-dev'. To put the local copy of the project in a different location, just change the last argument of the 'git clone' command. Git will download about 45MB of data and it takes about 7 minutes to complete. You should only have to do this once.
The commands below generally assume you are inside the emc2-dev directory.
By default, you will get files from "master", which is the name for the branch where new feature development takes place. If you want to track another branch, git branch --track v2.4_branch origin/v2.4_branch git checkout v2.4_branch (For branches before v2.4_branch, use the form v2_3_branch instead)
To get a particular version of emc, use git checkout vX.Y.Z For instance, to get released version 2.4.0, use git checkout v2.4.0
Note that if you use a tag for a specific release, you will never get any updates since the tag specifies a particular snapshot of the files. Using a branch tag, such as "v2.4_branch", will continue to get changes as long as that branch is being developed.
Git has more instructions, such as how to update your version of emc2 after other developers have made improvements.
Assuming that you already have a checkout from git, git pull If you have made changes locally, then before doing this step you must "git commit" or "git stash" them. For more information, see Git.
If you do not have a recent EMC install from CD or net on your machine, you might miss some build dependencies (packages needed for a compile, or documentation build).
These make the next step (build) fail during the './configure ..' run.
If this happens, proceed as follows:
$ cd debian
$ ./configure -a (if installing simulator use "./configure sim" instead)
$ cd ..
$ dpkg-checkbuilddeps
Then "apt-get install" each of the missing build dependencies, and your configure should work (the configure script in src this time, not in the debian directory). If installing simulator - don't apt-get install the rtai-modules-x.x.... package.
If you have already installed EMC from the Live CD do not use --prefix/make install. Use the 'run in place' method (the default) instead.
Run these commands in the directory created by git above (usually emc2-dev):
$ cd src
$ ./autogen.sh
$ ./configure
$ make
$ make install-menus
$ sudo make setuid
the make command may take several minutes to complete.
Offline machines can get autogen & build-essential packages using Synaptic and a thumb drive.
begin ------------------offline machine gets autogen and build-essential pks ------------------- The offline machine wont have autogen nor build-essentials to begin with, so what to do? Use a thumb drive (or similar) and Syanaptic to create 'wget' scripts. Just grabbing files from internet does not work well, you need to accommodate the dependencies for the files you grab. Synaptic can review your system state and build a list of files based on what that state is. The state of your package information can go stale, and you cannot update that information while offline, but the following sequence helped me get the files needed to build emc for an offline system. I used a thumb drive and took advantage of a feature in Synaptic 'File|Generate package download list'. This command creates a shell script file that uses wget for the <b> already selected files</b>. ( the 'already selected files' might be autogen and build-essential for example ). Once this script is generated, it can be placed onto the removable media, taken to a machine that <b>is</b> online, and the packages retrieved to the removable media. Then, the media can be moved back to the offline system, and when running Synaptic again, choose 'Files | Add downloaded packages'. For most folks the default action of installing all files will be whats wanted. (this may not be what you want to do, and you can cancel if thats true, the files will be placed in the system pkg cache for later use ). During the on-line downloads, the wget program may error with a message saying a file is not found. In my case it happened because a file version was no longer available due to a stale package information database. For example, simply changing python-gnome2-extras_2.19.1-0ubuntu7.1_i386.deb to python-gnome2-extras_2.19.1-0ubuntu7.2_i386.deb in the script fixed this for me. So a few stabs at the wget script should get all the files you need for the offline machine. hth tom3p end ------------------offline machine gets autogen and build-essential pks -------------------
Run these commands in the directory created by git above:
$ cd src
$ ./autogen.sh
$ ./configure --enable-simulator
$ make
$ make install-menus
the make command may take several minutes to complete.
Alternately, you can install a pre-compiled simulation-only version: download and execute http://linuxcnc.org/lucid/emc2-install-sim.sh (lucid lynx) or http://linuxcnc.org/hardy/emc2-install-sim.sh (hardy heron)
Add "--enable-build-documentation" to the ./configure line, then "make". To build only HTML documentation, specify "--enable-build-documentation=html". To build only PDF documentation, specify "--enable-build-documentation=pdf".
Starting in 2.5 you might need to install additional packages to build documentation, these are not installed by "apt-get build-dep emc2":
$ sudo apt-get install asciidoc source-highlight dblatex dvipng
In the top directory that you placed the source, run $ . ./scripts/emc-environment $ emc and choose a configuration file from the list, or specify one on the command line: $ scripts/emc configs/sim/axis.ini If you get an error like Realtime system did not load then stop the rtai with $ halcmd unloadrt all $ halcmd stop then start again. Sometimes the first load will clear up an issue...
If you compile for realtime in a directory tree (git checkout), and then later reconfigure for --enable-simulator, you must do $ make clean to get rid of the realtime object files. The same applies when switching from simulation to realtime. This is because "make" doesn't know that you've changed modes. It only sees that the object files are newer than the source, and thinks they don't need to be recompiled.
Another potential problem when switching from realtime to simulation is environment variables. The command $ . scripts/emc-environment sets some environment variables in your shell to point to various parts of the run-in-place code. Some of those variables are different for realtime vs. simulation. If you switch modes, you should close the shell you were using, open a new one, and run $ . scripts/emc-environment before starting EMC from that shell.
The same issues can arise if you have multiple git checkouts and switch between them using the same shell. If you are switching between versions or checkouts, it is best to use one shell for each one.
Instructions for building a custom kernel and rtai configuration and then compiling EMC for that kernel is on its own page: EMC_With_Custom_Kernel
Just some extra packages to install prior to compiling from scratch.
$ sudo apt-get install libpth-dev tcl8.5-dev tk8.5-dev bwidget libxaw7-dev libreadline5-dev python-dev libglu1-mesa-dev libxinerama-dev autoconf python-tk libglib2.0-dev libxft-dev gettext
Step by step instructions, from bare metal to working system; compiling a custom Ubuntu 9.10 kernel with SMP, with rtai and EMC2: EMC_Ubuntu91
These are needed for running gladevcp applications when not installing from a precompiled package:
$ sudo apt-get install python-gnome2 python-glade2 python-numpy python-imaging python-xlib python-gtkglext1 python-configobj python-gtksourceview2
You can check the build dependencies of the source tree against your running debian system.
If configured to build for the running kernel: $ debian/configure -r $ dpkg-checkbuilddeps
If configured to build without a realtime kernel (simulator mode): $ debian/configure sim $ dpkg-checkbuilddeps
The dpkg-checkbuilddeps command should produce no output.
Run debian/configure without any options for usage help.
Instructions for compiling RTAI in Debian Lenny are on their own page: Debian_Lenny_Compile_RTAI
Instructions for compiling EMC2 in Debian Lenny are on their own page: Debian Lenny Compile LinuxCNC
Instructions for compiling RTAI in Debian Etch are on their own page: Debian_Etch_Compile_RTAI
Instructions for compiling EMC2 in Debian Etch are on their own page: Debian Etch Compile LinuxCNC
Instructions to prepare a system with a Debian Etch Server and many diskless EMC2 thin clients are on their own page: Debian Etch Server And Diskless LinuxCNC Thin Clients
Instructions to install EMC2 and RTAI using portage are on their own page: EmcOnGentoo
Released versions of emc2.3 and newer are [available from http://linuxcnc.org/hardy/dists/hardy/emc2.3/source/ the package server].
Released versions of emc2.2.x and older are available from the [SourceForge download area].
If you are using Ubuntu, you can get the source with 'apt-get source emc2'. More on building the debian packages from source is at BuildingUbuntuPackages.
Use Git to follow development of emc2.
Follow the instructions at RtaiSteps to build a real-time kernel for your particular Linux distribution. After that, you'll have to figure out the names of the extra packages needed to install and run emc2. As an aid, these are the packages required by the emc2 ubuntu package:
Depends: libatk1.0-0 (>= 1.9.0), libc6 (>= 2.3.4-1), libcairo2 (>= 1.0.2-2), libfontconfig1 (>= 2.3.0), libgcc1 (>= 1:4.0.2), libgl1-mesa | libgl1, libglib2.0-0 (>= 2.10.0), libglu1-mesa | libglu1, libgtk2.0-0 (>= 2.8.0), libice6, libpango1.0-0 (>= 1.12.3), libreadline5 (>= 5.1), libsm6, libstdc++6 (>= 4.0.2-4), libx11-6, libxaw7, libxcursor1 (>> 1.1.2), libxext6, libxfixes3, libxi6, libxinerama1, libxmu6, libxrandr2, libxrender1, libxt6, tcl8.4 (>= 8.4.5), tk8.4 (>= 8.4.5), linux-image-2.6.15-magma, rtai-modules-2.6.15-magma, tcl8.4, tk8.4, libreadline5, python2.4-numarray, python2.4-imaging, python2.4-imaging-tk, python (>= 2.4), python (<< 2.5), emc2, python (<< 2.5), python (>= 2.4), bwidget (>= 1.7), bwidget (<< 1.8), python2.4-tk, python2.4-xml
Build-Depends: debhelper (>> 4.0.0), linux-image-2.6.15-magma, rtai-modules-2.6.15-magma, linux-headers-2.6.15-magma, gcc-4.0, g++, make, libc6-dev, tcl8.4-dev, tk8.4-dev, libgtk2.0-dev, pciutils-dev, libncurses-dev, gettext, libxaw7-dev, libreadline5-dev, lyx-qt, python, tetex-bin, latex2html, python2.4-dev, libglu1-mesa-dev, libgl1-mesa-dev, libgnomeprint2.2-dev, groff, bwidget, tetex-extra
Since emc2.3, emc2 now works on at least some x86-64 CPUs in 64-bit mode. These instructions were followed on an Ubuntu "Dapper" system. AMD X2 3800+ CPU, 2GB RAM, nvidia nforce-mcp51 chipset, X server using "vesa" driver.
- Download rtai "magma" CVS and linux kernel source 2.6.20.12
- Patch kernel with hal-linux-2.6.20-x86_64-1.0-08.patch
- Configure and install kernel (I used [these options]--but take care because the driver selections are specific to my hardware)
- Configure and install rtai (I used ./configure --enable-shm --enable-sched-up --enable-sched-lxrt --enable-fpu --enable-compat --disable-leds)
- Get the source code for emc, configure, and make (I used ./configure --enable-run-in-place)
The closed source nvidia drivers are known to be incompatible with realtime kernels. This has been reported to nvidia but they seem uninterested in fixing it, and because their drivers are not open source, nobody else can fix it either.
To get your nvidia graphics card working, edit the xorg.conf file in the /etc/X11 directory. At about line 66, in the section "Device", find a line that looks like: Driver "nvidia" , replace nvidia with "nv" or "vesa" (try "nv" first). If you have previously tried to use the nvidia driver, you must remove nvidia-related packages by issuing the following command from a terminal: sudo apt-get --purge remove nvidia-glx nvidia-settings nvidia-kernel-common
There is at least one report that even when using the open source 'nv' driver, the latency test will show failures.
If you wish to remove a package, a simple sudo apt-get remove emc2
will suffice. However, if you've installed emc2 from source with make install
then there will be files left around everywhere. You can not then install emc2 from a package, as the files will conflict. This is an attempt to document all of them. The following script assumes that you still have the compiled emc2 source tree. This is why we recommend to always use --enable-run-in-place when you build your own emc2.
export SRCPATH=<path to your emc build>
#remove the python modules
cd /usr/lib/python2.4/site-packages/
ls $SRCPATH/lib/python | xargs sudo rm -r
sudo rm -r /usr/local/etc/emc2/ /usr/realtime*/modules/emc2/ /usr/local/share/emc/ /usr/local/share/axis/
sudo rm /etc/init.d/realtime
cd /usr/local/bin/
ls $SRCPATH/bin/ | xargs sudo rm
sudo rm emc emcmkdesktop halrun
cd /usr/local/lib
ls $SRCPATH/lib/ | xargs sudo rm
You may need to apt-get remove --purge emc2 if you installed it "over" the existing install, otherwise you will get the wrong /etc/init.d/realtime script (or no script!)
One way to avoid this predicament is instead of "make install", to use the "checkinstall" program, which monitors the install process and creates a package for you that can easily be uninstalled.