Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scan-build from libclang unable to find ccc-analyzer #151367

Open
jtojnar opened this issue Dec 19, 2021 · 8 comments
Open

scan-build from libclang unable to find ccc-analyzer #151367

jtojnar opened this issue Dec 19, 2021 · 8 comments
Labels
0.kind: bug Something is broken

Comments

@jtojnar
Copy link
Member

jtojnar commented Dec 19, 2021

Describe the bug

scan-build program from libclang looks for ccc-analyzer in ../libexec but it is installed into a different output.

Steps To Reproduce

$ nix-build -A libclang.all
$ result/bin/scan-build -o /tmp/foo echo
scan-build: 'ccc-analyzer' does not exist at '/nix/store/54fwpd1lsgr1kadg9989cvafqkzfsqm8-clang-7.1.0/bin/ccc-analyzer'

Expected behaviour

scan-build should find ccc-analyzer.

Additional context

It works with scan-build from clang-analyzer:

$ nix-build -A clang-analyzer
$ result/bin/scan-build -o /tmp/foo echo
scan-build: Using '/nix/store/52w8z9p8m5idz4fsh9y1znmms59da8ba-clang-wrapper-13.0.0/bin/clang' for static analysis
[…]

This is bug is especially annoying because when it is first on PATH, it shadows the working program.

Possible solutions

  • Remove scan-build from libclang so it has a canonical home in clang-analyzer.
  • Patch scan-build code to point to lib output.
  • Move ccc-analyzer to out output.

Notify maintainers

cc @lovek323 @7c6f434c @dtzWill @primeos (libclang)
cc @thoughtpolice @Mic92 (clang-analyzer)

Metadata

Nixpkgs a2e281f

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: libclang
# a list of nixos modules affected by the problem
module:
@jtojnar jtojnar added the 0.kind: bug Something is broken label Dec 19, 2021
jtojnar added a commit to jtojnar/nixpkgs that referenced this issue Dec 19, 2021
You need clang-analyzer before clang in `PATH` since the latter’s scan-build program will not be able to find ccc-analyzer program.
NixOS#151367
@Mic92
Copy link
Member

Mic92 commented Dec 19, 2021

The llvm code build system is quite convoluted. Otherwise we could have just disabled scan-build from libclang build.

jtojnar added a commit to jtojnar/nixpkgs that referenced this issue Dec 27, 2021
You need clang-analyzer before clang in `PATH` since the latter’s scan-build program will not be able to find ccc-analyzer program.
NixOS#151367
@jtojnar
Copy link
Member Author

jtojnar commented May 17, 2022

Possibly will be fixed by #144302

@hmih
Copy link

hmih commented Jun 21, 2022

Still happening on aarch64-darwin.

@disconnect3d
Copy link

Still happening on Darwin x86_64. Fix please! :)

@ranguli
Copy link

ranguli commented Aug 24, 2023

