static-build (manually, dockerfile with intl) not working #236
Description
I was trying to test frankenphp with ldap and c++ extensions (which were only compilable on musl-libc based systems before) but ran into error messages, so I attempted building from the spc/main branch, but ran into the same problem. So I tried to run the dockerfile and lo and behold, it also errors out, albeit with different problems.
The local errors somewhat make sense:
Local:
[root@alma static-php-cli]./bin/spc build intl,openssl,ldap,snappy,mbstring,mbregex,apcu,calendar,curl,dom,exif,fileinfo,iconv,xml,mysqli,pdo_mysql,pdo,sysvsem,sodium,zlib,zip,opcache,pcntl --build-embed --enable-zts --debug
...
*** Warning: Linking the shared library libphp.la against the
*** static library /opt/static-php-cli/buildroot/lib/libzip.a is not portable!
*** Warning: Linking the shared library libphp.la against the
*** static library /opt/static-php-cli/buildroot/lib/libxml2.a is not portable!
...
*** Warning: Linking the shared library libphp.la against the
*** static library /opt/static-php-cli/buildroot/lib/libicudata.a is not portable!
libtool: link: warning: library `/usr/local/musl/x86_64-linux-musl/lib/libstdc++.la' was moved.
copying selected object files to avoid basename conflicts...
Installing PHP SAPI module: embed
[11:48:15] [INFO] Build complete, used 50.985 s !
[11:48:15] [DEBU] Removing path recursively: "/opt/static-php-cli/buildroot/license"
[11:48:15] [DEBU] scanning directory /opt/static-php-cli/buildroot/license
[11:48:15] [DEBU] Making new directory recursive: /opt/static-php-cli/buildroot/license
[11:48:15] [INFO] License path: /opt/static-php-cli/buildroot/license/
...
[root@alma frankenphp]# CGO_CFLAGS="$(/opt/static-main/buildroot/bin/php-config --includes | sed s#-I/#-I/opt/static-main/buildroot/#g)" CGO_LDFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(/opt/static-main/buildroot/bin/php-config --ldflags) $(/opt/static-main/buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g') -L/usr/local/musl/lib -L /usr/local/musl/x86_64-linux-musl/lib" LIBPHP_VERSION="$(/opt/static-main/buildroot/bin/php-config --version)" go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -s -w -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $LIBPHP_VERSION Caddy'"
# github.com/dunglas/frankenphp/caddy/frankenphp
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /opt/static-main/buildroot/lib/libphp.a(spl_exceptions.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /opt/static-main/buildroot/lib/libphp.a(head.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /opt/static-main/buildroot/lib/libphp.a(url.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: /opt/static-main/buildroot/lib/libphp.a(TSRM.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIE
... about 500 more lines like this
Docker:
[root@alma frankenphp-main] docker buildx bake --load --set static-builder.args.PHP_EXTENSIONS=intl,openssl,ldap,snappy,mbstring,mbregex,apcu,calendar,curl,dom,exif,fileinfo,iconv,xml,mysqli,pdo_mysql,pdo,sysvsem,sodium,zlib,zip,opcache,pcntl static-builder
... (spc build succeeds)
=> CANCELED [stage-0 1/17] RUN apk update; apk add --no-cache autoconf automake bas 0.8s
ERROR: failed to solve: Canceled: context canceled
[root@alma frankenphp-main]# docker buildx bake --load --set static-builder.args.PHP_EXTENSIONS=intl,openssl,ldap,snappy,mbstring,mbregex,apcu,calendar,curl,dom,exif,fileinfo,iconv,xml,mysqli,pdo_mysql,pdo,sysvsem,sodium,zlib,zip,opcache,pcntl static-builder
[+] Building 377.3s (25/25) FINISHED docker:default
=> [internal] load build definition from static-builder.Dockerfile 0.0s
=> => transferring dockerfile: 2.90kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 186B 0.0s
=> resolve image config for docker.io/docker/dockerfile:1 0.4s
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50 0.0s
=> [context golang-base] load metadata for golang:1.21-alpine 0.4s
=> [internal] load metadata for docker.io/composer/composer:2-bin 0.4s
=> CACHED [context golang-base] golang:1.21-alpine 0.2s
=> => resolve docker.io/library/golang:1.21-alpine 0.2s
=> [internal] load build context 0.0s
=> => transferring context: 2.11kB 0.0s
=> CACHED FROM docker.io/composer/composer:2-bin@sha256:9eddaebb35d548fa0d40d079477ca0eb2e4e82762f29e98ec29d5eac 0.0s
=> [stage-0 1/17] RUN apk update; apk add --no-cache autoconf automake bash 6.4s
=> [stage-0 2/17] COPY --from=composer/composer:2-bin --link /composer /usr/bin/composer 0.0s
=> [stage-0 3/17] WORKDIR /static-php-cli 0.0s
=> [stage-0 4/17] RUN git clone --depth=1 https://github.com/crazywhalecc/static-php-cli . && composer inst 1.7s
=> [stage-0 5/17] RUN --mount=type=secret,id=github-token GITHUB_TOKEN=$(cat /run/secrets/github-token) ./bin 125.1s
=> [stage-0 6/17] RUN ./bin/spc build --build-embed --enable-zts "intl,openssl,ldap,snappy,mbstring,mbregex,a 195.8s
=> [stage-0 7/17] WORKDIR /go/src/app 0.0s
=> [stage-0 8/17] COPY go.mod go.sum ./ 0.0s
=> [stage-0 9/17] RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get 2.6s
=> [stage-0 10/17] RUN mkdir caddy && cd caddy 0.1s
=> [stage-0 11/17] COPY caddy/go.mod caddy/go.sum ./caddy/ 0.0s
=> [stage-0 12/17] RUN cd caddy && go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get 31.5s
=> [stage-0 13/17] COPY *.* ./ 0.0s
=> [stage-0 14/17] COPY caddy caddy 0.0s
=> [stage-0 15/17] COPY C-Thread-Pool C-Thread-Pool 0.0s
=> ERROR [stage-0 16/17] RUN cd caddy/frankenphp && CGO_CFLAGS="$(/static-php-cli/buildroot/bin/php-config 12.7s
------
> [stage-0 16/17] RUN cd caddy/frankenphp && CGO_CFLAGS="$(/static-php-cli/buildroot/bin/php-config --includes | sed s#-I/#-I/static-php-cli/buildroot/#g)" CGO_LDFLAGS="-DFRANKENPHP_VERSION=dev $(/static-php-cli/buildroot/bin/php-config --ldflags) $(/static-php-cli/buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g')" LIBPHP_VERSION="$(/static-php-cli/buildroot/bin/php-config --version)" go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -s -w -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP dev PHP $LIBPHP_VERSION Caddy'" && ./frankenphp version:
12.58 # github.com/dunglas/frankenphp/caddy/frankenphp
12.58 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_decimalquantity.ao):(.data.rel.ro._ZTIN6icu_736number4impl15DecimalQuantityE[_ZTIN6icu_736number4impl15DecimalQuantityE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_fluent.ao):(.data.rel.ro._ZTIN6icu_736number4impl13EmptyModifierE[_ZTIN6icu_736number4impl13EmptyModifierE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_longnames.ao):(.data.rel.ro._ZTIN6icu_736number4impl15LongNameHandlerE[_ZTIN6icu_736number4impl15LongNameHandlerE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_longnames.ao):(.data.rel.ro._ZTIN6icu_736number4impl24MixedUnitLongNameHandlerE[_ZTIN6icu_736number4impl24MixedUnitLongNameHandlerE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_longnames.ao):(.data.rel.ro._ZTIN6icu_736number4impl19LongNameMultiplexerE[_ZTIN6icu_736number4impl19LongNameMultiplexerE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(number_mapper.ao):(.data.rel.ro._ZTIN6icu_736number4impl30PropertiesAffixPatternProviderE[_ZTIN6icu_736number4impl30PropertiesAffixPatternProviderE]+0x0): more undefined references to `vtable for __cxxabiv1::__vmi_class_type_info' follow
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (&)()>(std::once_flag&, void (&)())::{lambda()#1}>(void (&)())::{lambda()#1}::_FUN()':
12.58 umutex.cpp:(.text._ZZNSt9once_flag18_Prepare_executionC4IZSt9call_onceIRFvvEJEEvRS_OT_DpOT0_EUlvE_EERS6_ENUlvE_4_FUNEv[_ZZNSt9once_flag18_Prepare_executionC4IZSt9call_onceIRFvvEJEEvRS_OT_DpOT0_EUlvE_EERS6_ENUlvE_4_FUNEv]+0x3): undefined reference to `std::__once_callable'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `umtx_init':
12.58 umutex.cpp:(.text.umtx_init+0x37): undefined reference to `std::condition_variable::condition_variable()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `umtx_cleanup':
12.58 umutex.cpp:(.text.umtx_cleanup+0xc): undefined reference to `std::condition_variable::~condition_variable()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `icu_73::UMutex::getMutex()':
12.58 umutex.cpp:(.text._ZN6icu_736UMutex8getMutexEv+0x5a): undefined reference to `std::__once_callable'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_736UMutex8getMutexEv+0x6c): undefined reference to `std::__once_call'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_736UMutex8getMutexEv+0x8e): undefined reference to `__once_proxy'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_736UMutex8getMutexEv+0x11d): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_736UMutex8getMutexEv+0x124): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `umtx_lock_73':
12.58 umutex.cpp:(.text.umtx_lock_73+0x3a): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `icu_73::umtx_initImplPreInit(icu_73::UInitOnce&)':
12.58 umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x10): undefined reference to `std::__once_callable'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x17): undefined reference to `std::__once_call'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x4a): undefined reference to `__once_proxy'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0xbb): undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x115): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x11f): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7320umtx_initImplPreInitERNS_9UInitOnceE+0x126): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(umutex.ao): in function `icu_73::umtx_initImplPostInit(icu_73::UInitOnce&)':
12.58 umutex.cpp:(.text._ZN6icu_7321umtx_initImplPostInitERNS_9UInitOnceE+0x47): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7321umtx_initImplPostInitERNS_9UInitOnceE+0x4e): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: umutex.cpp:(.text._ZN6icu_7321umtx_initImplPostInitERNS_9UInitOnceE+0x3d): undefined reference to `std::condition_variable::notify_all()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::setEvictionPolicy(int, int, UErrorCode&)':
12.58 unifiedcache.cpp:(.text._ZN6icu_7312UnifiedCache17setEvictionPolicyEiiR10UErrorCode+0x6c): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::unusedCount() const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache11unusedCountEv+0x3e): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::autoEvictedCount() const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache16autoEvictedCountEv+0x35): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::keyCount() const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache8keyCountEv+0x3b): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::flush() const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache5flushEv+0x178): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao):unifiedcache.cpp:(.text._ZN6icu_7312UnifiedCacheD2Ev+0x138): more undefined references to `std::__throw_system_error(int)' follow
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `unifiedcache_cleanup':
12.58 unifiedcache.cpp:(.text.unifiedcache_cleanup+0x56): undefined reference to `std::condition_variable::~condition_variable()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::getInstance(UErrorCode&)':
12.58 unifiedcache.cpp:(.text._ZN6icu_7312UnifiedCache11getInstanceER10UErrorCode+0xda): undefined reference to `std::condition_variable::condition_variable()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::handleUnreferencedObject() const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache24handleUnreferencedObjectEv+0x3a): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::_poll(icu_73::CacheKeyBase const&, icu_73::SharedObject const*&, UErrorCode&) const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode+0x149): undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode+0x231): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache5_pollERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode+0x238): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::_put(UHashElement const*, icu_73::SharedObject const*, UErrorCode) const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache4_putEPK12UHashElementPKNS_12SharedObjectE10UErrorCode+0x4d): undefined reference to `std::condition_variable::notify_all()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache4_putEPK12UHashElementPKNS_12SharedObjectE10UErrorCode+0x7a): undefined reference to `std::condition_variable::notify_all()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache4_putEPK12UHashElementPKNS_12SharedObjectE10UErrorCode+0x91): undefined reference to `std::condition_variable::notify_all()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifiedcache.ao): in function `icu_73::UnifiedCache::_putIfAbsentAndGet(icu_73::CacheKeyBase const&, icu_73::SharedObject const*&, UErrorCode&) const':
12.58 unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache18_putIfAbsentAndGetERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode+0xba): undefined reference to `std::condition_variable::notify_all()'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: unifiedcache.cpp:(.text._ZNK6icu_7312UnifiedCache18_putIfAbsentAndGetERKNS_12CacheKeyBaseERPKNS_12SharedObjectER10UErrorCode+0x209): undefined reference to `std::__throw_system_error(int)'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(numparse_validators.ao):(.data.rel.ro._ZTIN6icu_738numparse4impl21RequireAffixValidatorE[_ZTIN6icu_738numparse4impl21RequireAffixValidatorE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(numparse_validators.ao):(.data.rel.ro._ZTIN6icu_738numparse4impl24RequireCurrencyValidatorE[_ZTIN6icu_738numparse4impl24RequireCurrencyValidatorE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(numparse_validators.ao):(.data.rel.ro._ZTIN6icu_738numparse4impl32RequireDecimalSeparatorValidatorE[_ZTIN6icu_738numparse4impl32RequireDecimalSeparatorValidatorE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(numparse_validators.ao):(.data.rel.ro._ZTIN6icu_738numparse4impl22RequireNumberValidatorE[_ZTIN6icu_738numparse4impl22RequireNumberValidatorE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicui18n.a(numparse_validators.ao):(.data.rel.ro._ZTIN6icu_738numparse4impl22MultiplierParseHandlerE[_ZTIN6icu_738numparse4impl22MultiplierParseHandlerE]+0x0): undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info'
12.58 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /static-php-cli/buildroot/lib/pkgconfig/../../lib/libicuuc.a(unifilt.ao):(.data.rel.ro._ZTIN6icu_7313UnicodeFilterE[_ZTIN6icu_7313UnicodeFilterE]+0x0): more undefined references to `vtable for __cxxabiv1::__vmi_class_type_info' follow
12.58 collect2: error: ld returned 1 exit status
12.58
------
static-builder.Dockerfile:78
--------------------
77 |
78 | >>> RUN cd caddy/frankenphp && \
79 | >>> CGO_CFLAGS="$(/static-php-cli/buildroot/bin/php-config --includes | sed s#-I/#-I/static-php-cli/buildroot/#g)" \
80 | >>> CGO_LDFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(/static-php-cli/buildroot/bin/php-config --ldflags) $(/static-php-cli/buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g')" \
81 | >>> LIBPHP_VERSION="$(/static-php-cli/buildroot/bin/php-config --version)" \
82 | >>> go build -buildmode=pie -tags "cgo netgo osusergo static_build" -ldflags "-linkmode=external -extldflags -static-pie -s -w -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $LIBPHP_VERSION Caddy'" && \
83 | >>> ./frankenphp version
84 |
--------------------
ERROR: failed to solve: process "/bin/sh -c cd caddy/frankenphp && CGO_CFLAGS=\"$(/static-php-cli/buildroot/bin/php-config --includes | sed s#-I/#-I/static-php-cli/buildroot/#g)\" CGO_LDFLAGS=\"-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $(/static-php-cli/buildroot/bin/php-config --ldflags) $(/static-php-cli/buildroot/bin/php-config --libs | sed -e 's/-lgcc_s//g')\" LIBPHP_VERSION=\"$(/static-php-cli/buildroot/bin/php-config --version)\" go build -buildmode=pie -tags \"cgo netgo osusergo static_build\" -ldflags \"-linkmode=external -extldflags -static-pie -s -w -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $LIBPHP_VERSION Caddy'\" && ./frankenphp version" did not complete successfully: exit code: 1
Questions:
a) did you run into the same -fPIE error messages before or is that maybe specific to RHEL distros?
b) did you run into the same *** Warning: Linking the shared library libphp.la against the *** static library /opt/static-php-cli/buildroot/lib/libldap.a is not portable!
message at some point and if so, how did you fix it?
c) did you try compiling static frankenphp on non-alpine before?
d) it's the intl extension (icu lib) causing docker to fail compiling, but I see intl listed in the extensions it would build by default.