Installing LibreCAD from source

Where to get source code of LibreCAD:

The source code including the latest development of LibreCAD is available from the project page at github, https://github.com/LibreCAD/LibreCAD.You may simply fork the project from github, or clone the repository to your computer:

$ git clone https://github.com/LibreCAD/LibreCAD.git

If you prefer to download all source code in a single tar/zip-ball, you may use the Download link provided by github:

Download LibreCAD source in a single file

When reporting bugs, please always test with the newest source as shown at https://github.com/LibreCAD/LibreCAD of the corresponding branch. It also help to help report the commit number tested.

How to Compile from source:

Today I did some testing on LibreCAD and Debian to see what’s needed to compile LibreCAD on one of these distributions. As such, I installed Virtualbox on my MacBook and downloaded a fresh version of Debian 5.0.6, 64 bits and Ubuntu 10.10.

Compile Instructions for Ubuntu:
 
I installed Ubuntu 10.10 myself with default settings. Next thing you need to do is fire up a terminal.
 
 

Fired up the terminal because you need to install the qt4 development libraries, tools, compiler and git.

Commands to run:

For the 1.0 series,

$ sudo apt-get install g++ gcc make git-core libqt4-dev qt4-qmake libqt4-qt3support libqt4-help qt4-dev-tools libboost-all-dev libmuparser-dev 

or

$ sudo apt-get build-dep librecad

For the 2.0 series(development version),

$ sudo apt-get install g++ gcc make git-core libqt4-dev qt4-qmake libqt4-help qt4-dev-tools libboost-all-dev libmuparser-dev libfreetype6-dev

Depending on what you already have installed apt will find out the dependencies and install the missing software on your computer.

Alternatively, you make sure you have deb-src lines enabled in your sources.list file, and run,

$ sudo apt-get build-dep librecad

 
 

After you have a development environment on your computer, it’s time to create a source directory (feel free to name it at your preference) and download LibreCAD from github.

  
$ cd ~
$ mkdir source
$ cd source

Checking out LibreCAD from GIT will take anywhere between 5 seconds to 30 seconds or longer, depending on the speed of github and your internet connection.

$ git clone https://github.com/LibreCAD/LibreCAD
 Cloning into LibreCAD... remote: Counting objects: 4517, done.
remote: Compressing objects: 100% (1725/1725), done.
remote: Total 4517 (delta 2994), reused 4253 (delta 2777)
Receiving objects: 100% (4517/4517), 7.58 MiB | 176 KiB/s, done. 
Resolving deltas: 100% (2994/2994), done.

If you have registered your ssh public key with github, you may clone from the git::// URL,

 $ git clone git@github.com:LibreCAD/LibreCAD.git

When this is done, you have the complete LibreCAD source including it's history on your computer!

 
 

Now you can run qmake (or qmake-qt4) to create a makefile and run make to compile LibreCAD

Commands to Run:

  
cd LibreCAD
qmake librecad.pro
make

Note: if you have qt3 and qt4 installed you might need to run qmake-qt4

 
 

Compiling LibreCAD might take a while, depending on the speed of your computer, but just let it run until it finishes. When it finishes, you will see the very last few lines showing something that translations where copied. See screenshot.

To finally run LibreCAD, execute the following command:

  
cd unix
./librecad

To build on Debian

For Debian (6) users the process is exactly the same, except that Debian might not have sudo installed and thus you must install the qt4 libraries using a root account (by the su command, for example). When the libraries are installed, just quit your root account and login as a normal user, then follow the process from ‘checking out GIT’.
 
To Build on Archlinux
LibreCAD is available on Arch User Repository, find and download the package tarball from AUR, untar it, and run makepkg to build LibreCAD
 
$ mkdir ~/abs 
$ cd abs 
$ tar zxvf ~/Downloads/librecad-git.tar.gz 
$ cd librecad-git
$ makepkg -f 
$ sudo pacman -U ./librecad-git-*.xz 

To Build on Gentoo

LibreCAD is available on the science overlay. If the science overlay has not been added to your system, you will need the package layman to add the repository
 
# layman -a science 
# emerge --autounmask-write -pvuDN librecad 
# dispatch-conf 
# emerge -vuDN librecad
You may find it's helpful to read the gentoo wiki Gentoo Overlay Wiki
 
LibreCAD Team