Linux and CGAL

Update 14/04/2016: Assuming you have Linux (in a dual booted machine or in VirtualBox), follow these steps for CGAL-4.7:

  1. Download cgal from :
  2. Extract: tar xzvf CGAL-4.7.tar.gz
  3. cd CGAL-4.7
  4. cmake .
  5. make
  6. sudo make install

Ideally this would be all, but I had to install cmake, make, g++, Boost, GMP and something else.
To run a CGAL program, descend to its directory and do:

cmake .
// run your executable, e.g.:

Credits to I. Chamodrakas and Christos Nasikas.

How to install CGAL in Linux and how to dual boot Linux with Windows? I had to answer these two questions and two great scientists helped me over, Pr. Panagiotis Cheilaris and Nomimal Animal, respectively. I would like to dedicate this page to them!

The first piece of instructions have to do with the dual boot and the next one with installing CGAL. I have windows7 and ubuntu 12.04. First I installed CGAL 3.6.1 and then I isntalled CGAL 4.3(17/10/2013).

“If your laptop runs Windows 7, you might wish to watch this video:

I skimmed through it, and it looks correct to me. You can also check
out the other related videos (especially if your laptop isn’t Win 7).

Here’s step by step guide:
_ _ _ _ _

1. Decide which flavor of Ubuntu you want.

There are four major flavors of Ubuntu, which differ only by
their desktop environment and default installs.

If you install the other -desktop packages (which do pull in
quite a few packages, something like a gigabyte!), you essentially
enable another flavor.

In other words, the flavors are just different combinations of
default packages (and their configuration files).

The desktop environments in Ubuntu flavors are:

xubuntu – XFCE desktop,
lubuntu – LXDE desktop,
kubuntu – KDE desktop,
ubuntu – Gnome desktop,

You can pick either 12.04 (long term support) version,
or 13.04 (current latest version). 13.10 will be released
for Ubuntu in a few days, but the other flavors will lag
behind somewhat.

If you have a PC with the Windows 8 logo or UEFI firmware,
choose the 64-bit download. Read this anyway:
_ _ _ _ _

2. Download the .iso image for the flavor you prefer.

_ _ _ _ _

If you wish to install via a DVD:

This requires you to have a DVD burner,
(I used this
a DVD drive in your laptop, and an empty DVD-R/W disc.

It is a disc image, so you can use your burning software
to “open” the image, and burn it to the disc.
(In other words, you are *not* supposed to burn a DVD
with a single .iso file in it, but burn the .iso file
*as a disc image*.)
A disc image is much like a .ZIP archive, except it really
is an actual copy of the final disk; containing much more
than just the files.

If you wish to install via an USB stick:

Download and install either UnetBootIn,
or LinuxLiveUSB,
for your *Windows* version.

Either one of these will let you create the Linux
installation USB stick from Windows.

You just stick the USB stick in, start
UnetBootIn/LinuxLiveUSB, tell it where the .iso
image you’d like yo use is, and which USB stick
you’d like to use as the boot image.

(Note: Disable persistence; reserve 0 for persistence.)
_ _ _ _ _

Next, you need to prepare your laptop disk so that it’ll have
room for the Linux partition.

In Windows:

3. Run “Disk Defragmenter”, to defragment the laptop disk.
This will take quite a while.

4. Run “Disk Management”, to shrink the Windows partition.

Later, when you install Linux, that free space is used
for Linux.

While you can access files on the Windows partition
from Linux, the system files and basic home folders
will always need to be on a Linux filesystem. So,
reserve at least 8 GB for Linux.

Most likely, you’ll also need to store your simulation
inputs and outputs on the Linux partition, so better
shrink the Windows partition as small as you dare.
Perhaps a 50%/50% split?
_ _ _ _ _

Next, reboot your laptop from the DVD or USB stick,
and install Linux.

You usually need to tap F12 (immediately after power-on),
i.e. before Windows boot menu appears, to select which
disk/media you wish to boot from.

This varies between laptops; the laptop user manual should
mention what the key is. It’s usually F12, though.
(On some machines you need to go into BIOS, and change the
boot order to list removable devices first.)

5. You should see a Ubuntu/Kubuntu/Lubuntu/Xubuntu initial screen.
Probably similar to

If you select the “Try”, you will not install anything to the
laptop hard drive, but you can use the Linux as-is.
Just remember that this “trial” is slower than actual, because
everything has to be loaded from the DVD/USB stick, which is much
slower than your laptop hard disk.

Important installation settings:

* Download updates while installing: I prefer yes/checked

* Install third-party software: Yes

* Language: English
While the Greek support is pretty good, it is best to use English
for the installation and initial use. That way, if you run into
any problems, you can Google (or ask me) about any error messages.
If they are in Greek, they’re pretty hard to find.

Afterwards, when you’re comfortable with the Linux, you can easily
add Greek support, and even switch between English and Greek.
(It is easiest to do by setting up a secondary account.)

* Installation type: “Install alongside Windows”

The step that follows the “installation type” allows you to
yet resize the partitions (Windows/Linux), but it is theoretically
safer to do that in Windows, using Windows tools. So best leave
the divider where it is, I think.

This option should not have any “grub” -related settings.
(If there are, select the Linux partition, and not master boot

* Do not encrypt the installation
(You can encrypt your home directory, but I wouldn’t bother)

* Do not use LVM (Logical Volume Management)
_ _ _ _ _

The above should be a safe way to install Linux alongside Windows on your
laptop — or any Windows machine, really.

There is always the possibility of hiccups, but they shouldn’t be too
dangerous. For example, if the “grub” settings went awry, and Windows
no longer boots, you only need to download Boot Repair Disk,
or, if the Linux boots fine on the Laptop, run
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
to install it; then just run
boot-repair &
to have a nice graphical utility to fix those pesky boot problems.
_ _ _ _ _

Note that I don’t have a windows machine at all, so the above is slightly
interpolated. There are no large errors, but I may have missed some
details. Overall, it is quite safe and simple, really.

Just keep calm, think about each choice before you make it
– definitely don’t let yourself click on the Next button repeatedly
just because you’re feeling panicked or frustrated! –.

If possible, be near a second machine you can use to browse the Internet
at the same time. Maybe ask a friend? All Ubuntu flavours are similar,
so the installation is pretty much the same, except for the visuals.

Note: Most installation-related questions have already been asked
at the site. In particular,
The search box uses Google internally, so put any terms in double quotes,
for example: “install” “13.04″ “dual boot”

CGAL and Linux. When I first installed CGAL, I found this helpful. Of course, you can take a look at the official installation guide of cgal here. I suggest you to read them all before initiating the installation.

*Download CGAL-4.3.tar.xz on
And then do the following: Lines that start with // are comments!
//"~" is short for home diretory
cd ~
mkdir code
copy the tar.xz file to the code directory
//Now the the tar.xz should be at ~/code/ 
cd ~/code
//(extract archive)
tar Jxvf CGAL-4.3.tar.xz
cd CGAL-4.3/
cmake -DCGAL_DIR=~/code/CGAL-4.3 .
// Test if a demo runs
cd demo/Segment_Delaunay_graph_2/
cmake -DCGAL_DIR=~/code/CGAL-4.3 .
// And then I got this cmake error:
CGAL not found.  Set the CGAL_DIR cmake variable or environment variable to the directory containing CGALConfig.cmake. This is either the binary directory where CGAL was configured or PREFIX/lib/CGAL for an installation.
CMake Error at CMakeLists.txt:15 (include):
 include called with wrong number of arguments.  Include only takes one

// We should correct the path for CGAL
cmake -DCGAL_DIR=$HOME/code/CGAL-4.3 .
// We expect to see the following:
[100%] Built target Segment_voronoi_2
// and test as
// which we expect to run the program

//--------------The END----------------

We are going to use
cmake -DCGAL_DIR=$HOME/code/CGAL-4.3 .
if we have a CMakelists.txt
in our current directory.
Scripts that we probably need to use are in ~/code/CGAL-4.3/scripts
We can create a CMakelists.txt, with the command ~/code/CGAL-4.3/scripts/cgal_create_CMakeLists
(or ~/code/CGAL-4.3/scripts/cgal_create_CMakeLists -s executable for many files)
Then do cmake -DCGAL_DIR=$HOME/code/CGAL-4.3 . (do not forget the whitespace and the dot after 4.3)
And then make
For C++11, same steps are required, but one should write in the CMakeLists.txt, under
# CGAL and its components
, this:
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++0x")

When compilations errors are too many, you may want to write them into a file.txt .
make &> errors.txt
(The & is for stderr)

After some time, I wanted to do a format, thus decided to upgrade to Ubuntu 14.04. Having the dual-boot configuration already on play, I had to do these steps (with the help of V. Anagnostopoulos):

  1. Download the image of Ubuntu (via live usb creator for example)
  2. F2 or Del to enter BIOS
  3. Boot -> Hard drive BBS priorities and move the USB flash (the stick) first, then hit F10 and save
  4. Restart (might be triggered automatically) and then we are ready to install
  5. Click on Install Ubuntu and then the Wizard appears
  6. Somewhere, a checkbox about installing third party appears. It would be nice to check it, as well as the other checkbox in the same window too.
  7. Choose on Something else
  8. Go to partition of Ubuntu, delete it, click on “-”
  9. In the free space, I insert it (I guess the new Ubuntu that are to be installed) by pressing “+”
  10. Set size as 30.000, logical, beginning, ext 4 and root (i.e. /).
  11. Do the same (at the least the two previous steps) for the remaining free space for “/home”
  12. Now root hosts the OS and /home the data
  13. Install now / OK
  14. Software updater
  15. Additional drivers when Ubuntu starts (if there is anything there)

Have questions? Comments? Did you find a bug? Let me know! 😀
Page created by G. (George) Samaras (DIT)


3 thoughts on “Linux and CGAL

  1. Pingback: Non-programmer using Linux | G. Samaras

  2. Pingback: CGAL in Linux

  3. Pingback: Approximate Nearest Neighbors (NN) Libraries in high-dimensions | FLANN vs CGAL vs BOOST | G. Samaras

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s