Skip to content

Commit 841db28

Browse files
committed
remove musl from english docs
1 parent a56414f commit 841db28

File tree

4 files changed

+15
-169
lines changed

4 files changed

+15
-169
lines changed

config/env.ini

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
; PATH: static-php-cli will add `$BUILD_BIN_PATH` to PATH.
2929
; PKG_CONFIG: static-php-cli will set `$BUILD_BIN_PATH/pkg-config` to PKG_CONFIG.
3030
; PKG_CONFIG_PATH: static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH.
31-
;
32-
; * These vars are only be defined in LinuxBuilder and cannot be changed anywhere:
33-
; SPC_LINUX_DEFAULT_CC: the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
34-
; SPC_LINUX_DEFAULT_CXX: the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
35-
; SPC_LINUX_DEFAULT_AR: the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
36-
3731

3832
[global]
3933
; Build concurrency for make -jN, default is CPU_COUNT, this value are used in every libs.

docs/en/develop/system-build-tools.md

Lines changed: 3 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,9 @@ One of the reasons it cannot be statically linked is that its network library `n
3535
For the glibc environment, in static-php-cli and spc in 2.0-RC8 and later, you can choose two ways to build static PHP:
3636

3737
1. Use Docker to build, you can use `bin/spc-alpine-docker` to build, it will build an Alpine Linux docker image.
38-
2. Use `bin/spc doctor --auto-fix` to install the `musl-wrapper` and `musl-cross-make` packages, and then build directly.
38+
2. Use `bin/spc doctor --auto-fix` and then build for glibc directly.
3939
([Related source code](https://github.com/crazywhalecc/static-php-cli/blob/main/src/SPC/doctor/item/LinuxMuslCheck.php))
4040

41-
Generally speaking, the build results in these two environments are consistent, and you can choose according to actual needs.
42-
43-
In the doctor module, static-php-cli will first detect the current Linux distribution.
44-
If the current distribution is a glibc environment, you will be prompted to install the musl-wrapper and musl-cross-make packages.
45-
46-
The process of installing `musl-wrapper` in the glibc environment is as follows:
47-
48-
1. Download the specific version of [musl-wrapper source code](https://musl.libc.org/releases/) from the musl official website.
49-
2. Use `gcc` installed from the package management to compile the musl-wrapper source code and generate `musl-libc` and other libraries: `./configure --disable-gcc-wrapper && make -j && sudo make install`.
50-
3. The musl-wrapper related libraries will be installed in the `/usr/local/musl` directory.
51-
52-
The process of installing `musl-cross-make` in the glibc environment is as follows:
53-
54-
1. Download the precompiled [musl-cross-make](https://dl.static-php.dev/static-php-cli/deps/musl-toolchain/) compressed package from dl.static-php.dev .
55-
2. Unzip to the `/usr/local/musl` directory.
56-
57-
::: tip
58-
In the glibc environment, static compilation can be achieved by directly installing musl-wrapper,
59-
but musl-wrapper only contains `musl-gcc` and not `musl-g++`, which means that C++ code cannot be compiled.
60-
So we need musl-cross-make to provide `musl-g++`.
61-
62-
The reason why the musl-cross-make package cannot be compiled directly locally is that
63-
its compilation environment requirements are relatively high (requires more than 36GB of memory, compiled under Alpine Linux),
64-
so we provide precompiled binary packages that can be used for all Linux distributions.
65-
66-
At the same time, the package management of some distributions provides musl-wrapper,
67-
but musl-cross-make needs to match the corresponding musl-wrapper version,
68-
so we do not use package management to install musl-wrapper.
69-
70-
Compiling musl-cross-make will be introduced in the **musl-cross-make Toolchain Compilation** section of this chapter.
71-
:::
7241

7342
### Musl Environment
7443

@@ -82,133 +51,14 @@ You only need to install basic compilation tools (such as `gcc`, `cmake`, etc.)
8251
For other distributions, if your distribution uses the musl environment,
8352
you can also use static-php-cli to build static PHP directly after installing the necessary compilation tools.
8453

85-
::: tip
86-
In the musl environment, static-php-cli will automatically skip the installation of musl-wrapper and musl-cross-make.
87-
:::
88-
8954
### Docker Environment
9055

91-
The Docker environment refers to using Docker containers to build static PHP. You can use `bin/spc-alpine-docker` to build.
92-
Before executing this command, you need to install Docker first, and then execute `bin/spc-alpine-docker` in the project root directory.
56+
The Docker environment refers to using Docker containers to build static PHP. You can use `bin/spc-alpine-docker` or `bin/spc-gnu-docker` to build.
57+
Before executing this command, you need to install Docker first.
9358

9459
After executing `bin/spc-alpine-docker`, static-php-cli will automatically download the Alpine Linux image and then build a `cwcc-spc-x86_64` or `cwcc-spc-aarch64` image.
9560
Then all build process is performed within this image, which is equivalent to compiling in Alpine Linux.
9661

97-
## musl-cross-make Toolchain Compilation
98-
99-
In Linux, although you do not need to manually compile the musl-cross-make tool,
100-
if you want to understand its compilation process, you can refer here.
101-
Another important reason is that this may not be compiled using automated tools such as CI and Actions,
102-
because the existing CI service compilation environment does not meet the compilation requirements of musl-cross-make,
103-
and the configuration that meets the requirements is too expensive.
104-
105-
The compilation process of musl-cross-make is as follows:
106-
107-
Prepare an Alpine Linux environment (either directly installed or using Docker).
108-
The compilation process requires more than **36GB** of memory,
109-
so you need to compile on a machine with larger memory.
110-
Without this much memory, compilation may fail.
111-
112-
Then write the following content into the `config.mak` file:
113-
114-
```makefile
115-
STAT = -static --static
116-
FLAG = -g0 -Os -Wno-error
117-
118-
ifneq ($(NATIVE),)
119-
COMMON_CONFIG += CC="$(HOST)-gcc ${STAT}" CXX="$(HOST)-g++ ${STAT}"
120-
else
121-
COMMON_CONFIG += CC="gcc ${STAT}" CXX="g++ ${STAT}"
122-
endif
123-
124-
COMMON_CONFIG += CFLAGS="${FLAG}" CXXFLAGS="${FLAG}" LDFLAGS="${STAT}"
125-
126-
BINUTILS_CONFIG += --enable-gold=yes --enable-gprofng=no
127-
GCC_CONFIG += --enable-static-pie --disable-cet --enable-default-pie
128-
#--enable-default-pie
129-
130-
CONFIG_SUB_REV = 888c8e3d5f7b
131-
GCC_VER = 13.2.0
132-
BINUTILS_VER = 2.40
133-
MUSL_VER = 1.2.4
134-
GMP_VER = 6.2.1
135-
MPC_VER = 1.2.1
136-
MPFR_VER = 4.2.0
137-
LINUX_VER = 6.1.36
138-
```
139-
140-
And also you need to add `gcc-13.2.0.tar.xz.sha1` file, contents here:
141-
142-
```
143-
5f95b6d042fb37d45c6cbebfc91decfbc4fb493c gcc-13.2.0.tar.xz
144-
```
145-
146-
If you are using Docker to build, create a new `Dockerfile` file and write the following content:
147-
148-
```dockerfile
149-
FROM alpine:edge
150-
151-
RUN apk add --no-cache \
152-
gcc g++ git make curl perl \
153-
rsync patch wget libtool \
154-
texinfo autoconf automake \
155-
bison tar xz bzip2 zlib \
156-
file binutils flex \
157-
linux-headers libintl \
158-
gettext gettext-dev icu-libs pkgconf \
159-
pkgconfig icu-dev bash \
160-
ccache libarchive-tools zip
161-
162-
WORKDIR /opt
163-
164-
RUN git clone https://git.zv.io/toolchains/musl-cross-make.git
165-
WORKDIR /opt/musl-cross-make
166-
COPY config.mak /opt/musl-cross-make
167-
COPY gcc-13.2.0.tar.xz.sha1 /opt/musl-cross-make/hashes
168-
169-
RUN make TARGET=x86_64-linux-musl -j || :
170-
RUN sed -i 's/poison calloc/poison/g' ./gcc-13.2.0/gcc/system.h
171-
RUN make TARGET=x86_64-linux-musl -j
172-
RUN make TARGET=x86_64-linux-musl install -j
173-
RUN tar cvzf x86_64-musl-toolchain.tgz output/*
174-
```
175-
176-
If you are using Alpine Linux in a non-Docker environment, you can directly execute the commands in the Dockerfile, for example:
177-
178-
```bash
179-
apk add --no-cache \
180-
gcc g++ git make curl perl \
181-
rsync patch wget libtool \
182-
texinfo autoconf automake \
183-
bison tar xz bzip2 zlib \
184-
file binutils flex \
185-
linux-headers libintl \
186-
gettext gettext-dev icu-libs pkgconf \
187-
pkgconfig icu-dev bash \
188-
ccache libarchive-tools zip
189-
190-
git clone https://git.zv.io/toolchains/musl-cross-make.git
191-
# Copy config.mak to the working directory of musl-cross-make.
192-
# You need to replace /path/to/config.mak with your config.mak file path.
193-
cp /path/to/config.mak musl-cross-make/
194-
cp /path/to/gcc-13.2.0.tar.xz.sha1 musl-cross-make/hashes
195-
196-
make TARGET=x86_64-linux-musl -j || :
197-
sed -i 's/poison calloc/poison/g' ./gcc-13.2.0/gcc/system.h
198-
make TARGET=x86_64-linux-musl -j
199-
make TARGET=x86_64-linux-musl install -j
200-
tar cvzf x86_64-musl-toolchain.tgz output/*
201-
```
202-
203-
::: tip
204-
All the above scripts are suitable for x86_64 architecture Linux.
205-
If you need to build musl-cross-make for the ARM environment, just replace all `x86_64` above with `aarch64`.
206-
:::
207-
208-
This compilation process may fail due to insufficient memory, network problems, etc.
209-
You can try a few more times, or use a machine with larger memory to compile.
210-
If you encounter problems or you have better improvement solutions, go to [Discussion](https://github.com/crazywhalecc/static-php-cli-hosted/issues/1).
211-
21262
## macOS Environment
21363

21464
For macOS systems, the main compilation tool we use is `clang`,

docs/en/guide/manual-build.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ During the compilation process, in some special cases,
335335
the compiler and the content of the compilation directory need to be intervened.
336336
You can try to use the following commands:
337337

338-
- `--cc=XXX`: Specifies the execution command of the C language compiler (Linux default `musl-gcc` or `gcc`, macOS default `clang`)
338+
- `--cc=XXX`: Specifies the execution command of the C language compiler (Linux default `gcc`, macOS default `clang`)
339339
- `--cxx=XXX`: Specifies the execution command of the C++ language compiler (Linux defaults to `g++`, macOS defaults to `clang++`)
340340
- `--with-clean`: clean up old make files before compiling PHP
341341
- `--enable-zts`: Make compiled PHP thread-safe version (default is NTS version)
@@ -657,8 +657,7 @@ By default, static-php uses the following compilers on different systems:
657657

658658
- macOS: `clang`
659659
- Linux (Alpine Linux): `gcc`
660-
- Linux (glibc based distros, x86_64): `/usr/local/musl/bin/x86_64-linux-musl-gcc`
661-
- Linux (glibc based distros, aarch64): `/usr/local/musl/bin/aarch64-linux-musl-gcc`
660+
- Linux (glibc based distros): `gcc`
662661
- FreeBSD: `clang`
663662

664663
Here is an example of using embed SAPI:
@@ -692,8 +691,10 @@ echo "Hello world!\n";
692691
```
693692

694693
```bash
695-
# compile in debian/ubuntu x86_64
696-
/usr/local/musl/bin/x86_64-linux-musl-gcc embed.c $(bin/spc spc-config bcmath,zlib) -static -o embed
694+
# compile in Alpine
695+
gcc embed.c $(bin/spc spc-config bcmath,zlib) -static -o embed
696+
# compile in glibc distros
697+
gcc embed.c $(bin/spc spc-config bcmath,zlib) -o embed
697698
# compile in macOS/FreeBSD
698699
clang embed.c $(bin/spc spc-config bcmath,zlib) -o embed
699700

docs/zh/guide/manual-build.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
292292

293293
在编译过程中,有些特殊情况需要对编译器、编译目录的内容进行干预,可以尝试使用以下命令:
294294

295-
- `--cc=XXX`: 指定 C 语言编译器的执行命令(Linux 默认 `musl-gcc` 或 `gcc`,macOS 默认 `clang`)
295+
- `--cc=XXX`: 指定 C 语言编译器的执行命令(Linux 默认 `gcc`,macOS 默认 `clang`)
296296
- `--cxx=XXX`: 指定 C++ 语言编译器的执行命令(Linux 默认 `g++`,macOS 默认 `clang++`)
297297
- `--with-clean`: 编译 PHP 前先清理旧的 make 产生的文件
298298
- `--enable-zts`: 让编译的 PHP 为线程安全版本(默认为 NTS 版本)
@@ -592,8 +592,7 @@ bin/spc spc-config curl,zlib,phar,openssl --includes
592592

593593
- macOS: `clang`
594594
- Linux (Alpine Linux): `gcc`
595-
- Linux (glibc based distros, x86_64): `/usr/local/musl/bin/x86_64-linux-musl-gcc`
596-
- Linux (glibc based distros, aarch64): `/usr/local/musl/bin/aarch64-linux-musl-gcc`
595+
- Linux (glibc based distros): `gcc`
597596
- FreeBSD: `clang`
598597

599598
下面是一个使用 embed SAPI 的例子:
@@ -627,8 +626,10 @@ echo "Hello world!\n";
627626
```
628627

629628
```bash
630-
# compile in debian/ubuntu x86_64
631-
/usr/local/musl/bin/x86_64-linux-musl-gcc embed.c $(bin/spc spc-config bcmath,zlib) -static -o embed
629+
# compile in Alpine
630+
gcc embed.c $(bin/spc spc-config bcmath,zlib) -static -o embed
631+
# compile in glibc distros
632+
gcc embed.c $(bin/spc spc-config bcmath,zlib) -o embed
632633
# compile in macOS/FreeBSD
633634
clang embed.c $(bin/spc spc-config bcmath,zlib) -o embed
634635

0 commit comments

Comments
 (0)