Differences

This shows you the differences between two versions of the page.

Link to this comparison view

compilingwithclang [2013/06/01 00:37]
sanel created
compilingwithclang [2015/10/03 14:54]
Line 1: Line 1:
-====== Compiling With Clang ====== 
- 
-===== Introduction ===== 
- 
-In this short tutorial are described details about compiling edelib and 
-EDE with [[http://​clang.llvm.org/​|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: 
- 
-<​code>​ 
-$ cd fltk-<​version>​ 
-$ export CC=clang 
-$ export CXX=clang++ 
-$ ./configure && make 
-</​code>​ 
- 
-or if you would like FLTK location on different place (default is 
-''/​usr/​local'',​ use ''​prefix''​) parameter, like: 
- 
-<​code>​ 
-$ ./configure --prefix=/​usr && make 
-</​code>​ 
- 
-and as superuser, run: 
- 
-<​code>​ 
-$ make install 
-</​code>​ 
- 
-===== 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: 
- 
-<​code>​ 
-$ cd edelib-<​version>​ 
-$ export CC=clang 
-$ export CXX=clang++ 
-$ ./configure && jam 
-</​code>​ 
- 
-You can use ''​prefix''​ parameter for desired location. As superuser, 
-running: 
- 
-<​code>​ 
-$ jam install 
-</​code>​ 
- 
-will install edelib on desired location. 
- 
-===== Compiling EDE ===== 
- 
-edelib compilation commands applies here too. However, if you are 
-starting to get strange errors like: 
- 
-<​code>​ 
-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);​ } 
-                                     ^ 
-</​code>​ 
- 
-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: 
- 
-<code cpp> 
-#define _GLIBCXX_ATOMIC_BUILTINS 1 
-</​code>​ 
- 
-and comment it out, like: 
- 
-<code cpp> 
-// #define _GLIBCXX_ATOMIC_BUILTINS 1 
-</​code>​ 
- 
-which will disable gcc builtin atomic access functions. Recompile EDE 
-and install it, uncommenting above line. 
  
Print/export