Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
prog:clang [2023/05/10 10:23] – [Utilitaires] : nettoyage root | prog:clang [2024/05/21 11:04] (Version actuelle) – [Compilation] : ne pas compiler les utilitaires root |
---|
=====Installation===== | =====Installation===== |
| |
| ====Compilation==== |
| |
| Pour faire une compilation plus rapide, ajouter : |
| |
| Dossier source : ''llvm-project\llvm''. |
| |
| ''-DLLVM_TARGETS_TO_BUILD=X86'' pour compiler pour x86 et x64. |
| |
| ''-DCMAKE_INSTALL_PREFIX=install'' car ce dossier a besoin d'être accessible en écriture pendant la compilation. |
| |
| ''%%-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra"%%''. ''clang-tools-extra'' est nécessaire pour ''ClangAST''. |
| |
| ''%%-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi"%%'' |
| |
| ''-DLLVM_PARALLEL_LINK_JOBS=2'' pour éviter que le link plante. |
| |
| ''-DLLVM_INCLUDE_TESTS:BOOL=OFF -DCLANG_INCLUDE_TESTS:BOOL=OFF -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF -DLLVM_INCLUDE_UTILS:BOOL=OFF -DLLVM_INCLUDE_DOCS:BOOL=OFF -DLLVM_BUILD_UTILS:BOOL=OFF'' |
====Ubuntu==== | ====Ubuntu==== |
| |
| |
<code bash> | <code bash> |
cd /usr/share/keyrings | wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc |
sudo wget https://apt.llvm.org/llvm-snapshot.gpg.key | |
</code> | </code> |
| |
| |
<code> | <code> |
deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/unstable/ llvm-toolchain main | deb http://apt.llvm.org/mantic/ llvm-toolchain-mantic-17 main |
deb-src [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/unstable/ llvm-toolchain main | deb-src http://apt.llvm.org/mantic/ llvm-toolchain-mantic-17 main |
# 15 | |
deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/unstable/ llvm-toolchain-15 main | |
deb-src [signed-by=/usr/share/keyrings/llvm-snapshot.gpg.key] http://apt.llvm.org/unstable/ llvm-toolchain-15 main | |
</code> | </code> |
| |
[[https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/|time-trace: timeline / flame chart profiler for Clang]] {{ :prog:clang:time-trace_timeline_flame_chart_profiler_for_clang_aras_website_2019-11-11_18_52_11_.html |Archive du 16/01/2019 le 11/11/2019}} | [[https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/|time-trace: timeline / flame chart profiler for Clang]] {{ :prog:clang:time-trace_timeline_flame_chart_profiler_for_clang_aras_website_2019-11-11_18_52_11_.html |Archive du 16/01/2019 le 11/11/2019}} |
| |
| =====Erreurs===== |
| |
| * ''fatal error: 'iostream' file not found'' |
| |
| Les librairies standard ne sont pas trouvées. On peut commencer par vérifier si le paquet ''build-essential'' est installé. |
| |
| Ensuite, les librairies standard ne sont pas forcément celles du gcc par défaut qui sont utilisées. |
| |
| Lancer ''clang -v'' pour trouver laquelle est en cours (''Selected GCC installation''). |
| |
| <code bash> |
| $ clang -v |
| </code> |
| |
| <code> |
| Ubuntu clang version 14.0.6 |
| Target: x86_64-pc-linux-gnu |
| Thread model: posix |
| InstalledDir: /usr/lib/llvm-14/bin |
| Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10 |
| Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 |
| Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12 |
| Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 |
| Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12 |
| Candidate multilib: .;@m64 |
| Selected multilib: .;@m64 |
| </code> |
| |
| <code bash> |
| $ gcc -v |
| </code> |
| |
| <code> |
| gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04) |
| </code> |
| |
| Il faut donc installer les entêtes de gcc-12. |
| |
| <code bash> |
| sudo apt install libstdc++-12-dev |
| </code> |
| |
| [[https://stackoverflow.com/questions/26333823/clang-doesnt-see-basic-headers|Clang doesn't see basic headers]] {{ :prog:clang:c_-_clang_doesn_t_see_basic_headers_-_stack_overflow_11_05_2023_11_53_28_.html |Archive du 13/10/2014 le 11/05/2023}} |