提问人:P i 提问时间:11/1/2023 最后编辑:P i 更新时间:11/1/2023 访问量:28
如何将补丁应用于 spack 包?
How to apply a patch to a spack package?
问:
spack install gzip
失败。
> spack install gzip
==> Installing gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep [1/1]
==> No binary for gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/5b/5b4fb14d38314e09f2fc8a1c510e7cd540a3ea0e3eb9b0420046b82c3bf41085.tar.gz
==> No patches needed for gzip
==> gzip: Executing phase: 'autoreconf'
==> gzip: Executing phase: 'configure'
==> gzip: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
'make' '-j16' 'V=1'
13 errors found in build log:
1634 /umbc/rs/iharp/common/chhaya/spack/lib/spack/env/gcc/gcc -DHAVE_CONFIG_H -I. -I/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/
lib -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthro
ugh -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants -g -O2 -MT libgzip_a-fflush.o -MD -MP -MF .deps/libgzip_a-fflush.Tpo -c -o libgzip
_a-fflush.o `test -f 'fflush.c' || echo '/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/'`fflush.c
1635 In file included from /usr/include/string.h:633,
1636 from ./string.h:41,
1637 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/filename.h:24,
1638 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/dirname.h:24,
1639 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/stripslash.c:21:
>> 1640 ./string.h:1091:1: error: expected identifier or '(' before '__extension__'
1641 1091 | _GL_FUNCDECL_SYS (strndup, char *,
1642 | ^~~~~~~~~~~~~~~~
>> 1643 make[3]: *** [libgzip_a-stripslash.o] Error 1
1644 make[3]: *** Waiting for unfinished jobs....
1645 In file included from /usr/include/string.h:633,
1646 from ./string.h:41,
1647 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/filename.h:24,
1648 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/dirname.h:24,
1649 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/dirname-lgpl.c:21:
>> 1650 ./string.h:1091:1: error: expected identifier or '(' before '__extension__'
1651 1091 | _GL_FUNCDECL_SYS (strndup, char *,
1652 | ^~~~~~~~~~~~~~~~
1653 mv -f .deps/libgzip_a-open-safer.Tpo .deps/libgzip_a-open-safer.Po
1654 In file included from /usr/include/string.h:633,
1655 from ./string.h:41,
1656 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/basename-lgpl.c:25:
>> 1657 ./string.h:1091:1: error: expected identifier or '(' before '__extension__'
1658 1091 | _GL_FUNCDECL_SYS (strndup, char *,
1659 | ^~~~~~~~~~~~~~~~
>> 1660 make[3]: *** [libgzip_a-dirname-lgpl.o] Error 1
1661 mv -f .deps/libgzip_a-exitfail.Tpo .deps/libgzip_a-exitfail.Po
>> 1662 make[3]: *** [libgzip_a-basename-lgpl.o] Error 1
1663 mv -f .deps/libgzip_a-fd-hook.Tpo .deps/libgzip_a-fd-hook.Po
1664 mv -f .deps/libgzip_a-creat-safer.Tpo .deps/libgzip_a-creat-safer.Po
1665 mv -f .deps/libgzip_a-dup-safer-flag.Tpo .deps/libgzip_a-dup-safer-flag.Po
1666 In file included from /usr/include/string.h:633,
1667 from ./string.h:41,
1668 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/chdir-long.c:27:
>> 1669 ./string.h:1091:1: error: expected identifier or '(' before '__extension__'
1670 1091 | _GL_FUNCDECL_SYS (strndup, char *,
1671 | ^~~~~~~~~~~~~~~~
1672 mv -f .deps/libgzip_a-fclose.Tpo .deps/libgzip_a-fclose.Po
1673 mv -f .deps/libgzip_a-cloexec.Tpo .deps/libgzip_a-cloexec.Po
1674 In file included from /usr/include/string.h:633,
1675 from ./string.h:41,
1676 from /tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/lib/openat-proc.c:30:
>> 1677 ./string.h:1091:1: error: expected identifier or '(' before '__extension__'
1678 1091 | _GL_FUNCDECL_SYS (strndup, char *,
1679 | ^~~~~~~~~~~~~~~~
1680 mv -f .deps/libgzip_a-fcntl.Tpo .deps/libgzip_a-fcntl.Po
1681 mv -f .deps/libgzip_a-fd-safer-flag.Tpo .deps/libgzip_a-fd-safer-flag.Po
1682 mv -f .deps/libgzip_a-opendir-safer.Tpo .deps/libgzip_a-opendir-safer.Po
>> 1683 make[3]: *** [libgzip_a-openat-proc.o] Error 1
>> 1684 make[3]: *** [libgzip_a-chdir-long.o] Error 1
1685 mv -f .deps/libgzip_a-fflush.Tpo .deps/libgzip_a-fflush.Po
1686 make[3]: Leaving directory `/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/spack-build/lib'
>> 1687 make[2]: *** [all] Error 2
1688 make[2]: Leaving directory `/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/spack-build/lib'
>> 1689 make[1]: *** [all-recursive] Error 1
1690 make[1]: Leaving directory `/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/spack-build'
>> 1691 make: *** [all] Error 2
See build log for details:
/tmp/ckulkar1/spack-stage/spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-build-out.txt
我找到了有问题的文件:.../spack-stage-gzip-1.12-hjaryhgrkevrdht64fqblm3pnyyd26ep/spack-src/spack-build/lib/string.h
我可以注释掉有问题的代码块:
# if 0 // __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
_GL_FUNCDECL_SYS (strndup, char *,
(char const *__s, size_t __n)
_GL_ARG_NONNULL ((1))
_GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
# endif
我可以diff -u string.h string.h.modified > gzip.patch
然后我可以摆弄补丁的前 2 行以获得:
> cat patch
--- string.h 2023-10-31 21:07:57.752141778 -0400
+++ string.h 2023-10-31 21:13:39.283715230 -0400
@@ -1086,7 +1086,7 @@
# endif
_GL_CXXALIASWARN (strndup);
#else
-# if __GNUC__ >= 11
+# if 0 // __GNUC__ >= 11
/* For -Wmismatched-dealloc: Associate strndup with free or rpl_free. */
_GL_FUNCDECL_SYS (strndup, char *,
(char const *__s, size_t __n)
现在我可以摆弄 /home/ckulkar1/iharp_common/chhaya/spack/var/spack/repos/builtin/packages/gzip/package.py
class Gzip(AutotoolsPackage):
"""GNU Gzip is a popular data compression program originally written by
Jean-loup Gailly for the GNU project."""
homepage = "https://www.gnu.org/software/gzip/"
url = "https://ftp.gnu.org/gnu/gzip/gzip-1.10.tar.gz"
version("1.12", sha256="5b4fb14d38314e09f2fc8a1c510e7cd540a3ea0e3eb9b0420046b82c3bf41085")
version("1.11", sha256="3e8a0e0c45bad3009341dce17d71536c4c655d9313039021ce7554a26cd50ed9")
version("1.10", sha256="c91f74430bf7bc20402e1f657d0b252cb80aa66ba333a25704512af346633c68")
# Gzip makes a recursive symlink if built in-source
build_directory = "spack-build"
patch('gzip.patch')
...并将 gzip.patch 复制到同一文件夹中。
但是当我跑步时,我得到:spack install gzip
> spack install gzip
==> Installing gzip-1.12-zalk3vqblkxwfrgkyol4msfelfme64qw [1/1]
==> No binary for gzip-1.12-zalk3vqblkxwfrgkyol4msfelfme64qw found: installing from source
==> Using cached archive: /umbc/rs/iharp/common/chhaya/spack/var/spack/cache/_source-cache/archive/5b/5b4fb14d38314e09f2fc8a1c510e7cd540a3ea0e3eb9b0420046b82c3bf41085.tar.gz
The text leading up to this was:
--------------------------
|--- lib/string.h 2023-10-31 21:07:57.752141778 -0400
|+++ lib/string.h 2023-10-31 21:13:39.283715230 -0400
--------------------------
File to patch:
...我只是不知道下一步该怎么做。
也许我只能从下载的 .gzip 中修补 SOURCE 文件?
我尝试下载并解压缩 https://ftp.gnu.org/gnu/gzip/gzip-1.12.tar.gz 并检查 gzip-1.12/lib/string.in.h(我想它会转换为有问题的 string.h)
那么我应该尝试对这个 .in.h 文件应用补丁吗?
如果是这样,补丁上的文件夹路径应该是什么样子的?
不知何故,在 spack 安装程序下载 .gzip 并将 .in.h 文件编译为 .h 文件后,我需要调整这个 string.h 文件。但在它尝试构建包之前。
我真的被困在这里。我可以在 spack 上提交问题,但 spack 有超过 2k 的未解决问题。
编辑:
我能够通过注释来解决我最初的引导 spack 问题(使用 ):spack install spack
# patch('gzip.patch')
...从我的
/path/to/spack/var/spack/repos/builtin/packages/gzip/package.py,然后在集群上使用 NATIVE 编译器进行构建:gzip
> spack clean -a
> spack install gzip %[email protected]
..., modifying ~/.spack/packages.yaml:
包: 都: 编译器: [[email protected]] gzip: 外部: - 规格:[email protected] 前缀:[FOO] buildable:假
(where [FOO] is the output of `spack location -i [email protected]`), and running:
spack 安装 spack
Now:
spack 查找 --explicit -- linux-centos7-cascadelake / [email protected] ----------------------- [email protected] [email protected]
-- linux-centos7-haswell / [email protected] ---------------------------- [email protected]
-- linux-centos7-sandybridge / [电子邮件保护] ------------------------ [电子邮件保护]
I won't post this as an answer as it's a workaround.
答: 暂无答案
评论