Repository: spack/spack

Issue:
Installation issue: PCL
### Steps to reproduce the issue

(not relevant as I have a self-maintained version of the package)

### Error message

<details><summary>Error message</summary><pre>
==> Error: ProcessError: Command exited with status 2:
    'make' '-j8'

6 errors found in build log:
     690     cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/surface && /contrib/spack/lib/spack/env
             /clang/clang++ -DPCLAPI_EXPORTS -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/include 
             -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/common/include -I/tmp/ubuntu/spack-stage/spack-sta
             ge-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/search/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snq
             qqnmnasxmhf/spack-src/kdtree/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/octree/includ
             e -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/qhull/include -I/tmp/ubuntu/spack-stage/spack-st
             age-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/vtk/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqq
             nmnasxmhf/spack-src/surface/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface -isyst
             em /usr/include/eigen3 -isystem /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/recognition/include/
             pcl/recognition/3rdparty -isystem /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.78.0-hd6tpwa3rgtnupvfhwca4glx6o3xw
             pqd/include -ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof -msse4.2 -mfpmath=sse -march=native -mavx2 -fopenmp=libomp -O2 -g -
             DNDEBUG -fPIC -fopenmp=libomp -std=c++14 -MD -MT surface/CMakeFiles/pcl_surface.dir/src/texture_mapping.cpp.o -MF CMakeFiles/pcl_surface.dir/s
             rc/texture_mapping.cpp.o.d -o CMakeFiles/pcl_surface.dir/src/texture_mapping.cpp.o -c /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarw
             u7mocwgu6snqqqnmnasxmhf/spack-src/surface/src/texture_mapping.cpp
     691     [ 32%] Building CXX object surface/CMakeFiles/pcl_surface.dir/src/poisson.cpp.o
     692     cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/surface && /contrib/spack/lib/spack/env
             /clang/clang++ -DPCLAPI_EXPORTS -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/include 
             -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/common/include -I/tmp/ubuntu/spack-stage/spack-sta
             ge-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/search/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snq
             qqnmnasxmhf/spack-src/kdtree/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/octree/includ
             e -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/qhull/include -I/tmp/ubuntu/spack-stage/spack-st
             age-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/vtk/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqq
             nmnasxmhf/spack-src/surface/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface -isyst
             em /usr/include/eigen3 -isystem /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/recognition/include/
             pcl/recognition/3rdparty -isystem /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.78.0-hd6tpwa3rgtnupvfhwca4glx6o3xw
             pqd/include -ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof -msse4.2 -mfpmath=sse -march=native -mavx2 -fopenmp=libomp -O2 -g -
             DNDEBUG -fPIC -fopenmp=libomp -std=c++14 -MD -MT surface/CMakeFiles/pcl_surface.dir/src/poisson.cpp.o -MF CMakeFiles/pcl_surface.dir/src/poiss
             on.cpp.o.d -o CMakeFiles/pcl_surface.dir/src/poisson.cpp.o -c /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/
             spack-src/surface/src/poisson.cpp
     693     In file included from /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/src/poisson.cpp:40:
     694     In file included from /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/include/pcl/surface/im
             pl/poisson.hpp:49:
     695     In file included from /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/include/pcl/surface/3r
             dparty/poisson4/sparse_matrix.h:185:
  >> 696     /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/include/pcl/surface/3rdparty/poisson4/sparse
             _matrix.hpp:255:40: error: member reference base type 'MatrixEntry<T> *' is not a structure or union
     697             for(int ii=0;ii<m_ppElements[i].size();i++){m_ppElements[i][ii].Value*=V;}
     698                             ~~~~~~~~~~~~~~~^~~~~
  >> 699     /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/include/pcl/surface/3rdparty/poisson4/sparse
             _matrix.hpp:265:40: error: member reference base type 'MatrixEntry<T> *' is not a structure or union
     700             for(int ii=0;ii<m_ppElements[i].size();ii++){
     701                             ~~~~~~~~~~~~~~~^~~~~
  >> 702     /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface/include/pcl/surface/3rdparty/poisson4/sparse
             _matrix.hpp:326:40: error: member reference base type 'MatrixEntry<T> *' is not a structure or union
     703             for(int ii=0;ii<m_ppElements[i].size();ii++){
     704                             ~~~~~~~~~~~~~~~^~~~~
     705     [ 32%] Building CXX object surface/CMakeFiles/pcl_surface.dir/src/concave_hull.cpp.o
     706     cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/surface && /contrib/spack/lib/spack/env
             /clang/clang++ -DPCLAPI_EXPORTS -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/include 
             -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/common/include -I/tmp/ubuntu/spack-stage/spack-sta
             ge-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/search/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snq
             qqnmnasxmhf/spack-src/kdtree/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/octree/includ
             e -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/qhull/include -I/tmp/ubuntu/spack-stage/spack-st
             age-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/vtk/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqq
             nmnasxmhf/spack-src/surface/include -I/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/surface -isyst
             em /usr/include/eigen3 -isystem /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-src/recognition/include/
             pcl/recognition/3rdparty -isystem /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.78.0-hd6tpwa3rgtnupvfhwca4glx6o3xw
             pqd/include -ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof -msse4.2 -mfpmath=sse -march=native -mavx2 -fopenmp=libomp -O2 -g -
             DNDEBUG -fPIC -fopenmp=libomp -std=c++14 -MD -MT surface/CMakeFiles/pcl_surface.dir/src/concave_hull.cpp.o -MF CMakeFiles/pcl_surface.dir/src/
             concave_hull.cpp.o.d -o CMakeFiles/pcl_surface.dir/src/concave_hull.cpp.o -c /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6
             snqqqnmnasxmhf/spack-src/surface/src/concave_hull.cpp
     707     3 errors generated.
  >> 708     make[2]: *** [surface/CMakeFiles/pcl_surface.dir/build.make:261: surface/CMakeFiles/pcl_surface.dir/src/poisson.cpp.o] Error 1
     709     make[2]: *** Waiting for unfinished jobs....
     710     [ 32%] Linking CXX shared library ../lib/libpcl_sample_consensus.so
     711     cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/sample_consensus && /contrib/spack/opt/
             spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/cmake-3.22.3-zui7sofspuxblp2blbeo5tmisg3q5blb/bin/cmake -E cmake_link_script CMakeFiles/pcl_sam
             ple_consensus.dir/link.txt --verbose=1
     712     /contrib/spack/lib/spack/env/clang/clang++ -fPIC -ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof -msse4.2 -mfpmath=sse -march=n
             ative -mavx2 -fopenmp=libomp -O2 -g -DNDEBUG -shared -Wl,-soname,libpcl_sample_consensus.so.1.12 -o ../lib/libpcl_sample_consensus.so.1.12.1 C
             MakeFiles/pcl_sample_consensus.dir/src/sac.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_circle.cpp.o CMakeFiles/pcl_sample_consensu
             s.dir/src/sac_model_circle3d.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_cylinder.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sa
             c_model_cone.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_line.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_parallel_lin
             e.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_stick.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_parallel_plane.
             cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_plane.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_sphere.cpp
             .o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_plane.cpp.o CMakeFiles/pcl_sample_consensus.dir/src/sac_model_registration.cpp.o CMakeFil
             es/pcl_sample_consensus.dir/src/sac_model_sphere.cpp.o  -Wl,-rpath,/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnas
             xmhf/spack-build-a7uwgta/lib:::::::::: -lm ../lib/libpcl_common.so.1.12.1 /usr/lib/llvm-14/lib/libomp.so /lib/x86_64-linux-gnu/libpthread.a -l
             m
     713     cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/sample_consensus && /contrib/spack/opt/
             spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/cmake-3.22.3-zui7sofspuxblp2blbeo5tmisg3q5blb/bin/cmake -E cmake_symlink_library ../lib/libpcl_
             sample_consensus.so.1.12.1 ../lib/libpcl_sample_consensus.so.1.12 ../lib/libpcl_sample_consensus.so
     714     make[2]: Leaving directory '/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta'

     ...

     1552    [ 94%] Linking CXX executable ../bin/pcl_train_linemod_template
     1553    cd /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/tools && /contrib/spack/opt/spack/linux
             -ubuntu22.04-x86_64_v3/clang-14.0.0/cmake-3.22.3-zui7sofspuxblp2blbeo5tmisg3q5blb/bin/cmake -E cmake_link_script CMakeFiles/pcl_train_linemod_
             template.dir/link.txt --verbose=1
     1554    /contrib/spack/lib/spack/env/clang/clang++ -ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof -msse4.2 -mfpmath=sse -march=native 
             -mavx2 -fopenmp=libomp -O2 -g -DNDEBUG CMakeFiles/pcl_train_linemod_template.dir/train_linemod_template.cpp.o -o ../bin/pcl_train_linemod_temp
             late  -Wl,-rpath,/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta/lib:/contrib/spack/opt/sp
             ack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.78.0-hd6tpwa3rgtnupvfhwca4glx6o3xwpqd/lib:::::::::: ../lib/libpcl_segmentation.so.1.12.1 
             ../lib/libpcl_recognition.so.1.12.1 ../lib/libpcl_io.so.1.12.1 /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.78.0-
             hd6tpwa3rgtnupvfhwca4glx6o3xwpqd/lib/libboost_filesystem.so.1.78.0 /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.7
             8.0-hd6tpwa3rgtnupvfhwca4glx6o3xwpqd/lib/libboost_atomic.so.1.78.0 /contrib/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/clang-14.0.0/boost-1.7
             8.0-hd6tpwa3rgtnupvfhwca4glx6o3xwpqd/lib/libboost_iostreams.so.1.78.0 ../lib/libpcl_io_ply.so.1.12.1 /usr/lib/x86_64-linux-gnu/libpng.so /usr/
             lib/x86_64-linux-gnu/libz.so ../lib/libpcl_ml.so.1.12.1 ../lib/libpcl_registration.so.1.12.1 ../lib/libpcl_features.so.1.12.1 ../lib/libpcl_fi
             lters.so.1.12.1 ../lib/libpcl_search.so.1.12.1 ../lib/libpcl_sample_consensus.so.1.12.1 ../lib/libpcl_octree.so.1.12.1 ../lib/libpcl_kdtree.so
             .1.12.1 ../lib/libpcl_common.so.1.12.1 /usr/lib/llvm-14/lib/libomp.so /lib/x86_64-linux-gnu/libpthread.a -lm /usr/lib/x86_64-linux-gnu/libflan
             n_cpp.so -llz4
     1555    make[2]: Leaving directory '/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta'
     1556    [ 94%] Built target pcl_train_linemod_template
     1557    make[2]: Leaving directory '/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta'
  >> 1558    make[1]: *** [CMakeFiles/Makefile2:1399: surface/CMakeFiles/pcl_surface.dir/all] Error 2
     1559    make[1]: Leaving directory '/tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-a7uwgta'
  >> 1560    make: *** [Makefile:159: all] Error 2

See build log for details:
  /tmp/ubuntu/spack-stage/spack-stage-pcl-1.12.1-a7uwgtarwu7mocwgu6snqqqnmnasxmhf/spack-build-out.txt
</pre></details>


### Information on your system

```console
* **Spack:** 0.18.0.dev0 (d5a6bc153d5fae6b03fd4147043625e76330f18b)
* **Python:** 3.10.4
* **Platform:** linux-ubuntu22.04-skylake_avx512
* **Concretizer:** clingo
```

### Additional information

PCL contains code that can't possibly compile, and has for a decade. For reasons that are unclear, nobody has noticed until now, but Clang 14 picks up on it and complains.

I have submitted a PR [here](https://patch-diff.githubusercontent.com/raw/PointCloudLibrary/pcl/pull/5256.patch) but Spack users may want to keep using their existing PCL versions while upgrading their compilers.


The package does not have maintainers.

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [x] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/pcl/package.py b/var/spack/repos/builtin/packages/pcl/package.py
--- a/var/spack/repos/builtin/packages/pcl/package.py
+++ b/var/spack/repos/builtin/packages/pcl/package.py
@@ -14,12 +14,29 @@ class Pcl(CMakePackage):
     homepage = "https://pointclouds.org/"
     url = "https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.11.1/source.tar.gz"
 
+    version("1.13.1", sha256="be4d499c066203a3c296e2f7e823d6209be5983415f2279310ed1c9abb361d30")
+    version("1.13.0", sha256="bd110789f6a7416ed1c58da302afbdb80f8d297a9e23cc02fd78ab78b4762698")
+    version("1.12.1", sha256="a9573efad5e024c02f2cc9180bb8f82605c3772c62463efbe25c5d6e634b91dc")
+    version("1.12.0", sha256="606a2d5c7af304791731d6b8ea79365bc8f2cd75908006484d71ecee01d9b51c")
     version("1.11.1", sha256="19d1a0bee2bc153de47c05da54fc6feb23393f306ab2dea2e25419654000336e")
 
     depends_on("cmake@3.5:", type="build")
+    depends_on("cmake@3.10:", when="@1.12.1:", type="build")
     depends_on("eigen@3.1:")
+    depends_on("eigen@3.3:", when="@1.13:")
     depends_on("flann@1.7:")
-    depends_on("boost@1.55:+filesystem+date_time+iostreams+system")
+    depends_on("flann@1.9.1:", when="@1.12:")
+    depends_on("boost@1.55:")
+    depends_on("boost@1.65:", when="@1.12:")
+    depends_on("boost+filesystem+iostreams+system")
+    depends_on("boost+date_time", when="@:1.13.0")
+
+    # fix build with clang: #30653
+    with when("@:1.12"):
+        patch(
+            "https://github.com/PointCloudLibrary/pcl/commit/dff16af269fbd2c15772d53064882b2bf8c2ffe9.patch?full_index=1",
+            sha256="17a7a7aec8e63701294612cbb25d46ac1ce58f643dbc68e1517329ae0b68956d",
+        )
 
     # TODO: replace this with an explicit list of components of Boost,
     # for instance depends_on('boost +filesystem')


Test patch: