Repository: spack/spack

Issue:
intel-tbb@2020.3 %oneapi@2023.1.0 fails build: icpx: error: unknown argument: '-flifetime-dse=1'
### Steps to reproduce the issue

`intel-tbb@2020.3 %oneapi` fails to build using:
* spack@develop (5c6c3b403bc4a8cd08b4e9303748933f3f79f5f7 from `Sun Jun 18 07:17:19 2023 -0400`)
* OneAPI 2023.1.0
* Ubuntu 20.04, X86_64

Concrete spec: [intel-tbb.spec.json.txt](https://github.com/spack/spack/files/11872787/intel-tbb.spec.json.txt)

<details><summary>Concretization</summary>
<pre>
  -   intel-tbb@2020.3%oneapi@2023.1.0+shared+tm build_system=makefile cxxstd=default patches=62ba015,ce1fb16,d62cb66 arch=linux-ubuntu20.04-x86_64
[+]      ^cmake@3.26.3%oneapi@2023.1.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu20.04-x86_64
[+]          ^ncurses@6.4%oneapi@2023.1.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu20.04-x86_64
[+]              ^pkgconf@1.9.5%oneapi@2023.1.0 build_system=autotools arch=linux-ubuntu20.04-x86_64
[+]          ^openssl@1.1.1u%oneapi@2023.1.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu20.04-x86_64
[+]              ^ca-certificates-mozilla@2023-01-10%oneapi@2023.1.0 build_system=generic arch=linux-ubuntu20.04-x86_64
[+]              ^perl@5.36.0%oneapi@2023.1.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu20.04-x86_64
[+]                  ^berkeley-db@18.1.40%oneapi@2023.1.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu20.04-x86_64
[+]                  ^bzip2@1.0.8%oneapi@2023.1.0~debug~pic+shared build_system=generic arch=linux-ubuntu20.04-x86_64
[+]                      ^diffutils@3.9%oneapi@2023.1.0 build_system=autotools arch=linux-ubuntu20.04-x86_64
[+]                          ^libiconv@1.17%oneapi@2023.1.0 build_system=autotools libs=shared,static arch=linux-ubuntu20.04-x86_64
[+]                  ^gdbm@1.23%oneapi@2023.1.0 build_system=autotools arch=linux-ubuntu20.04-x86_64
[+]                      ^readline@8.2%oneapi@2023.1.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu20.04-x86_64
[+]              ^zlib@1.2.13%oneapi@2023.1.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu20.04-x86_64
</pre>
</details>

Error:
```
$> spack install -f ./intel-tbb.spec.json
...
==> Installing intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36
==> No binary for intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36 found: installing from source
==> Using cached archive: /spack/var/spack/cache/_source-cache/archive/eb/ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3.tar.gz
==> Applied patch /spack/var/spack/repos/builtin/packages/intel-tbb/tbb_cmakeConfig-2019.5.patch
==> Applied patch /spack/var/spack/repos/builtin/packages/intel-tbb/makefile-debug.patch
==> Applied patch /spack/var/spack/repos/builtin/packages/intel-tbb/macos-arm64.patch
==> intel-tbb: Executing phase: 'edit'
==> intel-tbb: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'compiler=gcc'

46 errors found in build log:
     3     ==> [2023-06-26-11:30:08.095681] 'make' '-j16' 'compiler=gcc'
     4     Created the ./build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_release directory
     5     make -C "./build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug"  -r -f ../../build/Makefile.tbb cfg=debug
     6     make -C "./build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug"  -r -f ../../build/Makefile.tbbmalloc cfg=debug malloc
     7     make[1]: Entering directory '/tmp/root/spack-stage/spack-stage-intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36/spack-src/build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug'
     8     make[1]: Entering directory '/tmp/root/spack-stage/spack-stage-intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36/spack-src/build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug'
  >> 9     ../../build/Makefile.tbb:28: CONFIG: cfg=debug arch=intel64 compiler=gcc target=linux runtime=cc11.1.0_libc2.31_kernel5.4.48
     10    /spack/lib/spack/env/oneapi/icpx -o concurrent_hash_map.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall
           -Wextra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
     11    /spack/lib/spack/env/oneapi/icpx -o concurrent_queue.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -We
           xtra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_queue.cpp
     12    /spack/lib/spack/env/oneapi/icpx -o concurrent_vector.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -W
           extra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_vector.cpp
     13    /spack/lib/spack/env/oneapi/icpx -o dynamic_link.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra
            -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/dynamic_link.cpp
     14    /spack/lib/spack/env/oneapi/icpx -o itt_notify.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra -
           Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/itt_notify.cpp
     15    /spack/lib/spack/env/oneapi/icpx -o cache_aligned_allocator.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -W
           all -Wextra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/cache_aligned_allocator.cp
           p

     ...

     19    /spack/lib/spack/env/oneapi/icpx -o reader_writer_lock.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -
           Wextra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/reader_writer_lock.cpp
     20    /spack/lib/spack/env/oneapi/icpx -o spin_rw_mutex.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextr
           a -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/spin_rw_mutex.cpp
     21    /spack/lib/spack/env/oneapi/icpx -o x86_rtm_rw_mutex.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -We
           xtra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/x86_rtm_rw_mutex.cpp
     22    /spack/lib/spack/env/oneapi/icpx -o spin_mutex.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra -
           Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/spin_mutex.cpp
     23    /spack/lib/spack/env/oneapi/icpx -o critical_section.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -We
           xtra -Wno-parentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/critical_section.cpp
     24    /spack/lib/spack/env/oneapi/icpx -o mutex.o -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -fPIC -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra -Wno-p
           arentheses -Wno-sized-deallocation  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/mutex.cpp
  >> 25    icpxicpxicpxicpx: : : : error: error: unknown argument: '-flifetime-dse=1'unknown argument: '-flifetime-dse=1'
  >> 26    error:
     27    icpxerror: unknown argument: '-flifetime-dse=1':
     28    unknown argument: '-flifetime-dse=1'
  >> 29    error: unknown argument: '-flifetime-dse=1'
  >> 30    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 31    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 32    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 33    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 34    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 35    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 36    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 37    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 38    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 39    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 40    make[1]: *** [../../build/common_rules.inc:80: pipeline.o] Error 1
     41    make[1]: *** Waiting for unfinished jobs....
  >> 42    make[1]: *** [../../build/common_rules.inc:80: concurrent_hash_map.o] Error 1
  >> 43    make[1]: *** [../../build/common_rules.inc:80: cache_aligned_allocator.o] Error 1
  >> 44    make[1]: *** [../../build/common_rules.inc:80: concurrent_queue.o] Error 1
  >> 45    make[1]: *** [../../build/common_rules.inc:80: dynamic_link.o] Error 1
  >> 46    make[1]: *** [../../build/common_rules.inc:80: concurrent_vector.o] Error 1
  >> 47    make[1]: *** [../../build/common_rules.inc:80: reader_writer_lock.o] Error 1
  >> 48    make[1]: *** [../../build/common_rules.inc:80: critical_section.o] Error 1
  >> 49    make[1]: *** [../../build/common_rules.inc:80: queuing_rw_mutex.o] Error 1
  >> 50    make[1]: *** [../../build/common_rules.inc:80: mutex.o] Error 1
  >> 51    make[1]: *** [../../build/common_rules.inc:80: itt_notify.o] Error 1
  >> 52    make[1]: *** [../../build/common_rules.inc:80: queuing_mutex.o] Error 1
  >> 53    make[1]: *** [../../build/common_rules.inc:80: spin_mutex.o] Error 1
  >> 54    make[1]: *** [../../build/common_rules.inc:80: spin_rw_mutex.o] Error 1
  >> 55    make[1]: *** [../../build/common_rules.inc:80: x86_rtm_rw_mutex.o] Error 1
     56    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36/spack-src/build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug'
  >> 57    make: *** [Makefile:29: tbb] Error 2
     58    make: *** Waiting for unfinished jobs....
     59    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../sr
           c/tbbmalloc/backend.cpp
     60    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../sr
           c/tbbmalloc/large_objects.cpp
     61    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../sr
           c/tbbmalloc/backref.cpp
     62    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../sr
           c/tbbmalloc/tbbmalloc.cpp
     63    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -o itt_notify_malloc.o -I../../src -I../../src/rml/include -I../../include ../../src/tbb/itt_notify.cpp

     ...

     66    /spack/lib/spack/env/oneapi/icpx -E -x c++ ../../src/tbbmalloc/lin64-tbbmalloc-export.def -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -Wall -Wextra  -DTBB_
           SUPPRESS_DEPRECATED_MESSAGES=1  -fno-rtti -fno-exceptions -D__TBBMALLOC_BUILD=1  -Wno-parentheses -Wno-sized-deallocation -I../../src -I../../src/rml/include -I../../include > tbbmalloc
           .def
     67    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -Wall -Wextra  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1  -Wno-parentheses
           -Wno-sized-deallocation -fPIC -flifetime-dse=1 -D__TBBMALLOC_BUILD=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../src/tbbmalloc/
           proxy.cpp
     68    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -Wall -Wextra  -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1  -Wno-parentheses
           -Wno-sized-deallocation -fPIC -flifetime-dse=1 -D__TBBMALLOC_BUILD=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc ../../src/tbbmalloc/
           tbb_function_replacement.cpp
     69    echo "INPUT (libtbbmalloc_proxy_debug.so.2)" > libtbbmalloc_proxy_debug.so
     70    /spack/lib/spack/env/oneapi/icpx -E -x c++ ../../src/tbbmalloc/lin64-proxy-export.def -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm  -Wall -Wextra  -DTBB_SUPP
           RESS_DEPRECATED_MESSAGES=1  -Wno-parentheses -Wno-sized-deallocation -I../../src -I../../src/rml/include -I../../include > tbbmallocproxy.def
     71    /spack/lib/spack/env/oneapi/icpx -c -MMD -DTBB_USE_DEBUG -O0 -g -DDO_ITT_NOTIFY -DUSE_PTHREAD -pthread -m64 -mrtm    -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fno-rtti -fno-exceptions -D__T
           BBMALLOC_BUILD=1 -Wno-parentheses -Wno-sized-deallocation -fPIC -flifetime-dse=1 -I../../src -I../../src/rml/include -I../../include -I../../src/tbbmalloc -I../../src/tbbmalloc -I. ../.
           ./src/tbbmalloc/frontend.cpp
  >> 72    icpxicpx: : icpxerror: error: : unknown argument: '-flifetime-dse=1'unknown argument: '-flifetime-dse=1'
     73
  >> 74    error: unknown argument: '-flifetime-dse=1'
  >> 75    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 76    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 77    make[1]: *** [../../build/Makefile.tbbmalloc:68: itt_notify_malloc.o] Error 1
     78    make[1]: *** Waiting for unfinished jobs....
  >> 79    make[1]: *** [../../build/Makefile.tbbmalloc:65: tbbmalloc.o] Error 1
  >> 80    make[1]: *** [../../build/Makefile.tbbmalloc:65: large_objects.o] Error 1
  >> 81    make[1]: *** [../../build/Makefile.tbbmalloc:65: backend.o] Error 1
  >> 82    make[1]: *** [../../build/Makefile.tbbmalloc:65: backref.o] Error 1
  >> 83    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 84    icpx: error: unknown argument: '-flifetime-dse=1'
     85    warning: unknown warning option '-Wno-sized-deallocation' [-Wunknown-warning-option]
     86    1 warning generated.
  >> 87    make[1]: *** [../../build/Makefile.tbbmalloc:62: tbb_function_replacement.o] Error 1
  >> 88    make[1]: *** [../../build/Makefile.tbbmalloc:62: proxy.o] Error 1
     89    warning: unknown warning option '-Wno-sized-deallocation' [-Wunknown-warning-option]
     90    1 warning generated.
  >> 91    icpx: error: unknown argument: '-flifetime-dse=1'
  >> 92    make[1]: *** [../../build/Makefile.tbbmalloc:59: frontend.o] Error 1
     93    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-intel-tbb-2020.3-xnipfzl74qbcjdp3i6vlwhhqi2qqhd36/spack-src/build/linux_intel64_gcc_cc11.1.0_libc2.31_kernel5.4.48_debug'
  >> 94    make: *** [Makefile:33: tbbmalloc] Error 2
```

### Error message

<details><summary>Error message</summary>
<pre>
... see above
</pre></details>


### Information on your system

* **Spack:** 0.21.0.dev0 (8ad2fddb560baca17a5c47fb49acf35db753c84e)
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-cascadelake
* **Concretizer:** clingo

### Additional information

[spack-build-env.txt](https://github.com/spack/spack/files/11872790/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/11872791/spack-build-out.txt)

@rscohn2 @wspear @nchaimov

### 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:
It seems to be loading GNU.cmake instead of IntelLLVM.cmake. Not sure why
https://github.com/oneapi-src/oneTBB/blob/e813596ba3a1bee0ffa06fb66b5e30b7ea801319/cmake/compilers/GNU.cmake#L52
I believe newer versions work. Is there a need to use the older version of tbb?
> It seems to be loading GNU.cmake instead of IntelLLVM.cmake. Not sure why https://github.com/oneapi-src/oneTBB/blob/e813596ba3a1bee0ffa06fb66b5e30b7ea801319/cmake/compilers/GNU.cmake#L52 I believe newer versions work. Is there a need to use the older version of tbb?

We are trying to build `hpctoolkit` which in turn requires `dyninst` which in turn conflicts with intel-tbb >= 2021.1:
* https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/dyninst/package.py#L76-L79

CC @hainest in case you know how to work through this

Update: building `intel-tbb@2021.9.0 %oneapi@2023.1.0` works, yes
> > It seems to be loading GNU.cmake instead of IntelLLVM.cmake. Not sure why https://github.com/oneapi-src/oneTBB/blob/e813596ba3a1bee0ffa06fb66b5e30b7ea801319/cmake/compilers/GNU.cmake#L52 I believe newer versions work. Is there a need to use the older version of tbb?
> 
> We are trying to build `hpctoolkit` which in turn requires `dyninst` which in turn conflicts with intel-tbb >= 2021.1:
> 
>     * https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/dyninst/package.py#L76-L79
> 
> 
> CC @hainest in case you know how to work through this
> 
> Update: building `intel-tbb@2021.9.0 %oneapi@2023.1.0` works, yes

You can use any tbb since 2019.3 with dyninst@master.
Do you need a tbb patch for the old version?
> Do you need a tbb patch for the old version?

If it is not too much trouble, that would be nice.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py
--- a/var/spack/repos/builtin/packages/intel-tbb/package.py
+++ b/var/spack/repos/builtin/packages/intel-tbb/package.py
@@ -144,6 +144,9 @@ class IntelTbb(CMakePackage, MakefilePackage):
     # https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1
     patch("macos-arm64.patch", when="@:2021.0")
 
+    # build older tbb with %oneapi
+    patch("intel-tbb.2020.3-icx.patch", when="@2020.3 %oneapi")
+
     # Support for building with %nvhpc
     # 1) remove flags nvhpc compilers do not recognize
     patch("intel-tbb.nvhpc-remove-flags.2017.patch", when="@2017:2018.9 %nvhpc")


Test patch: