This is an old revision of the document!


Compiling With Clang

Introduction

In this short tutorial are described details about compiling edelib and EDE with Clang compiler. It is assumed you already have installed Clang version with needed libraries.

:!: This tutorial is assuming you have read InstallationHowTo and have prepared needed libraries and tools.

Compiling FLTK

First we are going to compile FLTK. Clang can use libraries compiled with gcc, so if you can install latest stable FLTK version as package with your distribution package management system, feel free to do so.

However, if you would like to compile FLTK with Clang, first download FLTK source code, unpack it and run the following commands in terminal:

$ cd fltk-<version>
$ export CC=clang
$ export CXX=clang++
$ ./configure && make

or if you would like FLTK location on different place (default is /usr/local, use prefix) parameter, like:

$ ./configure --prefix=/usr && make

and as superuser, run:

$ make install

Compiling edelib

edelib should be compiled without much of problems and compilation commands are pretty much the same as for compiling FLTK (except you are using jam as build tool). Here are they in the order:

$ cd edelib-<version>
$ export CC=clang
$ export CXX=clang++
$ ./configure && jam

You can use prefix parameter for desired location. As superuser, running:

$ jam install

will install edelib on desired location.

Compiling EDE

edelib compilation commands applies here too. However, if you are starting to get strange errors like:

In file included from ActionMenu.cc:14:
In file included from /usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/iostream:39:
In file included from /usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ostream:39:
In file included from /usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ios:42:
In file included from /usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/ios_base.h:40:
/usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:48:45: error: use of undeclared identifier '__ATOMIC_ACQ_REL'
  { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
                                            ^
/usr/bin/../lib/gcc/i686-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/atomicity.h:52:38: error: use of undeclared identifier '__ATOMIC_ACQ_REL'
  { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
                                     ^

you are probably running latest gcc version with little bit older Clang version. If your distribution does not provide updated Clang package, you can apply a small hack.

:!: Please note how this hack can change how gcc works, so after you change the given file, recompile EDE and revert those changes.

As superuser, open the file /usr/include/c++/VERSION/PLATFORM-DISTRO/bits/c++config.h, where VERSION is gcc version (like 4.7.2) and PLATFORM-DISTRO is distribution specific folder, like i686-redhat-linux. Locate the line:

#define _GLIBCXX_ATOMIC_BUILTINS 1

and comment it out, like:

// #define _GLIBCXX_ATOMIC_BUILTINS 1

which will disable gcc builtin atomic access functions. Recompile EDE and install it, uncommenting above line.

Print/export