And on NixOS x86_64 too :(

@MaartenBehn
Copy link

Still happening

@N1coc4colA
Copy link

N1coc4colA commented Dec 1, 2024

Hello, I have the same issue. So I checked all the files on my system for the binary.
I have the following (1):

$ find / -type f -name "ccc-analyzer"
/nix/store/wxxgsgjxbnkkyczgf8lkbfrsqiywm8bi-clang-17.0.6-lib/libexec/ccc-analyzer
/nix/store/bwmzqq1dn6w0s1dfcr6q2bby45wvmf0g-clang-17.0.6-lib/libexec/ccc-analyzer
/nix/store/innxkyxqxr9zqsic5pm3d4skm1v0q06j-clang-17.0.6-lib/libexec/ccc-analyzer
/nix/store/3x48dmkw2z70mscl68a5xhf9rpr57qw2-clang-18.1.7-lib/libexec/ccc-analyzer
/nix/store/js44niygpsvdni002pjk7jx1yx4gr822-clang-14.0.6-lib/libexec/ccc-analyzer
/nix/store/ngkb010a8h2slk0z0k8ggnlaf8q3dvl7-clang-analyzer-14.0.6/libexec/ccc-analyzer
/nix/store/2kj5z0sp8cdi28rx8s62gmc8r0wbsir8-clang-14.0.6-lib/libexec/ccc-analyzer
/nix/store/170rx26nfgs7rdx49dmip15c2apav821-clang-analyzer-14.0.6/libexec/ccc-analyzer

In a flake that I use with both clang-tools and clang-analyzer, I have (2):

$ which ccc-analyzer
which: no ccc-analyzer in (/nix/store/1av86b17lymgk29s85nhgxsmfvmxympz-bash-interactive-5.2p32/bin:/nix/store/6wf8zxqql7gmmi96k6swmm0pvqp13gi8-patchelf-0.15.0/bin:/nix/store/r6k305g2rn0qqkvdxfvzqg7mhh7rw679-gcc-wrapper-13.2.0/bin:/nix/store/6g5fhxv0bdm7236ixdwq1izzawbc7grm-gcc-13.2.0/bin:/nix/store/4y2kcviw0cczb56lfl84h7n7j7xm8hh0-glibc-2.39-52-bin/bin:/nix/store/mr63za5vkxj0yip6wj3j9lya2frdm3zc-coreutils-9.5/bin:/nix/store/si9c1ncjikjq2hl5m8i6dzrfznmsz7g5-binutils-wrapper-2.41/bin:/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin:/nix/store/170rx26nfgs7rdx49dmip15c2apav821-clang-analyzer-14.0.6/bin:/nix/store/mr63za5vkxj0yip6wj3j9lya2frdm3zc-coreutils-9.5/bin:/nix/store/myb4rzvdyahvvlyyx32i19nhmr78bc8k-findutils-4.9.0/bin:/nix/store/wk9vn3lcxqya6a5j17v87x18lrkg2ngy-diffutils-3.10/bin:/nix/store/nhr25jgz6bpxbrz6kndjyvgaxipall0j-gnused-4.9/bin:/nix/store/3jc4m5gwimj4mbm01ijgkm2di8hiy5l3-gnugrep-3.11/bin:/nix/store/g7rq3khf0bnm64amflrc4964b7q57dqv-gawk-5.2.2/bin:/nix/store/wqbq6prmrhgm19qqdqm3ijjbap9x74cn-gnutar-1.35/bin:/nix/store/jpqm5igl1gmahp7lxx8j1dy874zvirgm-gzip-1.13/bin:/nix/store/azwrrzpvar2qyn5s4cmrj4jfgfjgmkbv-bzip2-1.0.8-bin/bin:/nix/store/mywvjmd80bayzbi161nly2vfpikyc47h-gnumake-4.4.1/bin:/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin:/nix/store/cjjaglbcsg30bc7rf6xajpp73fkna2mk-patch-2.7.6/bin:/nix/store/kpabg6z89nfry6frc3p5m3zfmk94zyqn-xz-5.4.7-bin/bin:/nix/store/vqhj138xim73r80qcsc546crm4y80ca2-file-5.45/bin:/nix/store/1av86b17lymgk29s85nhgxsmfvmxympz-bash-interactive-5.2p32/bin:/nix/store/6wf8zxqql7gmmi96k6swmm0pvqp13gi8-patchelf-0.15.0/bin:/nix/store/r6k305g2rn0qqkvdxfvzqg7mhh7rw679-gcc-wrapper-13.2.0/bin:/nix/store/6g5fhxv0bdm7236ixdwq1izzawbc7grm-gcc-13.2.0/bin:/nix/store/4y2kcviw0cczb56lfl84h7n7j7xm8hh0-glibc-2.39-52-bin/bin:/nix/store/mr63za5vkxj0yip6wj3j9lya2frdm3zc-coreutils-9.5/bin:/nix/store/si9c1ncjikjq2hl5m8i6dzrfznmsz7g5-binutils-wrapper-2.41/bin:/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin:/nix/store/170rx26nfgs7rdx49dmip15c2apav821-clang-analyzer-14.0.6/bin:/nix/store/mr63za5vkxj0yip6wj3j9lya2frdm3zc-coreutils-9.5/bin:/nix/store/myb4rzvdyahvvlyyx32i19nhmr78bc8k-findutils-4.9.0/bin:/nix/store/wk9vn3lcxqya6a5j17v87x18lrkg2ngy-diffutils-3.10/bin:/nix/store/nhr25jgz6bpxbrz6kndjyvgaxipall0j-gnused-4.9/bin:/nix/store/3jc4m5gwimj4mbm01ijgkm2di8hiy5l3-gnugrep-3.11/bin:/nix/store/g7rq3khf0bnm64amflrc4964b7q57dqv-gawk-5.2.2/bin:/nix/store/wqbq6prmrhgm19qqdqm3ijjbap9x74cn-gnutar-1.35/bin:/nix/store/jpqm5igl1gmahp7lxx8j1dy874zvirgm-gzip-1.13/bin:/nix/store/azwrrzpvar2qyn5s4cmrj4jfgfjgmkbv-bzip2-1.0.8-bin/bin:/nix/store/mywvjmd80bayzbi161nly2vfpikyc47h-gnumake-4.4.1/bin:/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin:/nix/store/cjjaglbcsg30bc7rf6xajpp73fkna2mk-patch-2.7.6/bin:/nix/store/kpabg6z89nfry6frc3p5m3zfmk94zyqn-xz-5.4.7-bin/bin:/nix/store/vqhj138xim73r80qcsc546crm4y80ca2-file-5.45/bin:/nix/store/x2birk6l1j0q4p1f3w3wdsayyn79iscl-clang-tools-17.0.6/bin:/nix/store/q1nssraba326p2kp6627hldd2bhg254c-cmake-3.29.2/bin:/nix/store/by4j2n3mhqdps4d9mm0crhkhk2f2kr2p-cmake-cursesUI-3.29.2/bin:/nix/store/wjl553m0vxgnrcwhywph5nh3w86zb9cj-gdb-14.2/bin:/nix/store/mzhqknx2mc94jdz4n320hn1lml86398y-clang-wrapper-17.0.6/bin:/nix/store/gx27b857v63sm7syli75gjzdvayf2xsr-clang-17.0.6/bin:/nix/store/c2i631h8i5vcs1sqifwxfsazhwrg6wr5-glibc-2.39-52-bin/bin:/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/7bd6mlnyj4192ssw50hksnqbxmj98p26-binutils-wrapper-2.41/bin:/nix/store/bgcaxhhxswzvmxjbbgvvaximm5hwghz1-binutils-2.41/bin:/nix/store/dfcywchxh3lvq92px9hlz477dzkcxvmv-cmake-format-0.6.13/bin:/nix/store/dcmq586xpp336zjir4srh8dvm4kyyrbj-python3.11-autopep8-2.0.4-unstable-2023-10-27/bin:/nix/store/1840zmqg80i3ww7gnyqgwsg49cv9ns2h-python3.11-pycodestyle-2.11.1/bin:/nix/store/7hnr99nxrd2aw6lghybqdmkckq60j6l9-python3-3.11.9/bin:/nix/store/ib0m5lnzb4l8213f0vaagvmrk03xnrrn-python3.11-flake8-7.0.0/bin:/nix/store/6skybaydm329y90cqx5bwp5w0lfn4qpp-python3.11-pyflakes-3.2.0/bin:/nix/store/g0vb4hdpqn2q89887rg9147p3sljghr4-python3.11-pylint-3.1.1/bin:/nix/store/dkzhrhyxn6vd58i3xg48ay7xzhvqaz9v-python3.11-dill-0.3.8/bin:/nix/store/jmmnrckscm9ivdvb5q3y7s3jkbbzs4dm-python3.11-isort-5.13.2/bin:/nix/store/ngkb010a8h2slk0z0k8ggnlaf8q3dvl7-clang-analyzer-14.0.6/bin:/nix/store/3x986i6c36mhl68bcvah99wm8lz8rrx5-graphviz-10.0.1/bin:/nix/store/r0qbx7mr4yri1pqx7wlan72xsxlgj1za-qt-full-5.15.12/bin:/nix/store/zdvrzlvzbn9ymb0z8na50w995j8np16z-pkg-config-wrapper-0.29.2/bin:/nix/store/37979sqc7yw9ps0c4xl9jjkhq0w1hw8b-libxml2-2.12.7-dev/bin:/nix/store/p3109b71w6xbc9zdj2gdmdy1iri50311-libxml2-2.12.7-bin/bin:/nix/store/f4kccbmzw55jcx17kjjaa05v8kmxz5v6-lua-5.2.4/bin:/nix/store/0m8griw158hdfyb3myxx0jhg2d8iyi16-clang-17.0.6-dev/bin:/nix/store/6km6zzql932i6399xbb16v39n35g89qc-llvm-17.0.6-dev/bin:/nix/store/1c9jq1csrx42g5vqynlfl0x63k2nx1x9-ncurses-6.4-dev/bin:/nix/store/j4m3lwhh4x0bzilvi77d512ahry775nq-ncurses-6.4/bin:/nix/store/xhkqzjmzpsrzyjfpvwgpaqb5gvqkhmyv-llvm-17.0.6/bin:/nix/store/nbad47q0m0m9c5xid7zh05hiknwircbp-patchelf-0.15.0/bin:/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin:/nix/store/14c6s4xzhy14i2b05s00rjns2j93gzz4-gcc-13.2.0/bin:/nix/store/kln7kinji3b7sz8r50h4gn9yy6k1js9a-binutils-wrapper-2.41/bin:/nix/store/2ryq88lrrrrmidsvridcv8rcs3arp1f3-compiler-rt-libc-17.0.6/bin:/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/jjcsr5gs4qanf7ln5c6wgcq4sn75a978-findutils-4.9.0/bin:/nix/store/i34mknsjgrfyy71k2h79gda0bvagzc2j-diffutils-3.10/bin:/nix/store/5zjms21vpxlkbc0qyl5pmj2sidfmzmd7-gnused-4.9/bin:/nix/store/28gpmx3z6ss3znd7fhmrzmvk3x5lnfbk-gnugrep-3.11/bin:/nix/store/8vvkbgmnin1x2jkp7wcb2zg1p0vc4ks9-gawk-5.2.2/bin:/nix/store/rik7p68cq7yzlj5pmfpf4yv6jnrpvlgf-gnutar-1.35/bin:/nix/store/j5chw7v1x3vlmf3wmdpdb5gwh9hl0b80-gzip-1.13/bin:/nix/store/mxcq77rlan82dzpv3cgj0fh6qvv8ncil-bzip2-1.0.8-bin/bin:/nix/store/cdzpn0rdq810aknww3w9fy3wmw9ixr66-gnumake-4.4.1/bin:/nix/store/306znyj77fv49kwnkpxmb0j2znqpa8bj-bash-5.2p26/bin:/nix/store/0lfxbmchigx9vs9qmrlbahcy6nxwfnj1-patch-2.7.6/bin:/nix/store/6i4xxaa812vsbli9jkq4mksdddrk27lw-xz-5.4.6-bin/bin:/nix/store/xx7x1dwybpssfhq8yikvzz38bh3yrq97-file-5.45/bin:/run/wrappers/bin:/home/kula/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/kula/.nix-profile/bin:/nix/profile/bin:/home/kula/.local/state/nix/profile/bin:/etc/profiles/per-user/kula/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)

However, I have the followings that contains the ccc-analyzer executable from the output of (1), as it has been matched in (2):

/nix/store/ngkb010a8h2slk0z0k8ggnlaf8q3dvl7-clang-analyzer-14.0.6/libexec/ccc-analyzer
/nix/store/170rx26nfgs7rdx49dmip15c2apav821-clang-analyzer-14.0.6/libexec/ccc-analyzer

Both paths are for the same package. In (2), the PATH just use:

/nix/store/ngkb010a8h2slk0z0k8ggnlaf8q3dvl7-clang-analyzer-14.0.6/bin
/nix/store/170rx26nfgs7rdx49dmip15c2apav821-clang-analyzer-14.0.6/bin

According to the FHS specs it is normal to not find it in path. The issue happened several times in the past with Nix. For example with the #288267. So it seems to be a redundant problem with different packages.
After checking LIBEXEC_PATH's different paths, none includes ccc-analyzer, which points to a packaging issue for not exporting the libexec path.

I am no expert in how Nix makes the packaging. So I just leave it here, but I guess it may just take the time of adding a few lines of code in a clang-analyzer's conf file somewhere.

@LarssonMartin1998
Copy link

Still having this issue on wsl nixos x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

8 participants