Repository: spack/spack

Issue:
flux-core build failing with libarchive issue
Hi! We have libarchive added as a dependency, but during the build it (recently) started failing:

```
[+] /opt/spack/opt/spack/linux-ubuntu20.04-x86_64_v4/gcc-10.5.0/py-jsonschema-4.17.3-iqopdvqifxbqyoktp7746nro2f5j743r
==> Installing flux-core-0.54.0-tnrjyhqzpgxglakapowy5bb7zio6jjql [67/67]
==> No binary for flux-core-0.54.0-tnrjyhqzpgxglakapowy5bb7zio6jjql found: installing from source
==> Fetching https://github.com/flux-framework/flux-core/releases/download/v0.54.0/flux-core-0.54.0.tar.gz
==> No patches needed for flux-core
==> flux-core: Executing phase: 'autoreconf'
==> flux-core: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 1:
    '/tmp/runner/spack-stage/spack-stage-flux-core-0.54.0-tnrjyhqzpgxglakapowy5bb7zio6jjql/spack-src/configure' '--prefix=/opt/spack/opt/spack/linux-ubuntu20.04-x86_64_v4/gcc-10.5.0/flux-core-0.54.0-tnrjyhqzpgxglakapowy5bb7zio6jjql' '--enable-pylint=no' '--disable-docs'

1 error found in build log:
     186    checking for systemd/sd-bus.h... no
     187    checking for HWLOC... yes
     188    checking for LZ4... yes
     189    checking for SQLITE... yes
     190    checking for LIBUUID... yes
     191    checking for CURSES... yes
  >> 192    checking for LIBARCHIVE... configure: error: Package requirements (
            libarchive) were not met:
     193    
     194    Package 'iconv', required by 'libarchive', not found
     195    
     196    Consider adjusting the PKG_CONFIG_PATH environment variable if you
     197    installed software in a non-standard prefix.
     198    

See build log for details:
  /tmp/runner/spack-stage/spack-stage-flux-core-0.54.0-tnrjyhqzpgxglakapowy5bb7zio6jjql/spack-build-out.txt
Traceback (most recent call last):
  File "/home/runner/.local/bin/pakages", line 8, in <module>
```

I think it's related to this:

```
Package 'iconv', required by 'libarchive', not found
```
Which weirdly I've seen before, but before it kind of went away on its own? It hasn't this time.

 - Here is the line in the package.py: https://github.com/spack/spack/blob/26e063177dc7b7be7c1bb65e826d5e1ad83bb49a/var/spack/repos/builtin/packages/flux-core/package.py#L128
 - Here is an example failing log: https://github.com/flux-framework/spack/actions/runs/6521899750/job/17710942633

ping @grondo  and thanks for your help!


Discussion:
Sounds like the libarchive package should require libiconv? I'm not really sure, this might require a little research after Monday...
It looks like we need to add it explicitly: https://github.com/spack/spack/blob/26e063177dc7b7be7c1bb65e826d5e1ad83bb49a/var/spack/repos/builtin/packages/libarchive/package.py#L115 and it used to not be a variant but was converted to one: https://github.com/spack/spack/commit/c110bcc5af64a0d93200b58861a9cb65c751ffbd#diff-7ae37e79142fee687f11760cf8764ff8e52fea798b3cd6958eb05ffd970b5d42

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/flux-core/package.py b/var/spack/repos/builtin/packages/flux-core/package.py
--- a/var/spack/repos/builtin/packages/flux-core/package.py
+++ b/var/spack/repos/builtin/packages/flux-core/package.py
@@ -125,7 +125,7 @@ class FluxCore(AutotoolsPackage):
     conflicts("platform=darwin", msg="flux-core does not support MacOS based platforms.")
     conflicts("platform=windows", msg="flux-core does not support Windows based platforms.")
 
-    depends_on("libarchive", when="@0.38.0:")
+    depends_on("libarchive+iconv", when="@0.38.0:")
     depends_on("ncurses@6.2:", when="@0.32.0:")
     depends_on("libzmq@4.0.4:")
     depends_on("czmq@3.0.1:")


Test patch: