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

Cannot compile podman on gentoo musl amd64 (undefined reference to TEMP_FAILURE_RETRY) #12563

Closed
Darkness4 opened this issue Dec 10, 2021 · 3 comments · Fixed by #12564
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Darkness4
Copy link
Contributor

Darkness4 commented Dec 10, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I tried to emerge app-emulation/podman-3.4.3 with no success on Gentoo Hardened Musl amd64. The USE flags were USE="fuse rootless -apparmor -btrfs (-selinux)".

I also tried to do it manually using the git repository with the tag v3.4.4 and I cannot compile podman because the file pkg/rootless/rootless_linux.c is using TEMP_FAILURE_RETRY before it is declared.

I confirm that I can emerge app-emulation/podman-3.4.2.

Steps to reproduce the issue:

  1. Install Gentoo Hardened Musl amd64

  2. eselect repository enable musl (I have added the musl overlay to be able to install sys-libs/lvm2 on musl.

  3. emerge --ask sys-libs/argp-standalone app-emulation/crun sys-libs/lvm2::musl app-emulation/podman

Describe the results you received:

build.log :

#
# ... (hidden here because it isn't that interesting)
#
# github.com/containers/podman/v3/pkg/rootless
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: $WORK/b337/_x003.o: in function `cleanup_closep':
pkg/rootless/rootless_linux.c:38: undefined reference to `TEMP_FAILURE_RETRY'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: pkg/rootless/rootless_linux.c:38: undefined reference to `TEMP_FAILURE_RETRY'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: pkg/rootless/rootless_linux.c:38: undefined reference to `TEMP_FAILURE_RETRY'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: pkg/rootless/rootless_linux.c:38: undefined reference to `TEMP_FAILURE_RETRY'
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: pkg/rootless/rootless_linux.c:38: undefined reference to `TEMP_FAILURE_RETRY'
collect2: error: ld returned 1 exit status
# github.com/containers/podman/v3/pkg/rootless
rootless_linux.c: In function 'cleanup_closep':
rootless_linux.c:38:5: warning: implicit declaration of function 'TEMP_FAILURE_RETRY' [-Wimplicit-function-declaration]
   38 |     TEMP_FAILURE_RETRY (close (*pp));
      |     ^~~~~~~~~~~~~~~~~~
#
# ...
#
make: *** [Makefile:298: bin/podman] Error 2
 * ERROR: app-emulation/podman-3.4.3::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=app-emulation/podman-3.4.3::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-emulation/podman-3.4.3::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-emulation/podman-3.4.3/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-emulation/podman-3.4.3/temp/environment'.
 * Working directory: '/var/tmp/portage/app-emulation/podman-3.4.3/work/podman-3.4.3'
 * S: '/var/tmp/portage/app-emulation/podman-3.4.3/work/podman-3.4.3'

Describe the results you expected:

I wonder if this is because TEMP_FAILURE_RETRY is declared after the usage ?

TEMP_FAILURE_RETRY is used at L38. Since on musl TEMP_FAILURE_RETRY is not declared, I believe this was the fix ?

#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(expression) \
(__extension__ \
({ long int __result; \
do __result = (long int) (expression); \
while (__result == -1L && errno == EINTR); \
__result; }))
#endif

So I guess you have to move it at L25 to fix the problem ?

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

`emerge --info '=app-emulation/podman-3.4.3::gentoo'`
Portage 3.0.29 (python 3.9.9-final-0, default/linux/amd64/17.0/musl/hardened, gcc-11.2.1, musl-1.2.2-r7, 5.10.60.1-microsoft-standard-WSL2 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.10.60.1-microsoft-standard-WSL2-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-libc
KiB Mem:     6080944 total,   2849548 free
KiB Swap:    2097152 total,   2097152 free
Timestamp of repository gentoo: Fri, 10 Dec 2021 00:00:01 +0000
Head commit of repository gentoo: 958790f46cc2003ce747a387a19712fcd5e6eb33
Timestamp of repository musl: Wed, 08 Dec 2021 01:49:40 +0000
Head commit of repository musl: c56d4de42936ee10046fa45061cd04dee99eda18

sh bash 5.1_p12
ld GNU ld (Gentoo 2.37_p1 p1) 2.37
app-shells/bash:          5.1_p12::gentoo
dev-lang/perl:            5.34.0-r5::gentoo
dev-lang/python:          3.9.9::gentoo, 3.10.1::gentoo
dev-util/cmake:           3.22.1::gentoo
sys-apps/baselayout:      2.8::gentoo
sys-apps/openrc:          0.44.9::gentoo
sys-apps/sandbox:         2.29::gentoo
sys-devel/autoconf:       2.71-r1::gentoo
sys-devel/automake:       1.16.5::gentoo
sys-devel/binutils:       2.37_p1-r1::gentoo
sys-devel/gcc:            11.2.1_p20211127::gentoo
sys-devel/gcc-config:     2.5-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.15-r1::gentoo (virtual/os-headers)
sys-libs/musl:            1.2.2-r7::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts:
    sync-rsync-verify-max-age: 24

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -pipe"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 bzip2 crypt hardened iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp pam pcre pie readline seccomp split-usr ssl ssp unicode xattr xtpax zlib zsh-completion" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
@mheon
Copy link
Member

mheon commented Dec 13, 2021

While this was fixed, I will note that we strongly recommend using glibc, not musl - Podman uses some features of POSIX mutexes (for multiprocess memory safety) that musl does not implement, which can lead to deadlocks when musl is in use (we had an issue about this previously, but I can't locate it).

@M1cha
Copy link

M1cha commented Nov 15, 2022

@mheon was the deadlock fixed? Podman is used on popular non-glibc distributions like alpine(musl). A go project that's not portable would be sad 😁

@mheon
Copy link
Member

mheon commented Nov 15, 2022

Podman has made, and will make, no changes to this. We absolutely require multiprocess memory safety for mutexes; if we don't have it, our locking doesn't work.

I do see references to PTHREAD_PROCESS_SHARED and PTHREAD_MUTEX_ROBUST in the musl source, so it's possible support has been added over there; not sure. They don't mention any specific incompatibilities regarding mutexes on their page.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants