使用docker gcc编译,静态链接运行时
编写Dockerfile
FROM gcc:13
RUN apt update \
&& apt install gcc clang make ninja-build cmake gdb git -y \
&& apt clean
使用VSCode
- 按F1,输入
从容器中打开
- 选择现有的Dockerfile
Alpine musl clang编译代码
FROM alpine:latest
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk update && apk upgrade \
&& apk add build-base clang cmake make ninja gdb linux-headers git