Error building libc_2.27-3ubuntu1.6 on Ubuntu 18.04 AMD64

Asked by alex-mobigo

I need to build the package libc_2.27-3ubuntu1.6 to be used in gdb but it fails to complete the build.
I can partially use the source code built but when telling gdb where the source code is, gdb still doesn't find some other functions.
if can find open() but can't find printf() although csu has been compiled, at least i can find the ".o"

Here is the error: https://pastebin.ubuntu.com/p/n2ppycNYtd/

It seems to build using x86_64-linux-gnu-gcc-7 , but i have a recent gcc version installed.

x86_64-linux-gnu-gcc --version
x86_64-linux-gnu-gcc (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0
Copyright (C) 2018 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.

Is there a way to tell dpkg-buildpackage to configure for x86_64-linux-gnu-gcc-8 and what is the exact command to use for the build?

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu glibc Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

What exactly do you want to do?

There is debug information available with the original Ubuntu packages, e.g. https://launchpad.net/ubuntu/+archive/primary/+files/libc6-dbg_2.27-3ubuntu1.6_amd64.deb

In my opinion it makes more sense to switch your build environment to the same status as it was with the original build (i.e. gcc 7), than trying to reconfigure the package to allow building with gcc 8.
see e.g. https://linuxconfig.org/how-to-switch-between-multiple-gcc-and-g-compiler-versions-on-ubuntu-20-04-lts-focal-fossa

Revision history for this message
alex-mobigo (alex-mobigo) said :
#2

Thanks for the answer.

"What exactly do you want to do?"

I want to build libc_2.27-3ubuntu1.6 package. It does not matter if with gcc-7 or gcc-8.
The build failed as per the error reported.

I have already installed the dbg, but it did not help to solve my problem, which is to debug libc6 with gdb.
I solved my problem by creating a symlink to the source code, but the source code must be patched by the build system. And the build fails to complete.

So i just want to build the package so i know the source code has been patched.
Or if you know a way to just fire dpkg-buildpackage with only the first process that is to patch the code will be fine.

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

"I want to build libc_2.27-3ubuntu1.6 package."
Why do you want to build a new copy? The package already exists in the repositories.

Which patch do you want to apply (or check whether it is applied)?
If you want to debug libc6, why do you then try building libc?

One of the error messages is a missing ndbm.h file.
That should be provided by libgdbm-compat-dev
Do you have that package installed?

Revision history for this message
alex-mobigo (alex-mobigo) said :
#4

"Why do you want to build a new copy? The package already exists in the repositories."
I need the source code in sync with :
rwxr-xr-x 1 root root 15873680 mai 3 07:19 /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so

"Do you have that package installed?"
No, thank you, i missed that, will do a rebuild and see.

The ubuntu package should enforce libgdbm-compat-dev, which does not.

Ubuntu/debian patch set:
git-updates.diff
git-updates-2.diff

locale/check-unknown-symbols.diff
locale/locale-print-LANGUAGE.diff
locale/LC_IDENTIFICATION-optional-fields.diff
localedata/local-all-no-archive.diff
localedata/sort-UTF8-first.diff
localedata/supported.diff
localedata/locale-eu_FR.diff
localedata/locale-ku_TR.diff
localedata/fo_FO-date_fmt.diff
localedata/locales_CH.diff
localedata/locales-fr.diff
localedata/locale-en_DK.diff
localedata/locale-csb_PL.diff
localedata/locale-zh_TW.diff
localedata/locale-se_NO.diff
localedata/tailor-iso14651_t1.diff
localedata/submitted-bz9725-locale-sv_SE.diff
localedata/locale-C.diff
localedata/submitted-en_AU-date_fmt.diff
localedata/submitted-es_MX-decimal_point.diff
localedata/submitted-it_IT-thousands_sep.diff

alpha/local-gcc4.1.diff
alpha/submitted-dl-support.diff
alpha/local-string-functions.diff
alpha/submitted-fts64.diff
alpha/submitted-makecontext.diff

arm/local-sigaction.diff
arm/unsubmitted-ldconfig-cache-abi.diff
arm/unsubmitted-ldso-abi-check.diff
arm/local-soname-hack.diff
arm/local-vfp-sysdeps.diff
arm/unsubmitted-ldso-multilib.diff
arm/local-arm-futex.diff

hppa/local-inlining.diff

hurd-i386/local-enable-ldconfig.diff
hurd-i386/tg-context_functions.diff
hurd-i386/git-tls.diff
hurd-i386/git-tls-threadvar.diff
hurd-i386/tg-sysvshm.diff
hurd-i386/git-_dl_random.diff
hurd-i386/tg-thread-cancel.diff
hurd-i386/tg-bigmem.diff
hurd-i386/local-disable-ioctls.diff
hurd-i386/tg-locarchive.diff
hurd-i386/tg-sendmsg-SCM_RIGHTS.diff
hurd-i386/tg-sendmsg-SCM_CREDS.diff
hurd-i386/git-grantpt.diff
hurd-i386/tg-mach-hurd-link.diff
hurd-i386/local-ED.diff
hurd-i386/tg-posix_thread.diff
hurd-i386/git-gai_misc.diff
hurd-i386/local-madvise_warn.diff
hurd-i386/tg-hurdsig-fixes.diff
hurd-i386/tg-hurdsig-global-dispositions.diff
hurd-i386/local-hurdsig-global-dispositions-version.diff
hurd-i386/tg-hurdsig-SA_SIGINFO.diff
hurd-i386/tg-hurdsig-fixes-2.diff
hurd-i386/tg-hooks.diff
hurd-i386/cvs-libpthread.diff
hurd-i386/cvs-libpthread.abilist.diff
hurd-i386/libpthread_build.diff
hurd-i386/tg-libpthread_depends.diff
hurd-i386/libpthread_version.diff
hurd-i386/local-usr.diff
hurd-i386/tg-hurdsig-boot-fix.diff
hurd-i386/tg-single-select-timeout.diff
hurd-i386/tg-setitimer.diff
hurd-i386/tg-pie-sbrk.diff
hurd-i386/tg-ifaddrs_v6.diff
hurd-i386/tg-remap_getcwd.diff
hurd-i386/git-exec-static.diff
hurd-i386/tg-EIEIO-fr.diff
hurd-i386/tg-EGREGIOUS-fr.diff
hurd-i386/tg-io_select_timeout.diff
hurd-i386/tg-poll_errors_fixes.diff
hurd-i386/unsubmitted-clock_t_centiseconds.diff
hurd-i386/submitted-path_mounted.diff
hurd-i386/tg-socket_flags.diff
hurd-i386/tg-socketpair_flags.diff
hurd-i386/tg-pipe2.diff
hurd-i386/tg-libc_getspecific.diff
hurd-i386/git-futimens.diff
hurd-i386/tg-sigstate_thread_reference.diff
hurd-i386/git-tls_thread_leak.diff
hurd-i386/submitted-bind_umask2.diff
hurd-i386/git-libpthread-stacksize.diff
hurd-i386/tg-WRLCK-upgrade.diff
hurd-i386/git-reboot-startup.diff
hurd-i386/cvs-revert-gnu-gnu-cleanup.diff
hurd-i386/libpthread_pthread_types.diff
hurd-i386/tg-bootstrap.diff
hurd-i386/local-mach_print.diff
hurd-i386/git-hurd-abilist.diff
#hurd-i386/submitted-anon-mmap-shared.diff
hurd-i386/tg-eintr.diff
hurd-i386/tg-gsync-libc.diff
hurd-i386/tg-pthread_deps.diff
hurd-i386/git-libpthread-gsync-spin.diff
hurd-i386/tg-ONSTACK.diff
hurd-i386/git-libpthread-gsync-mutex.diff
hurd-i386/git-NOFOLLOW.diff
hurd-i386/git-NOFOLLOW-DIRECTORY.diff
hurd-i386/tg-libc_rwlock_recursive.diff
hurd-i386/tg-magic-pid.diff
hurd-i386/git-mlockall.diff
hurd-i386/local-no_unsupported_ioctls.diff
hurd-i386/git2.25-tls.diff
hurd-i386/local-nocheck-installed-headers.diff
hurd-i386/git-libpthread-2.26.diff
hurd-i386/git-thread-linkspace.diff
hurd-i386/libpthread_includes.diff
hurd-i386/local-exec_filename.diff
hurd-i386/git-libpthread-trylock.diff
hurd-i386/git-test-atexit-race-common.diff
hurd-i386/git-UTIME.diff
#hurd-i386/libpthread_sigs.diff

i386/local-biarch.diff
i386/unsubmitted-quiet-ldconfig.diff

kfreebsd/submitted-waitid.diff
kfreebsd/submitted-auxv.diff
kfreebsd/local-config_h_in.patch
kfreebsd/local-grantpt.diff
kfreebsd/local-sysdeps.diff
kfreebsd/local-fbtl.diff
kfreebsd/local-fbtl-depends.diff
kfreebsd/local-scripts.diff
kfreebsd/local-getaddrinfo-freebsd-kernel.diff
kfreebsd/local-no-execfn.diff

m68k/local-dwarf2-buildfix.diff
m68k/local-reloc.diff
m68k/submitted-gcc34-seccomment.diff

mips/submitted-rld_map.diff

powerpc/local-powerpc8xx-dcbz.diff

sh4/local-fpscr_values.diff

sparc/submitted-sparc64-socketcall.diff

all/branch-pthread_rwlock_trywrlock-hang-23844.patch
all/local-alias-et_EE.diff
all/local-remove-manual.diff
all/local-ru_RU.diff
all/local-ldd.diff
all/local-nis-shadow.diff
all/submitted-po-fr-fixes.diff

any/local-rtlddir-cross.diff
any/local-asserth-decls.diff
any/local-bindresvport_blacklist.diff
any/local-fhs-linux-paths.diff
any/local-fhs-nscd.diff
any/local-ld-multiarch.diff
any/local-ldso-disable-hwcap.diff
any/local-ldconfig.diff
any/local-ldconfig-fsync.diff
any/local-nss-upgrade.diff
any/local-stubs_h.diff
any/local-tcsetaddr.diff
any/local-tst-mktime2.diff
any/local-nss-overflow.diff
any/submitted-missing-etc-hosts.diff
any/submitted-bits-fcntl_h-at.diff
any/submitted-nptl-invalid-td.patch
any/local-ldconfig-multiarch.diff
any/local-disable-libnss-db.diff
any/local-revert-bz13979.diff
any/local-tst-eintr1-eagain.diff
any/unsubmitted-ldso-machine-mismatch.diff
any/unsubmitted-dlopen-static-crash.diff
any/local-ldconfig-ignore-ld.so.diff
any/local-libpic.diff
any/local-bootstrap-headers.diff
any/submitted-resolv-unaligned.diff
any/submitted-intl-tstgettext.diff
any/local-cudacc-float128.diff

# Ubuntu patches live in their own little world, to maintain sanity
ubuntu/local-altlocaledir.diff
ubuntu/local-disable-ld_audit.diff
ubuntu/local-disable-nscd-netgroup-caching.diff
ubuntu/submitted-no-sprintf-pre-truncate.diff
ubuntu/localedata/ckb_IQ-new_locale.diff
ubuntu/localedata/en_IE-am_pm.diff
ubuntu/localedata/eo_US.diff
ubuntu/localedata/es_DO-am_pm.diff
ubuntu/localedata/lv_LV-currency.diff
ubuntu/localedata/git-pt-fmt.diff
ubuntu/localedata/sd_PK.diff
<email address hidden>
any/CVE-2019-9169.patch
any/CVE-2020-1751.patch
any/CVE-2020-1752.patch
any/CVE-2020-10029-1.patch
any/CVE-2020-10029-2.patch
ubuntu/test-make-preadwritev2-invalid-flag-unsupported.patch
any/CVE-2016-10228-pre1.patch
any/CVE-2016-10228-1.patch
any/CVE-2016-10228-2.patch
any/CVE-2019-25013.patch
any/CVE-2020-27618.patch
any/CVE-2020-6096-3.patch
any/CVE-2020-6096-4.patch
any/CVE-2021-3326.patch
any/CVE-2021-35942.patch
any/CVE-2021-3999.patch
any/CVE-2022-23218-pre1.patch
any/CVE-2022-23218.patch
any/CVE-2022-23219.patch
any/CVE-2020-29562.patch
any/fix_test-errno-linux.patch

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

"The ubuntu package should enforce libgdbm-compat-dev, which does not."

Apparently libgdbm-compat-dev isn't really necessary. The buildlog of the package in the Ubuntu repositories https://launchpad.net/ubuntu/+source/glibc/2.27-3ubuntu1.6/+build/23736951 does not show that it is installed and the buildlog shows the same "fatal error: ndbm.h: No such file or directory #include <ndbm.h>" errors, but continues building the package.

In any case the build-dependencies clearly state a dependency on g++-7

With respect to the patches: from the buildlog:

dpkg-source: info: extracting glibc in /<<PKGBUILDDIR>>
dpkg-source: info: unpacking glibc_2.27.orig.tar.xz
dpkg-source: info: unpacking glibc_2.27-3ubuntu1.6.debian.tar.xz
dpkg-source: info: applying git-updates.diff
dpkg-source: info: applying git-updates-2.diff
dpkg-source: info: applying locale/check-unknown-symbols.diff
dpkg-source: info: applying locale/locale-print-LANGUAGE.diff
dpkg-source: info: applying locale/LC_IDENTIFICATION-optional-fields.diff
dpkg-source: info: applying localedata/local-all-no-archive.diff
...
dpkg-source: info: applying any/CVE-2022-23218.patch
dpkg-source: info: applying any/CVE-2022-23219.patch
dpkg-source: info: applying any/CVE-2020-29562.patch
dpkg-source: info: applying any/fix_test-errno-linux.patch

That is 100% in line with the list in your previous comment (except those few that are commented out with a hash sign).

Revision history for this message
alex-mobigo (alex-mobigo) said (last edit ):
#6

Thank you for pointing to the buildlog file
Launchpad:
Summary of test results:
   5742 PASS
     24 UNSUPPORTED
     16 XFAIL
     12 XPASS

local build:
Summary of test results:FAIL: nptl/test-cond-printers
FAIL: nptl/test-condattr-printers
FAIL: nptl/test-mutex-printers
FAIL: nptl/test-mutexattr-printers
FAIL: nptl/test-rwlock-printers
FAIL: nptl/test-rwlockattr-printers

      7 FAIL
   5736 PASS
     23 UNSUPPORTED
     16 XFAIL
     12 XPASS

I don't have a buildlog, but i can see these errors on screen:
FAIL: intl/tst-gettext
FAIL: nptl/test-cond-printers
FAIL: nptl/test-condattr-printers
FAIL: nptl/test-mutex-printers
FAIL: nptl/test-mutexattr-printers
FAIL: nptl/test-rwlock-printers
FAIL: nptl/test-rwlockattr-printers

Searching for some of the errors:

FAIL: nptl/test-rwlock-printers
original exit status 1

Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xb42: file test-rwlock-printers.c, line 33.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)

