Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build-id.sh failed #279

Closed
zzzqiii opened this issue May 31, 2021 · 11 comments
Closed

build-id.sh failed #279

zzzqiii opened this issue May 31, 2021 · 11 comments

Comments

@zzzqiii
Copy link

zzzqiii commented May 31, 2021

when running ./bootstrap.sh, it exported:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
sh: /usr/bin/autoconf: No such file or directory
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=all
Can't exec "/usr/bin/autoconf": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run /usr/bin/autoconf: No such file or directory

OS

Red Hat Enterprise Linux Server release 6.8 (Santiago)
Linux mgt 2.6.32-642.el6.x86_64 #1 SMP Wed Apr 13 00:51:26 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

autoreconf version

autoreconf (GNU Autoconf) 2.63
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later
<http://gnu.org/licenses/old-licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

automake version

automake (GNU automake) 1.11.1
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <[email protected]>
       and Alexandre Duret-Lutz <[email protected]>.

gcc version

gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Update
After installing autoconf-latest and libtool and updating gcc 4.4.7 to gcc 6.4.0, it maked successfully.
However, when making check, it failed.

PASS: plain-fail.sh
PASS: plain-run.sh
PASS: shrink-rpath.sh
PASS: set-interpreter-short.sh
PASS: set-interpreter-long.sh
PASS: set-rpath.sh
PASS: no-rpath.sh
PASS: big-dynstr.sh
PASS: set-rpath-library.sh
PASS: soname.sh
PASS: shrink-rpath-with-allowed-prefixes.sh
PASS: force-rpath.sh
PASS: plain-needed.sh
PASS: output-flag.sh
FAIL: build-id.sh
PASS: no-rpath-amd64.sh
PASS: no-rpath-armel.sh
PASS: no-rpath-armhf.sh
PASS: no-rpath-hurd-i386.sh
PASS: no-rpath-i386.sh
PASS: no-rpath-ia64.sh
PASS: no-rpath-kfreebsd-amd64.sh
PASS: no-rpath-kfreebsd-i386.sh
PASS: no-rpath-mips.sh
PASS: no-rpath-mipsel.sh
PASS: no-rpath-powerpc.sh
PASS: no-rpath-s390.sh
PASS: no-rpath-sh4.sh
PASS: no-rpath-sparc.sh
========================
1 of 29 tests failed
See tests/test-suite.log
========================
make[3]: *** [test-suite.log] Error 1
make[3]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.12/tests'
make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.12/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.12/tests'
make: *** [check-recursive] Error 1

It is same as #148.
Do you have any suggestion on this issue? Thanks!

@zzzqiii zzzqiii changed the title ./bootstrap.sh failed build-id.sh failed Jun 2, 2021
@zzzqiii
Copy link
Author

zzzqiii commented Jun 2, 2021

$ cat test-suite.log

=========================================
   patchelf 0.12: tests/test-suite.log   
=========================================

1 of 29 tests failed.  

.. contents:: :depth: 2


FAIL: build-id.sh (exit: 1)
===========================

patching ELF file 'scratch/build-id/libbuildid.so'
new rpath is 'AAAAAAAAAAAAAAAAAAAAAAAAAAAA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with size 1178
this is a dynamic library
last page is 0x1201000
needed space is 1704
rewriting section '.dynamic' from offset 0x7c8 (size 384) to offset 0x3000 (size 400)
rewriting section '.dynstr' from offset 0x370 (size 177) to offset 0x3190 (size 1178)
rewriting section '.hash' from offset 0x1b8 (size 80) to offset 0x3630 (size 80)
rewriting section '.note.gnu.build-id' from offset 0x190 (size 36) to offset 0x3680 (size 36)
rewriting symbol table section 1
rewriting symbol table section 29
writing scratch/build-id/libbuildid.so

@GaneshChandra
Copy link

I have the same problem. What should I do. I am running as a user on a cluster.

@Mic92
Copy link
Member

Mic92 commented Aug 10, 2021

@zzzqiii can you add set -x to the failing script at the top after the shebang and re-run the test?
Also readelf -n ./tests/scratch/build-id//libbuildid.so is required to understand the error.

@zzzqiii
Copy link
Author

zzzqiii commented Aug 11, 2021

@zzzqiii can you add set -x to the failing script at the top after the shebang and re-run the test?
Also readelf -n ./tests/scratch/build-id//libbuildid.so is required to understand the error.

I am sorry I don't understand how to set -x to the failling script at the top.
I re-download the patchelf-0.13 and try again, but meet the same problem as before. @Mic92
Here are the log files.

$ make check
Making check in src
make[1]: Entering directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/src'
make[1]: Nothing to be done for `check'.
make[1]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/src'
Making check in tests
make[1]: Entering directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make  simple main main-scoped big-dynstr no-rpath contiguous_note_sections libfoo.so libfoo-scoped.so libbar.so libbar-scoped.so libsimple.so libbuildid.so
make[2]: Entering directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make[2]: `simple' is up to date.
make[2]: `main' is up to date.
make[2]: `main-scoped' is up to date.
make[2]: `big-dynstr' is up to date.
make[2]: `no-rpath' is up to date.
make[2]: `contiguous_note_sections' is up to date.
make[2]: `libfoo.so' is up to date.
make[2]: `libfoo-scoped.so' is up to date.
make[2]: `libbar.so' is up to date.
make[2]: `libbar-scoped.so' is up to date.
make[2]: `libsimple.so' is up to date.
make[2]: `libbuildid.so' is up to date.
make[2]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make  check-TESTS
make[2]: Entering directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make[3]: Entering directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
PASS: plain-fail.sh
PASS: plain-run.sh
PASS: shrink-rpath.sh
PASS: set-interpreter-short.sh
PASS: set-interpreter-long.sh
PASS: set-rpath.sh
PASS: add-rpath.sh
PASS: no-rpath.sh
PASS: big-dynstr.sh
PASS: set-rpath-library.sh
PASS: soname.sh
PASS: shrink-rpath-with-allowed-prefixes.sh
PASS: force-rpath.sh
PASS: plain-needed.sh
PASS: output-flag.sh
PASS: no-rpath-pie-powerpc.sh
FAIL: build-id.sh
PASS: invalid-elf.sh
PASS: endianness.sh
PASS: contiguous_note_sections.sh
PASS: no-rpath-amd64.sh
PASS: no-rpath-armel.sh
PASS: no-rpath-armhf.sh
PASS: no-rpath-hurd-i386.sh
PASS: no-rpath-i386.sh
PASS: no-rpath-ia64.sh
PASS: no-rpath-kfreebsd-amd64.sh
PASS: no-rpath-kfreebsd-i386.sh
PASS: no-rpath-mips.sh
PASS: no-rpath-mipsel.sh
PASS: no-rpath-powerpc.sh
PASS: no-rpath-s390.sh
PASS: no-rpath-sh4.sh
PASS: no-rpath-sparc.sh
========================
1 of 34 tests failed
See tests/test-suite.log
========================
make[3]: *** [test-suite.log] Error 1
make[3]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make[2]: *** [check-TESTS] Error 2
make[2]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/gpfs/home/zuozhangqi/software/patchelf-0.13/tests'
make: *** [check-recursive] Error 1

$ readelf -n ./tests/scratch/build-id//libbuildid.so

Notes at offset 0x00003680 with length 0x00000024:
  Owner		Data size	Description
  GNU		0x00000014	NT_GNU_BUILD_ID (unique build ID bitstring)

$ cat tests/test-suite.log
=========================================
   patchelf 0.13: tests/test-suite.log   
=========================================

1 of 34 tests failed.  

.. contents:: :depth: 2


FAIL: build-id.sh (exit: 1)
===========================

patching ELF file 'scratch/build-id/libbuildid.so'
new rpath is 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
rpath is too long, resizing...
DT_NULL index is 19
replacing section '.dynamic' with size 400
replacing section '.dynstr' with size 1178
this is a dynamic library
last page is 0x1201000
first page is 0x0
needed space is 1704
rewriting section '.dynamic' from offset 0x7c8 (size 384) to offset 0x3000 (size 400)
rewriting section '.dynstr' from offset 0x370 (size 177) to offset 0x3190 (size 1178)
rewriting section '.hash' from offset 0x1b8 (size 80) to offset 0x3630 (size 80)
rewriting section '.note.gnu.build-id' from offset 0x190 (size 36) to offset 0x3680 (size 36)
rewriting symbol table section 1
rewriting symbol table section 29
writing scratch/build-id/libbuildid.so

@VivianoRiccardo
Copy link

same problem

@Mic92
Copy link
Member

Mic92 commented Nov 13, 2021

Also on redhat?

@klemensn
Copy link
Contributor

klemensn commented Dec 6, 2021

This is most likely caused by too old readelf(1) versions not recognising the build id section.

OpenBSD for example still ships an old

$ readelf --version
GNU readelf 2.17
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.

Building patchelf 0.14.3 with

$ cc --version
OpenBSD clang version 11.1.0
Target: amd64-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
$ ld --version
LLD 11.1.0 (compatible with GNU linkers)

correctly adds a build id as per

cc -fpic -O2 -pipe -Wl,--disable-new-dtags -shared -L.  -Wl,--build-id  -o libbuildid.so simple.o  

but readelf does not recognise it:

$  readelf -n libbuildid.so 

Notes at offset 0x000002a8 with length 0x00000018:
  Owner         Data size       Description
  OpenBSD               0x00000004      NT_VERSION (version)

Notes at offset 0x000002c0 with length 0x00000018:
  Owner         Data size       Description
  GNU           0x00000008      Unknown note type: (0x00000003)

That is a .note.gnu.build-id section of type SHT_NOTE using a SHF_ALLOC attribute,
but build-id.sh greps for "Build ID" in above output, hence the failed test.

@Mic92
Copy link
Member

Mic92 commented Dec 6, 2021

I guess we can also grep for Unknown note type: (0x00000003)

@Mic92
Copy link
Member

Mic92 commented Dec 6, 2021

Can you check?

diff --git a/tests/build-id.sh b/tests/build-id.sh
index 45a6c4d..0ac23c7 100755
--- a/tests/build-id.sh
+++ b/tests/build-id.sh
@@ -16,4 +16,5 @@ long_rpath="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 ../src/patchelf \
   --set-rpath "$long_rpath" "${SCRATCH}/libbuildid.so"
 
-readelf -n "${SCRATCH}/libbuildid.so" | grep -q "Build ID"
+# older readelf versions do not recognize build id.
+readelf -n "${SCRATCH}/libbuildid.so" | grep -q -E 'Build ID|Unknown note type: \(0x00000003\)'

@klemensn
Copy link
Contributor

klemensn commented Dec 6, 2021

This makes build-id.sh pass on OpenBSD with GNU readelf 2.17.

Not exactly pretty but it works.
You might as well use grep -q -F -e 'Build ID' -e 'Unknown note type: (0x00000003)' for clarity.

Your call.

Edit: I can only guess that this fixes it for RHEL as per the original issue.

@Mic92
Copy link
Member

Mic92 commented Nov 6, 2022

I assume this one was also fixed.

@Mic92 Mic92 closed this as completed Nov 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants