Repository: spack/spack

Issue:
Installation issue: 'procps' fails to build due to undefined libintl_gettext
### Steps to reproduce the issue

I was trying to build procps: without the `nls` variant (which adds a dependency on `gettext`) fails due to procps needing autopoint, part of gettext, so it seems to be a hard dependency.

```console
$ spack install procps ~nls
...
==> Error: ProcessError: Command exited with status 1:
    '/usr/bin/sh' 'autogen.sh'

$ cat .../spack-build-out.txt
==> procps: Executing phase: 'autoreconf'
==> [2023-06-28-22:33:20.440721] '/usr/bin/sh' 'autogen.sh'
You must have autopoint installed to generate procps-ng build system.
The autopoint command is part of the GNU gettext package. 
```

Building procps on my fedora system breaks even when `+nls` is requested: this can be reproduced in a `fedora:38` container. The spec I was trying to build was:

```console
# spack spec -l procps@3.3.15 
Input spec
--------------------------------
 -   procps@3.3.15

Concretized
--------------------------------
 -   is7pfc4  procps@3.3.15%gcc@13.1.1+nls build_system=autotools arch=linux-fedora38-skylake
[+]  35w42i2      ^autoconf@2.69%gcc@13.1.1 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-fedora38-skylake
[+]  lxjmvpc          ^perl@5.36.0%gcc@13.1.1+cpanm+open+shared+threads build_system=generic arch=linux-fedora38-skylake
[+]  2yh26yk              ^berkeley-db@18.1.40%gcc@13.1.1+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-fedora38-skylake
[+]  ja6xwpz              ^gdbm@1.23%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
[+]  f7zb5oq                  ^readline@8.2%gcc@13.1.1 build_system=autotools patches=bbf97f1 arch=linux-fedora38-skylake
[+]  yawi3li              ^zlib@1.2.13%gcc@13.1.1+optimize+pic+shared build_system=makefile arch=linux-fedora38-skylake
[+]  e7yimdy      ^automake@1.16.5%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
[+]  qlloibf      ^gettext@0.21.1%gcc@13.1.1+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-fedora38-skylake
[+]  kefyofk          ^bzip2@1.0.8%gcc@13.1.1~debug~pic+shared build_system=generic arch=linux-fedora38-skylake
[+]  ythqipe          ^libxml2@2.10.3%gcc@13.1.1~python build_system=autotools arch=linux-fedora38-skylake
[+]  3uy2ouu          ^tar@1.34%gcc@13.1.1 build_system=autotools zip=pigz arch=linux-fedora38-skylake
[+]  midmivp              ^pigz@2.7%gcc@13.1.1 build_system=makefile arch=linux-fedora38-skylake
[+]  vijq3k5              ^zstd@1.5.5%gcc@13.1.1+programs build_system=makefile compression=none libs=shared,static arch=linux-fedora38-skylake
[+]  7iagy3z          ^xz@5.4.1%gcc@13.1.1~pic build_system=autotools libs=shared,static arch=linux-fedora38-skylake
[+]  buqvpnc      ^libiconv@1.17%gcc@13.1.1 build_system=autotools libs=shared,static arch=linux-fedora38-skylake
[+]  nyrejti      ^libtool@2.4.7%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
[+]  eq3wtje      ^m4@1.4.19%gcc@13.1.1+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-fedora38-skylake
[+]  hndrzis          ^diffutils@3.9%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
[+]  rdg6yko          ^libsigsegv@2.14%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
[+]  q7w2gjg      ^ncurses@6.4%gcc@13.1.1~symlinks+termlib abi=none build_system=autotools arch=linux-fedora38-skylake
[+]  bstyanj      ^pkgconf@1.9.5%gcc@13.1.1 build_system=autotools arch=linux-fedora38-skylake
```

I then tried on Amazon Linux and Ubuntu 22.04, and they all fail similarly. Error messages below.

### Error message

<details><summary>Setup and error message on <code>fedora:38</code></summary>

