lsof-org / lsof

LiSt Open Files
https://lsof.readthedocs.io
Other
423 stars 106 forks source link

[BUG] Configure generates invalid Makefile for clang, if AMD runtime is installed #305

Closed AngryLoki closed 10 months ago

AngryLoki commented 10 months ago

Describe the bug This issue was originally reported to https://bugs.gentoo.org/919253

When clang is used, and HIP runtime (amdgpu) is installed, build fails with:

>>> Compiling source in /var/tmp/portage/sys-process/lsof-4.99.0/work/lsof-4.99.0 ...

make -j4 DEBUG= all 
Makefile:1120: *** missing separator.  Stop.

$ cat Makefile
... output skipped ...
cc = clang
ccflags = -march=native -O2 -pipe -flto=thin -D_FILE_OFFSET_BITS=64 -DLSOF_VSTR=\"6.5.7-gentoo-dist\"
ccv = 17.0.3
5.7.31921
datadir = /usr/share
... output skipped ...
...

The issue is caused by line https://github.com/lsof-org/lsof/blob/4.99.0/configure.ac#L559 , which attempts to extract clang version, while clang -v additionally outputs version of HIP runtime. This issue is similar to #68, but there it was clang/macos/nvidia and now it affects clang/linux/amdgpu.

$ clang -v 2>&1 | grep version
clang version 17.0.3
Found HIP installation: /usr/local, version 5.7.31921

It is very likely that as described in #68, Makefile will also fail with Found CUDA installation: /usr/local/cuda, version 9.0 too

To Reproduce Steps to reproduce the behavior:

  1. Install hip runtime and clang. Try to build with clang
  2. See error

Expected behavior As clang outputs its version in the first line, and may output arbitrary information after that, it should be safe to take version from the first version in the output.

AngryLoki commented 10 months ago

Closed with fix in https://github.com/lsof-org/lsof/pull/306, thanks for merging

jiegec commented 10 months ago

Fixed in #306