but it is built:
ls -la /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
-rwxr-xr-x 1 root root 57296 jun 8 21:39 /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers

file /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
/apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /apps/libc6/glibc-2.27/build-tree/amd64-libc/elf/ld.so, for GNU/Linux 3.2.0, BuildID[sha1]=db4e609e09f64d3f712ecf7aa4194ad72d547b12, with debug_info, not stripped

OBS:
printing the result from test-rwlock-printers.c:
./test-rwlock-printers
result: 0

So, the problem is with the script!. No idea where and how to fix it.

FAIL: intl/tst-gettext
original exit status 1

test `gettext' with LANGUAGE set
test `gettext' with LANGUAGE set
test `dgettext' with LANGUAGE set
test `gettext' with LC_ALL set
test `gettext' with LC_ALL deciding
test `dgettext' with LC_ALL deciding
test `gettext' with LC_MESSAGES set
test `gettext' with LC_MESSAGES deciding
test `dgettext' with LC_MESSAGES deciding
test `dcgettext' with category == LC_MESSAGES
test `dcgettext' with LANGUAGE == LC_TIME
test `dcgettext' with LANGUAGE == LC_NUMERIC
tst-gettext.c:214: setlocale (LC_ALL, ""): No such file or directory
test `gettext' with LANG set
test `gettext' with LANG set
test `dgettext' with LANG set

the locale error seems to be an easy fix
i have to figure out why and how to fix the nptl errors, any idea?

Revision history for this message
alex-mobigo (alex-mobigo) said :
#7

I tried to run without clean in hoping the script would find the files, but no.

----------
FAIL: nptl/test-cond-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xa92: file test-cond-printers.c, line 33.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-cond-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-cond-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------
----------
FAIL: nptl/test-condattr-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xb72: file test-condattr-printers.c, line 40.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-condattr-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-condattr-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------
----------
FAIL: nptl/test-mutex-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xd52: file test-mutex-printers.c, line 42.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-mutex-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-mutex-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------
----------
FAIL: nptl/test-mutexattr-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xcc2: file test-mutexattr-printers.c, line 49.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-mutexattr-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-mutexattr-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------
----------
FAIL: nptl/test-rwlock-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xb42: file test-rwlock-printers.c, line 33.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlock-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------
----------
FAIL: nptl/test-rwlockattr-printers
original exit status 1
Error: Response does not match the expected pattern.
Command: start
Expected pattern: main
Response: Temporary breakpoint 1 at 0xb62: file test-rwlockattr-printers.c, line 42.
Starting program: /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlockattr-printers
warning: Cannot exec /bin/bash -e
warning: -c
warning: exec /apps/libc6/glibc-2.27/build-tree/amd64-libc/nptl/test-rwlockattr-printers
warning: Error: No such file or directory

During startup program exited with code 127.
(gdb)
----------

All files are there, would you know which script calls for these tests?

Revision history for this message
alex-mobigo (alex-mobigo) said :
#8

Looks like something is wrong with the script test_printers_common.py , would you know how to disable this test?

I cheated the test and the build bypassed the error.

except pexpect.ExceptionPexpect as exception:
    print('Error: {0}'.format(exception))
    exit(PASS)

The newbie question, do i have to have a printer installed? What could be wrong with the script?

Can you help with this problem?

Provide an answer of your own, or ask alex-mobigo for more information if necessary.

To post a message you must log in.