```console
$ docker run -it fedora:38
# dnf group install -y "Development Tools"
# dnf install -y curl findutils gcc-gfortran gnupg2 hostname iproute redhat-lsb-core python3 python3-pip python3-setuptools unzip python3-boto3
# dnf install -y g++
# dnf install -y bzip2
# git clone https://github.com/spack/spack.git
# . spack/share/spack/setup-env.sh
# spack compiler find
==> Added 1 new compiler to /root/.spack/linux/compilers.yaml
    gcc@13.1.1

# spack install procps
...
==> Installing procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir
==> No binary for procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir found: installing from source
==> Using cached archive: /spack/var/spack/cache/_source-cache/git//procps-ng/procps.git/v3.3.15.tar.gz
==> Warning: Fetching from mirror without a checksum!
  This package is normally checked out from a version control system, but it has been archived on a spack mirror.  This means we cannot know a checksum for the tarball in advance. Be sure that your connection to this mirror is secure!
==> No patches needed for procps
==> procps: Executing phase: 'autoreconf'
==> procps: Executing phase: 'configure'
==> procps: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'V=1'

39 errors found in build log:
     54     libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
     55     libtoolize: linking file 'm4/libtool.m4'
     56     libtoolize: linking file 'm4/ltoptions.m4'
     57     libtoolize: linking file 'm4/ltsugar.m4'
     58     libtoolize: linking file 'm4/ltversion.m4'
     59     libtoolize: linking file 'm4/lt~obsolete.m4'
  >> 60     configure.ac:15: installing './compile'
  >> 61     configure.ac:61: installing './config.guess'
  >> 62     configure.ac:61: installing './config.sub'
  >> 63     configure.ac:9: installing './install-sh'
  >> 64     configure.ac:9: installing './missing'
     65     Makefile.am: installing './depcomp'
     66     parallel-tests: installing './test-driver'
     67     
     68     Now type './configure' and 'make' to compile.
     69     ==> procps: Executing phase: 'configure'
     70     ==> [2023-06-29-06:43:02.319154] FILTER FILE: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/s
            pack-src/configure [replacing "^(\s*if test x-L = )("\$p" \|\|\s*)$"]

     ...

     541    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-fedora38-skylake/gcc-13.1.1/procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/share/locale\" -I/spack/opt/s
            pack/linux-fedora38-skylake/gcc-13.1.1/libiconv-1.17-buqvpnc5zyizkmhbduxvcfjvdsf5zy4r/include -I/spack/opt/spack/linux-fedora38-
            skylake/gcc-13.1.1/gettext-0.21.1-qlloibfnm4tatetluw6w3zlveczb6lem/include -Iproc -g -O2 -MT proc/wchan.lo -MD -MP -MF proc/.dep
            s/wchan.Tpo -c proc/wchan.c -o proc/wchan.o >/dev/null 2>&1
     542    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-fedora38-skylake/gcc-13.1.1/procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/share/locale\" -I/spack/opt/s
            pack/linux-fedora38-skylake/gcc-13.1.1/libiconv-1.17-buqvpnc5zyizkmhbduxvcfjvdsf5zy4r/include -I/spack/opt/spack/linux-fedora38-
            skylake/gcc-13.1.1/gettext-0.21.1-qlloibfnm4tatetluw6w3zlveczb6lem/include -Iproc -g -O2 -MT proc/slab.lo -MD -MP -MF proc/.deps
            /slab.Tpo -c proc/slab.c -o proc/slab.o >/dev/null 2>&1
     543    /bin/sh ./libtool  --tag=CC   --mode=link /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2   -o lib/test_fileutils lib/test
            _fileutils.o lib/fileutils.o
     544    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o pwdx pwdx.o lib/fileutils.o
     545    /bin/sh ./libtool  --tag=CC   --mode=link /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2   -o lib/test_nsutils lib/test_n
            sutils.o lib/nsutils.o
     546    /usr/bin/ld: watch-watch.o: in function `usage':
  >> 547    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:87: undefined reference to `l
            ibintl_gettext'
  >> 548    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:89: undefined re
            ference to `libintl_gettext'
  >> 549    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:90: undefined re
            ference to `libintl_gettext'
  >> 550    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:91: undefined re
            ference to `libintl_gettext'
  >> 551    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:92: undefined re
            ference to `libintl_gettext'
  >> 552    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:93
            : more undefined references to `libintl_gettext' follow
     553    /usr/bin/ld: watch-watch.o: in function `main':
  >> 554    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:700: undefined reference to `
            libintl_bindtextdomain'
  >> 555    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:701: undefined r
            eference to `libintl_textdomain'
  >> 556    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:745: undefined r
            eference to `libintl_gettext'
  >> 557    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:732: undefined r
            eference to `libintl_gettext'
     558    /usr/bin/ld: watch-watch.o: in function `output_header':
  >> 559    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:390: undefined reference to `
            libintl_gettext'
  >> 560    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:391: undefined r
            eference to `libintl_gettext'
     561    /usr/bin/ld: watch-watch.o: in function `run_command':
  >> 562    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:484: undefined reference to `
            libintl_gettext'
  >> 563    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/watch.c:47
            2: more undefined references to `libintl_gettext' follow
  >> 564    collect2: error: ld returned 1 exit status
  >> 565    make[2]: *** [Makefile:1463: watch] Error 1
     566    make[2]: *** Waiting for unfinished jobs....
     567    /usr/bin/ld: pwdx.o: in function `usage':
  >> 568    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:36: undefined reference to `li
            bintl_gettext'
  >> 569    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:37: undefined ref
            erence to `libintl_gettext'
  >> 570    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:38: undefined ref
            erence to `libintl_gettext'
  >> 571    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:39: undefined ref
            erence to `libintl_gettext'
  >> 572    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:40: undefined ref
            erence to `libintl_gettext'
  >> 573    /usr/bin/ld: pwdx.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:41: more u
            ndefined references to `libintl_gettext' follow
     574    /usr/bin/ld: pwdx.o: in function `main':
  >> 575    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:81: undefined reference to `li
            bintl_bindtextdomain'
  >> 576    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:82: undefined ref
            erence to `libintl_textdomain'
  >> 577    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:88: undefined ref
            erence to `libintl_gettext'
  >> 578    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/pwdx.c:113: undefined re
            ference to `libintl_gettext'
     579    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 580    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
  >> 581    collect2: error: ld returned 1 exit status
  >> 582    make[2]: *** [Makefile:1408: pwdx] Error 1
     583    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_fileutils lib/test_fileutils.o lib/fileutils.o
     584    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_nsutils lib/test_nsutils.o lib/nsutils.o
     585    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_strutils lib/test_strutils.o lib/strutils.o
     586    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-fedora38-skylake/gcc-13.1.1/procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/share/locale\" -I/spack/opt/s
            pack/linux-fedora38-skylake/gcc-13.1.1/libiconv-1.17-buqvpnc5zyizkmhbduxvcfjvdsf5zy4r/include -I/spack/opt/spack/linux-fedora38-
            skylake/gcc-13.1.1/gettext-0.21.1-qlloibfnm4tatetluw6w3zlveczb6lem/include -Iproc -g -O2 -MT proc/whattime.lo -MD -MP -MF proc/.
            deps/whattime.Tpo -c proc/whattime.c -o proc/whattime.o >/dev/null 2>&1
     587    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 588    /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
  >> 589    collect2: error: ld returned 1 exit status
  >> 590    make[2]: *** [Makefile:1344: lib/test_fileutils] Error 1
     591    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-fedora38-skylake/gcc-13.1.1/procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/share/locale\" -I/spack/opt/s
            pack/linux-fedora38-skylake/gcc-13.1.1/libiconv-1.17-buqvpnc5zyizkmhbduxvcfjvdsf5zy4r/include -I/spack/opt/spack/linux-fedora38-
            skylake/gcc-13.1.1/gettext-0.21.1-qlloibfnm4tatetluw6w3zlveczb6lem/include -Iproc -g -O2 -MT proc/sysinfo.lo -MD -MP -MF proc/.d
            eps/sysinfo.Tpo -c proc/sysinfo.c -o proc/sysinfo.o >/dev/null 2>&1
     592    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-fedora38-skylake/gcc-13.1.1/procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/share/locale\" -I/spack/opt/s
            pack/linux-fedora38-skylake/gcc-13.1.1/libiconv-1.17-buqvpnc5zyizkmhbduxvcfjvdsf5zy4r/include -I/spack/opt/spack/linux-fedora38-
            skylake/gcc-13.1.1/gettext-0.21.1-qlloibfnm4tatetluw6w3zlveczb6lem/include -Iproc -g -O2 -MT proc/readproc.lo -MD -MP -MF proc/.
            deps/readproc.Tpo -c proc/readproc.c -o proc/readproc.o >/dev/null 2>&1
     593    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src'
  >> 594    make[1]: *** [Makefile:1872: all-recursive] Error 1
     595    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-src'
  >> 596    make: *** [Makefile:1044: all] Error 2

See build log for details:
  /tmp/root/spack-stage/spack-stage-procps-3.3.15-wgau3t76pdcly46ar4uvo7e5coa5gtir/spack-build-out.txt
```

