ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
62 stars 58 forks source link

zgetdump fails to link #147

Closed sharkcz closed 1 year ago

sharkcz commented 1 year ago

zgetdump fails to link on RHEL 8, see bellow

make -C zdump TOPDIR= ARCH=s390x all ;
make[1]: Entering directory '/builddir/build/BUILD/s390-tools-2.25.0/zdump'
gcc -MM -I ../include -D_GNU_SOURCE -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3  -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    dfi_elf.c > .dfi_elf.o.d
...
gcc -MM -I ../include -D_GNU_SOURCE -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3  -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    dfi_s390_ext.c > .dfi_s390_ext.o.d
gcc -I ../include -D_GNU_SOURCE -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3  -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -c zgetdump.c -o zgetdump.o
echo "#include <openssl/evp.h>" > .detect_openssl.dep.c
echo "#if OPENSSL_VERSION_NUMBER < 0x10100000L" >> .detect_openssl.dep.c
echo "  #error At least OpenSSL version 1.1.0 is required" >> .detect_openssl.dep.c
echo "#endif" >> .detect_openssl.dep.c
echo "static void __attribute__((unused)) test(void) {" >> .detect_openssl.dep.c
echo "    EVP_MD_CTX *ctx = EVP_MD_CTX_new();" >> .detect_openssl.dep.c
echo "    EVP_MD_CTX_free(ctx);" >> .detect_openssl.dep.c
echo "}" >> .detect_openssl.dep.c
printf "#include <%s>\n int main(void) {return 0;}\n"  "fuse.h" | ( gcc -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3 -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I ../include -D_GNU_SOURCE  "-DFUSE_USE_VERSION=30" -o /dev/null -x c - ) > /dev/null 2>&1; if [ $? != 0 ]; then printf "  REQCHK  %s (%s)\n"  "zgetdump mount support"  "fuse.h"; printf "********************************************************************************\n" >&2; printf "* Missing build requirement for: %-45s *\n"  "zgetdump mount support" >&2; printf "* Install package..............: %-45s *\n"  "fuse3-devel or libfuse3-dev" >&2; printf "* You can skip build with......: make %-40s *\n"  "HAVE_FUSE=0" >&2; printf "********************************************************************************\n" >&2; exit 1; fi
touch .check_dep_fuse
printf "#include <%s>\n int main(void) {return 0;}\n"  "zlib.h" | ( gcc -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3 -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I ../include -D_GNU_SOURCE  -o /dev/null -x c - ) > /dev/null 2>&1; if [ $? != 0 ]; then printf "  REQCHK  %s (%s)\n"  "zgetdump"  "zlib.h"; printf "********************************************************************************\n" >&2; printf "* Missing build requirement for: %-45s *\n"  "zgetdump" >&2; printf "* Install package..............: %-45s *\n"  "zlib-devel or libz-dev" >&2; printf "* You can skip build with......: make %-40s *\n"  "HAVE_ZLIB=0" >&2; printf "********************************************************************************\n" >&2; exit 1; fi
printf "#include <%s>\n int main(void) {return 0;}\n"  "glib.h" | ( gcc -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3 -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I ../include -D_GNU_SOURCE  -o /dev/null -x c - ) > /dev/null 2>&1; if [ $? != 0 ]; then printf "  REQCHK  %s (%s)\n"  "zgetdump"  "glib.h"; printf "********************************************************************************\n" >&2; printf "* Missing build requirement for: %-45s *\n"  "zgetdump" >&2; printf "* Install package..............: %-45s *\n"  "glib2-devel / libglib2.0-dev" >&2; printf "* You can skip build with......: make %-40s *\n"  "HAVE_GLIB2=0" >&2; printf "********************************************************************************\n" >&2; exit 1; fi
printf "#include <%s>\n int main(void) {return 0;}\n"  .detect_openssl.dep.c | ( gcc -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3 -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I ../include -D_GNU_SOURCE  "-I." -o /dev/null -x c - ) > /dev/null 2>&1; if [ $? != 0 ]; then printf "  REQCHK  %s (%s)\n"  "zgetdump"  .detect_openssl.dep.c; printf "********************************************************************************\n" >&2; printf "* Missing build requirement for: %-45s *\n"  "zgetdump" >&2; printf "* Install package..............: %-45s *\n"  "openssl-devel / libssl-dev version >= 1.1.0" >&2; printf "* You can skip build with......: make %-40s *\n"  "HAVE_OPENSSL=0" >&2; printf "********************************************************************************\n" >&2; exit 1; fi
touch .check_dep_zgetdump
gcc -I ../include -D_GNU_SOURCE -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3  -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -c opts.c -o opts.o
...
gcc -I ../include -D_GNU_SOURCE -DS390_TOOLS_RELEASE=2.25.0-1.el8 -DS390_TOOLS_LIBDIR=/lib/s390-tools -DS390_TOOLS_DATADIR=/usr/share/s390-tools -DS390_TOOLS_SYSCONFDIR=/etc -DS390_TOOLS_BINDIR=/usr/sbin -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wno-address-of-packed-member -DHAVE_FUSE=1 -I/usr/include/fuse3  -DOPENSSL_API_COMPAT=0x10100000L -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include    -c zfuse.c -o zfuse.o
make -C ..//libutil/ libutil.a
make[2]: Entering directory '/builddir/build/BUILD/s390-tools-2.25.0/libutil'
make[2]: 'libutil.a' is up to date.
make[2]: Leaving directory '/builddir/build/BUILD/s390-tools-2.25.0/libutil'
make -C ..//libpv libpv.a
make[2]: Entering directory '/builddir/build/BUILD/s390-tools-2.25.0/libpv'
make[2]: 'libpv.a' is up to date.
make[2]: Leaving directory '/builddir/build/BUILD/s390-tools-2.25.0/libpv'
gcc -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld zgetdump.o .check_dep_zgetdump opts.o zg.o zg_error.o zg_print.o dfi.o dfi_mem_chunk.o dfi_vmcoreinfo.o dfi_lkcd.o dfi_elf.o dfi_elf_common.o dfi_pv_elf.o dfi_s390.o dfi_s390_ext.o dfi_s390mv.o dfi_s390mv_ext.o dfi_s390tape.o dfi_kdump.o dfi_devmem.o dfo.o dfo_mem_chunk.o dfo_elf.o dfo_s390.o df_elf.o df_s390.o dt.o dt_s390sv.o dt_s390sv_ext.o dt_s390mv.o dt_s390mv_ext.o dt_scsi.o output.o ngdump.o dt_ngdump.o dfi_ngdump.o pv_utils.o zfuse.o ..//libutil/libutil.a ..//libpv/libpv.a -lz -lfuse3 -lpthread  -lglib-2.0  -lcrypto  -o zgetdump
.check_dep_zgetdump: file not recognized: File truncated
collect2: error: ld returned 1 exit status
make[1]: Leaving directory '/builddir/build/BUILD/s390-tools-2.25.0/zdump'
make[1]: *** [../common.mak:275: zgetdump] Error 1
make: *** [Makefile:51: zdump] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.JLt5YV (%build)
RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.JLt5YV (%build)

The problem is that the .check_dep_zgetdump file is used as a object file for the final link command and it fails, because it has zero length. Interestingly the same construct works in RHEL 9 or in Fedora. But I believe .check_dep_zgetdump shouldn't be set as an object file.

mhartmay commented 1 year ago

Thanks for reporting - yep, it definitely doesn't make any sense to use this file as linker input! Will push a fix today or tomorrow.

sharkcz commented 1 year ago

Thanks, the build looks good now.