Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 817377 - dev-lang/php: modules: Error relocating
Summary: dev-lang/php: modules: Error relocating
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PHP Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-10 15:35 UTC by Alexander Miroshnichenko
Modified: 2021-10-11 11:26 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Miroshnichenko 2021-10-10 15:35:10 UTC
php fails to load any module with Error relocating error

Reproducible: Always

Steps to Reproduce:
1. install gentoo linux with musl libc
2. install php any module, opcache for example.
3. php fails to load module
Actual Results:  
$ php -v
Failed loading /usr/lib/php8.0/lib/opcache.so:  Error relocating /usr/lib/php8.0/lib/opcache.so: concat_function: initial-exec TLS resolves to dynamic definition in /usr/lib/php8.0/lib/opcache.so
PHP 8.0.11 (cli) (built: Oct  7 2021 23:21:17) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies


$ ldd /usr/lib/php8.0/lib/opcache.so
	ldd (0x6cacb207b000)
	libc.so => ldd (0x6cacb207b000)
Error relocating /usr/lib/php8.0/lib/opcache.so: convert_to_array: symbol not found
Error relocating /usr/lib/php8.0/lib/opcache.so: _erealloc: symbol not found
...
Error relocating /usr/lib/php8.0/lib/opcache.so: mul_function: symbol not found

Expected Results:  
Load module with no error.

Portage 3.0.4 (python 3.7.8-final-0, default/linux/amd64/17.0/musl/hardened/selinux, gcc-10.3.0, musl-1.2.2-r3, 5.10.52 x86_64)
=================================================================
System uname: Linux-5.10.52-x86_64-AMD_A10_Micro-6700T_APU+AMD_Radeon_R6_Graphics-with-gentoo-2.6
KiB Mem:     8080140 total,   3584460 free
KiB Swap:          0 total,         0 free

Timestamp of repository gentoo: Sat, 09 Oct 2021 15:58:54 +0000
Head commit of repository gentoo: 7d9e331fac3b8186c7c1fbb3d96c23e71f34fda9

Timestamp of repository libressl: Sat, 02 Oct 2021 22:36:24 +0000
Head commit of repository libressl: e242fc3205fc6337d51d0c9ecf13688f3c2288f1

Timestamp of repository musl: Sat, 09 Oct 2021 15:58:03 +0000
Head commit of repository musl: 2e00972292449944e252e1acf6033fa7917ead02

sh bash 5.0_p17
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
ccache version 3.7.10 [disabled]
app-shells/bash:          5.0_p17::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          3.7.8-r2::gentoo, 3.9.6_p1::gentoo
dev-lang/rust:            1.44.1::gentoo
dev-util/ccache:          3.7.10::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.69-r5::gentoo
sys-devel/automake:       1.16.2-r1::gentoo
sys-devel/binutils:       2.37_p1::gentoo
sys-devel/gcc:            10.3.0-r2::musl
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.2.2-r3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://git.millerson.name/millerson.name/gentoo-mirror.git
    priority: 50

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

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-march=btver2 -O3    "
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/php/apache2-php8.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=btver2 -O3    "
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=2 "
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 candy cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer mount-sandbox network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox selinux sesandbox sfperms splitdebug 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"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
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"
RUSTFLAGS="-C target-feature=-crt-static"
USE="acl amd64 argon2 audi audit bcrypt bzip2 caps cgroups cracklib crypt dkim efi filecaps gnupg graphite hardened https iconv iproute2 ipv6 leaps_timezone libbsd libglvnd libressl libtirpc llvm lucene lxc lz4 lzma lzo managesieve mmx ncurses netlink nettle nfsv4 nfsv41 nightly nls nptl openmp pam parallel-compiler pcre pcre16 pgo pie postgres readline seccomp selinux sieve split-usr srs srs-native sse sse2 ssl ssp system-bootstrap system-llvm threads udev unicode xattr xdg xfs xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2019" 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="aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" CURL_SSL="gnutls" 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" GRUB_PLATFORMS="efi-64 multiboot pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="BPF X86 WebAssembly" LUA_SINGLE_TARGET="luajit" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" QEMU_SOFTMMU_TARGETS="x86_64" QEMU_USER_TARGETS="x86_64" 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, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Brian Evans Gentoo Infrastructure gentoo-dev 2021-10-10 20:36:20 UTC
(In reply to Alexander Miroshnichenko from comment #0)
> php fails to load any module with Error relocating error
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. install gentoo linux with musl libc
> 2. install php any module, opcache for example.
> 3. php fails to load module
> Actual Results:  
> $ php -v
> Failed loading /usr/lib/php8.0/lib/opcache.so:  Error relocating
> /usr/lib/php8.0/lib/opcache.so: concat_function: initial-exec TLS resolves
> to dynamic definition in /usr/lib/php8.0/lib/opcache.so
> PHP 8.0.11 (cli) (built: Oct  7 2021 23:21:17) ( ZTS )
> Copyright (c) The PHP Group
> Zend Engine v4.0.11, Copyright (c) Zend Technologies
> 
> 
> $ ldd /usr/lib/php8.0/lib/opcache.so
> 	ldd (0x6cacb207b000)
> 	libc.so => ldd (0x6cacb207b000)
> Error relocating /usr/lib/php8.0/lib/opcache.so: convert_to_array: symbol
> not found
> Error relocating /usr/lib/php8.0/lib/opcache.so: _erealloc: symbol not found
> ...
> Error relocating /usr/lib/php8.0/lib/opcache.so: mul_function: symbol not
> found

How is PHP built? Where did this opcache.so come from?

Opcache should never be a shared module under Gentoo.  It is hard coded into the binary when enabled (by default at that as well).
Comment 2 Alexander Miroshnichenko 2021-10-11 10:01:19 UTC
(In reply to Brian Evans from comment #1)
> (In reply to Alexander Miroshnichenko from comment #0)
> > php fails to load any module with Error relocating error
> > 
> > Reproducible: Always
> > 
> > Steps to Reproduce:
> > 1. install gentoo linux with musl libc
> > 2. install php any module, opcache for example.
> > 3. php fails to load module
> > Actual Results:  
> > $ php -v
> > Failed loading /usr/lib/php8.0/lib/opcache.so:  Error relocating
> > /usr/lib/php8.0/lib/opcache.so: concat_function: initial-exec TLS resolves
> > to dynamic definition in /usr/lib/php8.0/lib/opcache.so
> > PHP 8.0.11 (cli) (built: Oct  7 2021 23:21:17) ( ZTS )
> > Copyright (c) The PHP Group
> > Zend Engine v4.0.11, Copyright (c) Zend Technologies
> > 
> > 
> > $ ldd /usr/lib/php8.0/lib/opcache.so
> > 	ldd (0x6cacb207b000)
> > 	libc.so => ldd (0x6cacb207b000)
> > Error relocating /usr/lib/php8.0/lib/opcache.so: convert_to_array: symbol
> > not found
> > Error relocating /usr/lib/php8.0/lib/opcache.so: _erealloc: symbol not found
> > ...
> > Error relocating /usr/lib/php8.0/lib/opcache.so: mul_function: symbol not
> > found
> 
> How is PHP built? Where did this opcache.so come from?

# qlist -IUe php
dev-lang/php acl argon2 bcmath bzip2 cli ctype curl embed fileinfo filter flatfile fpm gd gmp iconv imap intl ipv6 jit nls opcache pdo phar posix postgres readline selinux session simplexml spell sqlite ssl threads tokenizer truetype unicode xml xmlreader xmlwriter zip zlib

Opcache is part of php (when opcache USE flag enabled), but it builds as loadable module:

# qlist -e php|grep opcache.so
/usr/lib/php8.0/lib/opcache.so

# qfile /usr/lib/php8.0/lib/opcache.so
dev-lang/php: /usr/lib/php8.0/lib/opcache.so

Same issue with any other modules:

# qlist -IU dev-php/pecl-imagick
dev-php/pecl-imagick php_targets_php8-0

# qlist -e dev-php/pecl-imagick|grep imagick.so
/usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so


# ldd /usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so
	ldd (0x69993f532000)
	libgomp.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-musl/10.3.0/libgomp.so.1 (0x69993f481000)
	libMagickWand-7.Q16.so.7 => /usr/lib/libMagickWand-7.Q16.so.7 (0x69993f378000)
	libMagickCore-7.Q16.so.7 => /usr/lib/libMagickCore-7.Q16.so.7 (0x69993f107000)
	libc.so => ldd (0x69993f532000)
	libbz2.so.1 => /lib/libbz2.so.1 (0x69993f0ef000)
	libz.so.1 => /lib/libz.so.1 (0x69993f0d1000)
	libltdl.so.7 => //usr/lib/libltdl.so.7 (0x69993eec7000)
Error relocating /usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so: add_next_index_bool: symbol not found
Error relocating /usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so: _php_stream_cast: symbol not found
Error relocating /usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so: add_assoc_zval_ex: symbol not found
Error relocating /usr/lib/php8.0/lib/extensions/no-debug-zts-20200930/imagick.so: zend_declare_class_constant_string: symbol not found
...

> Opcache should never be a shared module under Gentoo.  It is hard coded into
> the binary when enabled (by default at that as well).

I don't know what to say. In my gentoo installation opcache builds as shared module with php.