</details>

<details><summary>Setup and error message on <code>amazonlinux:2023</code></summary>

```console
$ docker run -it amazonlinux:2023
# yum group install -y "Development Tools"
# yum install -y findutils gcc-gfortran hostname iproute python3 python3-pip python3-setuptools unzip
# git clone https://github.com/spack/spack.git
# . spack/share/spack/setup-env.sh
# spack compiler find
# spack install procps
...
==> Installing procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt
==> No binary for procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt found: installing from source
==> No patches needed for procps
==> procps: Executing phase: 'autoreconf'
==> procps: Executing phase: 'configure'
==> procps: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'V=1'

39 errors found in build log:
     54     libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
     55     libtoolize: linking file 'm4/libtool.m4'
     56     libtoolize: linking file 'm4/ltoptions.m4'
     57     libtoolize: linking file 'm4/ltsugar.m4'
     58     libtoolize: linking file 'm4/ltversion.m4'
     59     libtoolize: linking file 'm4/lt~obsolete.m4'
  >> 60     configure.ac:15: installing './compile'
  >> 61     configure.ac:61: installing './config.guess'
  >> 62     configure.ac:61: installing './config.sub'
  >> 63     configure.ac:9: installing './install-sh'
  >> 64     configure.ac:9: installing './missing'
     65     Makefile.am: installing './depcomp'
     66     parallel-tests: installing './test-driver'
     67     
     68     Now type './configure' and 'make' to compile.
     69     ==> procps: Executing phase: 'configure'
     70     ==> [2023-06-29-07:13:46.788139] FILTER FILE: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/s
            pack-src/configure [replacing "^(\s*if test x-L = )("\$p" \|\|\s*)$"]

     ...

     542    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/version.lo -MD -MP -MF proc/.d
            eps/version.Tpo -c proc/version.c -o proc/version.o >/dev/null 2>&1
     543    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/sig.lo -MD -MP -MF proc/.deps/
            sig.Tpo -c proc/sig.c -o proc/sig.o >/dev/null 2>&1
     544    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/wchan.lo -MD -MP -MF proc/.dep
            s/wchan.Tpo -c proc/wchan.c -o proc/wchan.o >/dev/null 2>&1
     545    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o pwdx pwdx.o lib/fileutils.o
     546    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/slab.lo -MD -MP -MF proc/.deps
            /slab.Tpo -c proc/slab.c -o proc/slab.o >/dev/null 2>&1
     547    /usr/bin/ld: pwdx.o: in function `usage':
  >> 548    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:36: undefined reference to `li
            bintl_gettext'
  >> 549    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:37: undefined ref
            erence to `libintl_gettext'
  >> 550    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:38: undefined ref
            erence to `libintl_gettext'
  >> 551    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:39: undefined ref
            erence to `libintl_gettext'
  >> 552    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:40: undefined ref
            erence to `libintl_gettext'
  >> 553    /usr/bin/ld: pwdx.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:41: more u
            ndefined references to `libintl_gettext' follow
     554    /usr/bin/ld: pwdx.o: in function `main':
  >> 555    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:81: undefined reference to `li
            bintl_bindtextdomain'
  >> 556    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:82: undefined ref
            erence to `libintl_textdomain'
  >> 557    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:88: undefined ref
            erence to `libintl_gettext'
  >> 558    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/pwdx.c:113: undefined re
            ference to `libintl_gettext'
     559    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 560    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
     561    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/whattime.lo -MD -MP -MF proc/.
            deps/whattime.Tpo -c proc/whattime.c -o proc/whattime.o >/dev/null 2>&1
  >> 562    collect2: error: ld returned 1 exit status
  >> 563    make[2]: *** [Makefile:1408: pwdx] Error 1
     564    make[2]: *** Waiting for unfinished jobs....
     565    /bin/sh ./libtool  --tag=CC   --mode=link /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2   -o lib/test_nsutils lib/test_n
            sutils.o lib/nsutils.o
     566    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -g -O2 -o watch watch-watch.o lib/watch-strutils.o lib/watch-fileutils.o 
             -L/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/ncurses-6.4-x36agqocjwn7q4zrcplvkel7i5iwvcvb/lib -lncurses -ltinfo
     567    /usr/bin/ld: watch-watch.o: in function `usage':
  >> 568    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:87: undefined reference to `l
            ibintl_gettext'
  >> 569    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:89: undefined re
            ference to `libintl_gettext'
  >> 570    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:90: undefined re
            ference to `libintl_gettext'
  >> 571    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:91: undefined re
            ference to `libintl_gettext'
  >> 572    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:92: undefined re
            ference to `libintl_gettext'
  >> 573    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:93
            : more undefined references to `libintl_gettext' follow
     574    /usr/bin/ld: watch-watch.o: in function `main':
  >> 575    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:700: undefined reference to `
            libintl_bindtextdomain'
  >> 576    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:701: undefined r
            eference to `libintl_textdomain'
  >> 577    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:745: undefined r
            eference to `libintl_gettext'
  >> 578    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:732: undefined r
            eference to `libintl_gettext'
     579    /usr/bin/ld: watch-watch.o: in function `output_header':
  >> 580    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:390: undefined reference to `
            libintl_gettext'
  >> 581    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:391: undefined r
            eference to `libintl_gettext'
     582    /usr/bin/ld: watch-watch.o: in function `run_command':
  >> 583    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:462: undefined reference to `
            libintl_gettext'
  >> 584    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/watch.c:65
            4: more undefined references to `libintl_gettext' follow
  >> 585    collect2: error: ld returned 1 exit status
  >> 586    make[2]: *** [Makefile:1463: watch] Error 1
     587    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_fileutils lib/test_fileutils.o lib/fileutils.o
     588    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_nsutils lib/test_nsutils.o lib/nsutils.o
     589    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 590    /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
  >> 591    collect2: error: ld returned 1 exit status
  >> 592    make[2]: *** [Makefile:1344: lib/test_fileutils] Error 1
     593    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/sysinfo.lo -MD -MP -MF proc/.d
            eps/sysinfo.Tpo -c proc/sysinfo.c -o proc/sysinfo.o >/dev/null 2>&1
     594    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-amzn2023-skylake/gcc-11.3.1/procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/share/locale\" -I/spack/opt/s
            pack/linux-amzn2023-skylake/gcc-11.3.1/libiconv-1.17-2vjdnzug5meripnecho7fstyxyqqfpv2/include -I/spack/opt/spack/linux-amzn2023-
            skylake/gcc-11.3.1/gettext-0.21.1-pbstqrt5jak52prpqjfkuy5avxv7ub6t/include -Iproc -g -O2 -MT proc/readproc.lo -MD -MP -MF proc/.
            deps/readproc.Tpo -c proc/readproc.c -o proc/readproc.o >/dev/null 2>&1
     595    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src'
  >> 596    make[1]: *** [Makefile:1872: all-recursive] Error 1
     597    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-src'
  >> 598    make: *** [Makefile:1044: all] Error 2

See build log for details:
  /tmp/root/spack-stage/spack-stage-procps-3.3.15-leuvsegkqqibfsc6xq666ebb4dvqvoxt/spack-build-out.txt
```

</details>

<details><summary>Setup and error message on <code>ubuntu:22.04</code></summary>

```console
$ docker run -it ubuntu:22.04
# apt update
# apt install build-essential ca-certificates coreutils curl environment-modules gfortran git gpg lsb-release python3 python3-distutils python3-venv unzip zip

# git clone https://github.com/spack/spack.git
# . spack/share/spack/setup-env.sh
# spack compiler find
# spack install procps
...
==> Installing procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg
==> No binary for procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg found: installing from source
==> No patches needed for procps
==> procps: Executing phase: 'autoreconf'
==> procps: Executing phase: 'configure'
==> procps: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'V=1'

39 errors found in build log:
     54     libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
     55     libtoolize: linking file 'm4/libtool.m4'
     56     libtoolize: linking file 'm4/ltoptions.m4'
     57     libtoolize: linking file 'm4/ltsugar.m4'
     58     libtoolize: linking file 'm4/ltversion.m4'
     59     libtoolize: linking file 'm4/lt~obsolete.m4'
  >> 60     configure.ac:15: installing './compile'
  >> 61     configure.ac:61: installing './config.guess'
  >> 62     configure.ac:61: installing './config.sub'
  >> 63     configure.ac:9: installing './install-sh'
  >> 64     configure.ac:9: installing './missing'
     65     Makefile.am: installing './depcomp'
     66     parallel-tests: installing './test-driver'
     67     
     68     Now type './configure' and 'make' to compile.
     69     ==> procps: Executing phase: 'configure'
     70     ==> [2023-06-29-09:34:51.862227] FILTER FILE: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/s
            pack-src/configure [replacing "^(\s*if test x-L = )("\$p" \|\|\s*)$"]

     ...

     587    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/share/locale\" -I/spack/op
            t/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/libiconv-1.17-dbi5zz3klroovn45i4jt7lj7vnsacqdu/include -I/spack/opt/spack/linux-ubu
            ntu22.04-skylake/gcc-11.3.0/gettext-0.21.1-4yfoe43g4qqnqpqn4nbpybowpq32p3of/include -Iproc -g -O2 -MT proc/sig.lo -MD -MP -MF pr
            oc/.deps/sig.Tpo -c proc/sig.c -o proc/sig.o >/dev/null 2>&1
     588    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -g -O2 -o watch watch-watch.o lib/watch-strutils.o lib/watch-fileutils.o 
             -L/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/ncurses-6.4-4ftf36djzwjk5qhxi2e257tmvc6ypvsk/lib -lncurses -ltinfo
     589    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o pwdx pwdx.o lib/fileutils.o
     590    /bin/bash ./libtool  --tag=CC   --mode=link /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2   -o lib/test_strutils lib/tes
            t_strutils.o lib/strutils.o
     591    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/share/locale\" -I/spack/op
            t/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/libiconv-1.17-dbi5zz3klroovn45i4jt7lj7vnsacqdu/include -I/spack/opt/spack/linux-ubu
            ntu22.04-skylake/gcc-11.3.0/gettext-0.21.1-4yfoe43g4qqnqpqn4nbpybowpq32p3of/include -Iproc -g -O2 -MT proc/whattime.lo -MD -MP -
            MF proc/.deps/whattime.Tpo -c proc/whattime.c -o proc/whattime.o >/dev/null 2>&1
     592    /usr/bin/ld: watch-watch.o: in function `usage':
  >> 593    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:87: undefined reference to `l
            ibintl_gettext'
  >> 594    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:89: undefined re
            ference to `libintl_gettext'
  >> 595    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:90: undefined re
            ference to `libintl_gettext'
  >> 596    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:91: undefined re
            ference to `libintl_gettext'
  >> 597    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:92: undefined re
            ference to `libintl_gettext'
  >> 598    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:93
            : more undefined references to `libintl_gettext' follow
     599    /usr/bin/ld: watch-watch.o: in function `main':
  >> 600    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:700: undefined reference to `
            libintl_bindtextdomain'
  >> 601    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:701: undefined r
            eference to `libintl_textdomain'
  >> 602    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:745: undefined r
            eference to `libintl_gettext'
  >> 603    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:732: undefined r
            eference to `libintl_gettext'
     604    /usr/bin/ld: watch-watch.o: in function `output_header':
  >> 605    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:390: undefined reference to `
            libintl_gettext'
  >> 606    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:391: undefined r
            eference to `libintl_gettext'
     607    /usr/bin/ld: watch-watch.o: in function `run_command':
  >> 608    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:654: undefined reference to `
            libintl_gettext'
  >> 609    /usr/bin/ld: watch-watch.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/watch.c:46
            2: more undefined references to `libintl_gettext' follow
  >> 610    collect2: error: ld returned 1 exit status
  >> 611    make[2]: *** [Makefile:1463: watch] Error 1
     612    make[2]: *** Waiting for unfinished jobs....
     613    /usr/bin/ld: pwdx.o: in function `usage':
  >> 614    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:36: undefined reference to `li
            bintl_gettext'
  >> 615    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:37: undefined ref
            erence to `libintl_gettext'
  >> 616    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:38: undefined ref
            erence to `libintl_gettext'
  >> 617    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:39: undefined ref
            erence to `libintl_gettext'
  >> 618    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:40: undefined ref
            erence to `libintl_gettext'
  >> 619    /usr/bin/ld: pwdx.o:/tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:41: more u
            ndefined references to `libintl_gettext' follow
     620    /usr/bin/ld: pwdx.o: in function `main':
  >> 621    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:81: undefined reference to `li
            bintl_bindtextdomain'
  >> 622    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:82: undefined ref
            erence to `libintl_textdomain'
  >> 623    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:88: undefined ref
            erence to `libintl_gettext'
  >> 624    /usr/bin/ld: /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/pwdx.c:113: undefined re
            ference to `libintl_gettext'
     625    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 626    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
  >> 627    collect2: error: ld returned 1 exit status
  >> 628    make[2]: *** [Makefile:1408: pwdx] Error 1
     629    top/top.c: In function 'config_file':
     630    top/top.c:3709:10: warning: ignoring return value of 'fgets' declared with attribute 'warn_unused_result' [-Wunused-result]
     631     3709 |    (void)fgets(fbuf, sizeof(fbuf), fp);     // ignore eyecatcher
     632          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     633    top/top.c:3799:10: warning: ignoring return value of 'fscanf' declared with attribute 'warn_unused_result' [-Wunused-result]
     634     3799 |    (void)fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"

     ...

     662       40 |                                   __va_arg_pack ());
     663          |                                   ~~~~~~~~~~~~~~~~~
     664    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_strutils lib/test_strutils.o lib/strutils.o
     665    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_fileutils lib/test_fileutils.o lib/fileutils.o
     666    libtool: link: /spack/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o lib/test_process lib/test_process.o
     667    /usr/bin/ld: lib/fileutils.o: in function `close_stdout':
  >> 668    /tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src/lib/fileutils.c:38: undefined referen
            ce to `libintl_gettext'
  >> 669    collect2: error: ld returned 1 exit status
  >> 670    make[2]: *** [Makefile:1344: lib/test_fileutils] Error 1
     671    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/share/locale\" -I/spack/op
            t/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/libiconv-1.17-dbi5zz3klroovn45i4jt7lj7vnsacqdu/include -I/spack/opt/spack/linux-ubu
            ntu22.04-skylake/gcc-11.3.0/gettext-0.21.1-4yfoe43g4qqnqpqn4nbpybowpq32p3of/include -Iproc -g -O2 -MT proc/sysinfo.lo -MD -MP -M
            F proc/.deps/sysinfo.Tpo -c proc/sysinfo.c -o proc/sysinfo.o >/dev/null 2>&1
     672    libtool: compile:  /spack/lib/spack/env/gcc/gcc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -DLOCALEDIR=\
            "/spack/opt/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/share/locale\" -I/spack/op
            t/spack/linux-ubuntu22.04-skylake/gcc-11.3.0/libiconv-1.17-dbi5zz3klroovn45i4jt7lj7vnsacqdu/include -I/spack/opt/spack/linux-ubu
            ntu22.04-skylake/gcc-11.3.0/gettext-0.21.1-4yfoe43g4qqnqpqn4nbpybowpq32p3of/include -Iproc -g -O2 -MT proc/readproc.lo -MD -MP -
            MF proc/.deps/readproc.Tpo -c proc/readproc.c -o proc/readproc.o >/dev/null 2>&1
     673    top/top.c: In function 'capsmk.part.0':
     674    top/top.c:817:55: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size between 1 and 32 
            [-Wformat-truncation=]
     675      817 |       snprintf(Caps_endline, sizeof(Caps_endline), "%s%s", Caps_off, Cap_clr_eol);
     676          |                                                       ^~             ~~~~~~~~~~~

     ...

     712          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     713       72 |                                    __glibc_objsize (__s), __fmt,
     714          |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     715       73 |                                    __va_arg_pack ());
     716          |                                    ~~~~~~~~~~~~~~~~~
     717    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src'
  >> 718    make[1]: *** [Makefile:1872: all-recursive] Error 1
     719    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-procps-3.3.15-hpapl5jy77uagztpn3kvowtl4gqkkypg/spack-src'
  >> 720    make: *** [Makefile:1044: all] Error 2
```

</details>

When reverting [this change](https://github.com/spack/spack/commit/c110bcc5af64a0d93200b58861a9cb65c751ffbd#diff-18809f3060e3de3a250240ff5140c6cb654cfeab7a697741109d2c7ccd51a52f) introduced by https://github.com/spack/spack/pull/35450 I'm able to build procps fine, and some commands that I tested work perfectly for me (`ps`, `watch`, `top`, `free`, `uptime`).

I also tried building the latest release of procps, `v4.0.3`, but that fails similarly:
```diff
     homepage = "https://gitlab.com/procps-ng/procps"
     git = "https://gitlab.com/procps-ng/procps.git"
+    url = "https://gitlab.com/procps-ng/procps/-/archive/v4.0.3/procps-v4.0.3.tar.gz"

     version("master", branch="master")
-    version("3.3.15", tag="v3.3.15")
+    version("4.0.3",  sha256="14cc21219c45d196772274ea3f194f6d668b6cc667fbde9ee6d8039121b73fa6")
+    version("3.3.15", sha256="14dfa751517dd844efa9f492e3ad8071f908a269c6aea643b9a1759235fa2053")
```

### Information on your system

In the `fedora:38` container:

```console
# spack debug report
* **Spack:** 0.21.0.dev0 (c3f4822f92e0afc70f3a642310c7e1282434d397)
* **Python:** 3.11.3
* **Platform:** linux-fedora38-skylake
* **Concretizer:** clingo
```

### Additional information

I found this issue from 2016, but I didn't find any clear path to fix the issue: https://github.com/spack/spack/issues/2613. Inside that issue there's a reference to the gettext FAQ https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined, but I didn't investigate much for now, I'll try some more later.

Here are logs from the `fedora:38` container:
[fedora_config.log](https://github.com/spack/spack/files/11903279/fedora_config.log)
[fedora_spack-build-env.txt](https://github.com/spack/spack/files/11903281/fedora_spack-build-env.txt)
[fedora_spack-build-out.txt](https://github.com/spack/spack/files/11903282/fedora_spack-build-out.txt)

Here are logs from the `ubuntu:22.04` container:
[ubuntu_config.log](https://github.com/spack/spack/files/11903283/ubuntu_config.log)
[ubuntu_spack-build-env.txt](https://github.com/spack/spack/files/11903284/ubuntu_spack-build-env.txt)
[ubuntu_spack-build-out.txt](https://github.com/spack/spack/files/11903285/ubuntu_spack-build-out.txt)

CC @greenc-FNAL since you were involved in #35450.

### 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:
Currently attempting to reproduce on my AL9 machine.
Reproduced the fedora 38 issue.
Here, we are told where to find `libintl.so` and how. We then acknowledge exactly what needs to be added to the link line:
```console
⋮
==> [2023-06-29-09:26:54.692361] '/tmp/greenc/spack-stage/spack-stage-procps-3.3.15-dmmzrvni33ha5z3ixuam6rbymmbvs3wx/spack-src/configure' 'LDLIBS=-lintl' '--prefix=/home/greenc/work/cet-is/sources/Spack/spack/run/opt/spack/linux-almalinux9-cascadelake/gcc-11.3.1/procps-3.3.15-dmmzrvni33ha5z3ixuam6rbymmbvs3wx' '--with-ncurses' '--enable-nls' '--with-libintl-prefix=/home/greenc/work/cet-is/sources/Spack/spack/run/opt/spack/linux-almalinux9-cascadelake/gcc-11.3.1/gettext-0.21.1-sksrkvpab3rzwxbrzy5cpjb5que4zyug' '--without-libiconv-prefix'
⋮
checking for GNU gettext in libc... no
checking for iconv... yes
checking for GNU gettext in libintl... yes
checking whether to use NLS... yes
checking where the gettext function comes from... external libintl
checking how to link with libintl... /home/greenc/work/cet-is/sources/Spack/spack/run/opt/spack/linux-almalinux9-cascadelake/gcc-11.3.1/gettext-0.21.1-sksrkvpab3rzwxbrzy5cpjb5que4zyug/lib/libintl.so -Wl,-rpath -Wl,/home/greenc/work/cet-is/sources/Spack/spack/run/opt/spack/linux-almalinux9-cascadelake/gcc-11.3.1/gettext-0.21.1-sksrkvpab3rzwxbrzy5cpjb5que4zyug/lib
⋮
```
The already-ascertained link options specified above are then not used:
```console
libtool: link: /home/greenc/work/cet-is/sources/Spack/spack/run/lib/spack/env/gcc/gcc -std=gnu99 -Iproc -g -O2 -o pwdx pwdx.o lib/fileutils.o 
```
Trying to ascertain why and fix...

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/procps/package.py b/var/spack/repos/builtin/packages/procps/package.py
--- a/var/spack/repos/builtin/packages/procps/package.py
+++ b/var/spack/repos/builtin/packages/procps/package.py
@@ -27,22 +27,20 @@ class Procps(AutotoolsPackage):
     depends_on("pkgconfig@0.9.0:", type="build")
     depends_on("dejagnu", type="test")
     depends_on("iconv")
+    depends_on("gettext", type="build")
     depends_on("gettext", when="+nls")
     depends_on("ncurses")
 
     conflicts("platform=darwin", msg="procps is linux-only")
 
+    # Need to tell the build to use the tools it already has to find
+    # libintl (if appropriate).
+    patch("libintl.patch")
+
     def autoreconf(self, spec, prefix):
         sh = which("sh")
         sh("autogen.sh")
 
-    def flag_handler(self, name, flags):
-        if name == "ldlibs":
-            spec = self.spec
-            if "+nls" in spec and "intl" in spec["gettext"].libs.names:
-                flags.append("-lintl")
-        return self.build_system_flags(name, flags)
-
     def configure_args(self):
         spec = self.spec
         args = ["--with-ncurses"]


Test patch: