dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.7k stars 220 forks source link

build-static.sh failed #743

Closed knoppixmeister closed 4 months ago

knoppixmeister commented 4 months ago

What happened?

I got error of build with command

PHP_EXTENSIONS=apcu ./build-static.sh

OS: Ubuntu 22.04.3 PHP version: 8.3.6 installed from ppa/ondrej

GO: go version go1.22.2 linux/amd64 installed from snap repo with command: sudo snap install go --classic

Full log output see in attachment file

output_log.txt

Build Type

Official static build

Worker Mode

No

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

...

Relevant log output

CGO_ENABLED='1'
GOMOD='/home/knoppix/Desktop/frankenphp/caddy/go.mod'
GOWORK=''
CGO_CFLAGS='-DFRANKENPHP_VERSION=fe7d69d01bcd9bc55e57aa972b0b4bf072ec2ef6 -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/ -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php/main -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php/TSRM -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php/Zend -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php/ext -I/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/include/php/ext/date/lib'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='/home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/lib/libbrotlicommon.a /home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/lib/libbrotlienc.a /home/knoppix/Desktop/frankenphp/dist/static-php-cli/buildroot/lib/libbrotlidec.a -lpthread -lpthread -lrt -lrt -lm -ldl -lpthread -lpthread'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1749141751=/tmp/go-build -gno-record-gcc-switches'
+ go build -buildmode=pie -tags cgo netgo osusergo static_build -ldflags -linkmode=external -extldflags '-static-pie -Wl,-z,stack-size=0x80000' -w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP fe7d69d01bcd9bc55e57aa972b0b4bf072ec2ef6 PHP 8.3.6 Caddy' -o ../../dist/frankenphp-linux-x86_64
# github.com/dunglas/frankenphp/caddy/frankenphp
/snap/go/10585/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lphp: No such file or directory
collect2: error: ld returned 1 exit status
7system7 commented 4 months ago

I think this is same as mine #733

dunglas commented 4 months ago

Indeed, thanks @7system7!

Duplicate of https://github.com/dunglas/frankenphp/issues/680. Closed by https://github.com/dunglas/frankenphp/pull/735, which will be in the next release (we're on it).

knoppixmeister commented 4 months ago

UPD:

I tried to follow this instructions: https://frankenphp.dev/docs/embed/#creating-a-binary-for-other-oses

I didn't used docker for build. Just fresh cloned git repo (main branch head) and then issued build-static.sh command

dunglas commented 4 months ago

You need Alpine Linux or at least a proper musl build chain installation to compile locally. It's not easy. I strongly recommend using the Docker image we provide which is specially tailored for this use case.