Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 737266 - net-libs/gtk-vnc wit sys-libs/musl - continuation.c:(.text+0x6a): undefined reference to `getcontext'
Summary: net-libs/gtk-vnc wit sys-libs/musl - continuation.c:(.text+0x6a): undefined r...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-15 17:07 UTC by Vjaceslavs Klimovs
Modified: 2021-05-08 20:27 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,89.83 KB, text/plain)
2020-08-16 05:24 UTC, Vjaceslavs Klimovs
Details
musl.patch (file_737266.txt,1.12 KB, patch)
2020-09-03 01:19 UTC, tonemgub
Details | Diff
Fix with-coroutine setting for musl users (gtk-vnc-1.0.0-musl-support.patch,609 bytes, patch)
2020-09-08 17:45 UTC, Jory A. Pratt
Details | Diff
Fix musl build (0001-net-libs-gtk-vnc-Fix-musl-build.patch,1.04 KB, patch)
2020-09-08 17:52 UTC, Jory A. Pratt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vjaceslavs Klimovs 2020-08-15 17:07:32 UTC
net-libs/gtk-vnc fails to link in a musl system with following errors:

/usr/lib/gcc/x86_64-gentoo-linux-musl/9.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: src/25a6634@@gvnc-1.0@sha/continuation.c.o: in function `cc_init':
continuation.c:(.text+0x6a): undefined reference to `getcontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/9.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: continuation.c:(.text+0xb5): undefined reference to `makecontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/9.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: src/25a6634@@gvnc-1.0@sha/continuation.c.o: in function `cc_swap':
continuation.c:(.text+0x16f): undefined reference to `getcontext'
/usr/lib/gcc/x86_64-gentoo-linux-musl/9.3.0/../../../../x86_64-gentoo-linux-musl/bin/ld: continuation.c:(.text+0x19d): undefined reference to `swapcontext'
collect2: error: ld returned 1 exit status

Seems like a manifestation of "ucontext.h" problem from
https://wiki.musl-libc.org/open-issues.html.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-08-16 05:20:08 UTC
Please include the full build.log and emerge --info.
Comment 2 Vjaceslavs Klimovs 2020-08-16 05:24:22 UTC
Created attachment 654836 [details]
build.log
Comment 3 Vjaceslavs Klimovs 2020-08-16 05:24:30 UTC
Portage 2.3.103 (python 3.7.8-final-0, default/linux/amd64/17.0/musl/hardened, gcc-9.3.0, musl-1.1.24, 5.4.57-gentoo x86_64)
=================================================================
System uname: Linux-5.4.57-gentoo-x86_64-Intel-R-_Core-TM-2_CPU_P9600_@_2.53GHz-with-gentoo-2.6
KiB Mem:     7890052 total,   5040276 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sat, 15 Aug 2020 16:00:01 +0000
Head commit of repository gentoo: 9e1f33cbd8cb6580511951c39aad7d42a2cbb1db
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p17::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r1::gentoo, 3.7.8-r2::gentoo, 3.8.4-r1::gentoo
dev-util/cmake:           3.16.5::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::musl
sys-devel/gcc:            9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/musl:            1.1.24::gentoo
Repositories:

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

musl
    location: /usr/local/portage/musl
    masters: gentoo

vklimovs
    location: /usr/local/portage/vklimovs
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-march=native -O2"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="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 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 locale.alias"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j3"
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="X acl amd64 bzip2 caps crypt elogind gnome-keyring hardened iconv ipv6 kerberos libglvnd libtirpc ncurses nls nptl openmp pam pcre pie policykit pulseaudio readline seccomp split-usr ssl ssp udisks unicode xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 sse3 sse4_1 ssse3" 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" L10N="en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" RUBY_TARGETS="ruby25" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LANG, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 4 tonemgub 2020-09-03 00:42:54 UTC
Confirming same issue here. Presumably needs some additional patching for musl since GETCONTEXT is a glibc invent.
Comment 5 tonemgub 2020-09-03 01:19:29 UTC
Created attachment 657986 [details, diff]
musl.patch

Not sure this is the "correct" fix, but it works for me. The meson build does not properly check for musl libc and goes down the ucontext path which doesn't exist. This patch just nukes the path. A proper fix for upstream would be to detect it and fallback to gthread.
Comment 6 Jory A. Pratt gentoo-dev 2020-09-08 01:36:10 UTC
(In reply to tonemgub from comment #5)
> Created attachment 657986 [details, diff] [details, diff]
> musl.patch
> 
> Not sure this is the "correct" fix, but it works for me. The meson build
> does not properly check for musl libc and goes down the ucontext path which
> doesn't exist. This patch just nukes the path. A proper fix for upstream
> would be to detect it and fallback to gthread.

This is the wrong way. You could have it use -Dwith-coroutine=gthread with elibc_musl and leave it as -Dwith-coroutine=auto  for everyone else.
Comment 7 Jory A. Pratt gentoo-dev 2020-09-08 17:45:26 UTC
Created attachment 659182 [details, diff]
Fix with-coroutine setting for musl users

I have not fully tested this, but this is the same solution alpine and void linux both use.
Comment 8 Jory A. Pratt gentoo-dev 2020-09-08 17:52:58 UTC
Created attachment 659184 [details, diff]
Fix musl build

Correct syntax, fully tested and working as expected!
Comment 9 Larry the Git Cow gentoo-dev 2021-04-28 04:21:29 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=830c859345812704f6366d4749ad12f1184511f8

commit 830c859345812704f6366d4749ad12f1184511f8
Author:     Jory Pratt <anarchy@gentoo.org>
AuthorDate: 2020-09-08 17:51:55 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2021-04-28 04:19:57 +0000

    net-libs/gtk-vnc: Fix musl build
    
    Closes: https://bugs.gentoo.org/737266
    Signed-off-by: Jory Pratt <anarchy@gentoo.org>
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 net-libs/gtk-vnc/gtk-vnc-1.2.0.ebuild | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Comment 10 Larry the Git Cow gentoo-dev 2021-05-08 20:27:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d14d9c87b3884c9b0ae0c901cc2f44733a91a3c

commit 6d14d9c87b3884c9b0ae0c901cc2f44733a91a3c
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2021-05-08 20:21:36 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2021-05-08 20:27:33 +0000

    net-libs/gtk-vnc: Apply patches from upstream
    
    * Replace Python patch with git formatted patch from upstream
    * Apply patch to fix build with USE="intrspection -vala"
    * Replace musl conditional with patch from upstream
    
        Revert "net-libs/gtk-vnc: Fix musl build"
    
        This reverts commit 830c859345812704f6366d4749ad12f1184511f8.
    
    Bug: https://bugs.gentoo.org/737266
    Closes: https://bugs.gentoo.org/787581
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 ...-build-improve-with-coroutine-auto-choice.patch | 59 ++++++++++++++++++++++
 ...ython-explicitly-to-honor-downstream-pyt.patch} | 12 +++--
 ...onfiguration-failure-with-Dwith-vala-disa.patch | 36 +++++++++++++
 net-libs/gtk-vnc/gtk-vnc-1.2.0.ebuild              | 12 ++---
 4 files changed, 106 insertions(+), 13 deletions(-)