You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm currently developing a feature that aims to replace the system-installed clang-tidy with the version available as a PyPI package. However, I've encountered a challenge: the clang-tidy installed via pip seems unable to locate the omp.h header file, which is causing some issues. Interestingly, the version of clang-tidy that's installed using apt does not have this problem and functions correctly. I'm looking for insights or suggestions on how to resolve this discrepancy.
There is no omp.h shipped with the wheel in site-packages/clang_tidy/data/lib/clang/17/include. It also not looking for the system include directory which contains omp.h (/usr/lib/llvm-14/lib/clang/14.0.0/include).
Reproduce script:
sudo apt update && sudo apt install -y build-essential libomp-dev
sudo apt install -y python3-dev python3-venv
python3 -m venv venv
source venv/bin/activate
pip3 install clang-tidy
cat > test.cpp <<EOF#include <omp.h>#include <stdio.h>int main() {#pragma omp parallel for for (int i = 0; i < 10; i++) { int tid = omp_get_thread_num(); printf("Hello World from thread = %d\n", tid); } return 0;}EOF
clang-tidy --extra-arg=-v test.cpp
Results in docker:
$ docker run -it --rm -h ubuntu --pull always ubuntu:latestroot@ubuntu:/# apt update && apt install -y build-essential libomp-devroot@ubuntu:/# find / -name 'omp.h'/usr/lib/gcc/x86_64-linux-gnu/11/include/omp.h/usr/lib/llvm-14/lib/clang/14.0.0/include/omp.hroot@ubuntu:/# cat > test.cpp <<EOF#include <omp.h>#include <stdio.h>int main() {#pragma omp parallel for for (int i = 0; i < 10; i++) { int tid = omp_get_thread_num(); printf("Hello World from thread = %d\n", tid); } return 0;}EOFroot@ubuntu:/# g++ -fopenmp test.cpp -o a.out && ./a.outHello World from thread = 0Hello World from thread = 3Hello World from thread = 4Hello World from thread = 8Hello World from thread = 5Hello World from thread = 6Hello World from thread = 1Hello World from thread = 7Hello World from thread = 9Hello World from thread = 2
clang-tidy from PyPI:
root@ubuntu:/# apt install -y python3-dev python3-venvroot@ubuntu:/# python3 -m venv venvroot@ubuntu:/# source venv/bin/activate(venv) root@ubuntu:/# pip3 install clang-tidyCollecting clang-tidy Downloading clang_tidy-17.0.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (34.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 34.0/34.0 MB 947.2 kB/s eta 0:00:00Installing collected packages: clang-tidySuccessfully installed clang-tidy-17.0.1(venv) root@ubuntu:/# find / -name 'omp.h'/usr/lib/gcc/x86_64-linux-gnu/11/include/omp.h/usr/lib/llvm-14/lib/clang/14.0.0/include/omp.h(venv) root@ubuntu:/# clang-tidy --extra-arg=-v test.cppResource filename: /venv/lib/python3.10/site-packages/clang_tidy/data/bin/clang-tidy Error while trying to load a compilation database:Could not auto-detect compilation database for file "test.cpp"No compilation database found in / or any parent directoryfixed-compilation-database: Error while opening fixed database: No such file or directoryjson-compilation-database: Error while opening JSON database: No such file or directoryRunning without flags.clang version 17.0.1 (https://github.com/ssciwr/clang-tidy-wheel f518fa02ba2535ce69460b278117bd848ddbdeae)Target: x86_64-unknown-linux-gnuThread model: posixInstalledDir: /venv/lib/python3.10/site-packages/clang_tidy/data/binFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11Candidate multilib: .;@m64Selected multilib: .;@m64clang Invocation:
"/venv/lib/python3.10/site-packages/clang_tidy/data/bin/clang-tool" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-fsyntax-only" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-v" "-fcoverage-compilation-dir=/" "-resource-dir" "/venv/lib/python3.10/site-packages/clang_tidy/data/lib/clang/17" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward" "-internal-isystem" "/venv/lib/python3.10/site-packages/clang_tidy/data/lib/clang/17/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "/test.cpp"
clang -cc1 version 17.0.1 based upon LLVM 17.0.1 default target x86_64-unknown-linux-gnuignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"ignoring nonexistent directory "/include"#include "..." search starts here:#include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward /venv/lib/python3.10/site-packages/clang_tidy/data/lib/clang/17/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/includeEnd of search list.1 error generated.Error while processing /test.cpp./test.cpp:1:10: error: 'omp.h' file not found [clang-diagnostic-error] 1 | #include <omp.h> | ^~~~~~~Found compiler error(s).(venv) root@ubuntu:/# echo$?1
clang-tidy installed by apt:
root@ubuntu:/# apt install -y clang-tidyroot@ubuntu:/# find / -name 'omp.h'/usr/lib/gcc/x86_64-linux-gnu/11/include/omp.h/usr/lib/llvm-14/lib/clang/14.0.0/include/omp.hroot@ubuntu:/# clang-tidy --extra-arg=-v test.cppError while trying to load a compilation database:Could not auto-detect compilation database for file "test.cpp"No compilation database found in / or any parent directoryfixed-compilation-database: Error while opening fixed database: No such file or directoryjson-compilation-database: Error while opening JSON database: No such file or directoryRunning without flags.Ubuntu clang version 14.0.0-1ubuntu1.1Target: x86_64-pc-linux-gnuThread model: posixInstalledDir: /usr/lib/llvm-14/binFound candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11Candidate multilib: .;@m64Selected multilib: .;@m64clang Invocation:
"/usr/lib/llvm-14/bin/clang-tool" "-cc1" "-triple" "x86_64-pc-linux-gnu" "-fsyntax-only" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-v" "-fcoverage-compilation-dir=/" "-resource-dir" "/usr/lib/llvm-14/lib/clang/14.0.0" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward" "-internal-isystem" "/usr/lib/llvm-14/lib/clang/14.0.0/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdeprecated-macro" "-fdebug-compilation-dir=/" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fcxx-exceptions" "-fexceptions" "-fcolor-diagnostics" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-x" "c++" "/test.cpp"
clang -cc1 version 14.0.0 based upon LLVM 14.0.0 default target x86_64-pc-linux-gnuignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"ignoring nonexistent directory "/include"#include "..." search starts here:#include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward /usr/lib/llvm-14/lib/clang/14.0.0/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/includeEnd of search list.root@ubuntu:/# echo$?0
The text was updated successfully, but these errors were encountered:
Hi, I'm currently developing a feature that aims to replace the system-installed
clang-tidy
with the version available as a PyPI package. However, I've encountered a challenge: theclang-tidy
installed viapip
seems unable to locate theomp.h
header file, which is causing some issues. Interestingly, the version ofclang-tidy
that's installed usingapt
does not have this problem and functions correctly. I'm looking for insights or suggestions on how to resolve this discrepancy.There is no
omp.h
shipped with the wheel insite-packages/clang_tidy/data/lib/clang/17/include
. It also not looking for the system include directory which containsomp.h
(/usr/lib/llvm-14/lib/clang/14.0.0/include
).Reproduce script:
Results in docker:
clang-tidy
from PyPI:clang-tidy
installed byapt
:The text was updated successfully, but these errors were encountered: