This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository has been archived by the owner. It is now read-only.
Static TinyCC on Alpine 3.12 i386 #4
Copy link
Copy link
Open
Description
FROM i386/alpine:3.12 as tccbuilder
ARG TCC_COMMIT=3613a11454295ae2da39a5e3bce5159eba2d8c08
# Install the build dependencies
RUN apk add --no-cache make m4 which patch curl pkgconfig \
gcc musl-dev linux-headers
RUN curl -L -o tinycc.tar.gz "https://repo.or.cz/tinycc.git/snapshot/${TCC_COMMIT}.tar.gz" && \
tar -zxvf tinycc.tar.gz && \
cd tinycc-*/ && \
./configure --cpu=x86 --enable-static --config-musl --prefix=/usr/local && \
make && \
make installProduces an error:
Binary directory /usr/local/bin
TinyCC directory /usr/local/lib/tcc
Library directory /usr/local/lib
Include directory /usr/local/include
Manual directory /usr/local/share/man
Info directory /usr/local/share/info
Doc directory /usr/local/share/doc
Source path /tinycc-3613a11
C compiler gcc (9.3)
Target OS Linux
CPU i386
Config static musl
Creating config.mak and config.h
gcc -o tcc.o -c tcc.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o libtcc.o -c libtcc.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o tccpp.o -c tccpp.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o tccgen.o -c tccgen.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o tccelf.o -c tccelf.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o tccasm.o -c tccasm.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o tccrun.o -c tccrun.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o i386-gen.o -c i386-gen.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o i386-link.o -c i386-link.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
gcc -o i386-asm.o -c i386-asm.c -DTCC_TARGET_I386 -DTCC_MUSL -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I.
ar rcs libtcc.a libtcc.o tccpp.o tccgen.o tccelf.o tccasm.o tccrun.o i386-gen.o i386-link.o i386-asm.o
gcc -o tcc tcc.o libtcc.a -lm -lpthread -ldl -s
make[1]: Entering directory '/tinycc-3613a11/lib'
../tcc -c libtcc1.c -o libtcc1.o -B.. -I..
../tcc -c alloca86.S -o alloca86.o -B.. -I..
../tcc -c alloca86-bt.S -o alloca86-bt.o -B.. -I..
../tcc -ar rcs ../libtcc1.a libtcc1.o alloca86.o alloca86-bt.o
../tcc -c bt-exe.c -o ../bt-exe.o -B.. -I..
In file included from bt-exe.c:6:
In file included from ../tccrun.c:21:
In file included from ../tcc.h:30:
In file included from /usr/include/stdio.h:26:
/usr/include/bits/alltypes.h:18: error: incompatible redefinition of 'va_list'
make[1]: *** [Makefile:83: ../bt-exe.o] Error 1
make[1]: Leaving directory '/tinycc-3613a11/lib'
make: *** [Makefile:269: libtcc1.a] Error 2
The offending va_list definitions:
STEP 1: FROM i386/alpine:3.12 AS tccbuilder
STEP 2: ARG TCC_COMMIT=3613a11454295ae2da39a5e3bce5159eba2d8c08
--> Using cache 257ffedd8961c763690cfee14948817972899f8eb2f65037b4c202cf0e06957b
STEP 3: RUN apk add --no-cache make m4 which patch curl pkgconfig gcc musl-dev linux-headers
--> Using cache 2f8980cbf8a73b181604d18d0e05dbb3b957aa65c3eecb817c6442ca527137de
STEP 4: RUN gcc -C -E - < /usr/include/stdio.h | grep va_list
typedef __builtin_va_list va_list;
typedef __builtin_va_list __isoc_va_list;
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
, __isoc_va_list);
int vasprintf(char **, const char *, __isoc_va_list);
Static build
Static build doesn't seem to produce static binary
FROM i386/alpine:3.12 as tccbuilder
ARG TCC_COMMIT=696b765437b4a9213e3883ff416034daaebc891c
# Install the build dependencies
RUN apk add --no-cache make m4 which patch curl pkgconfig \
gcc musl-dev musl-utils linux-headers
ENV CFLAGS="-static"
# TCC doesn't compile because of the old GCC 2.95
# Thus we build TCC statically first, then copy to the container
RUN curl -L -o tinycc.tar.gz "https://repo.or.cz/tinycc.git/snapshot/${TCC_COMMIT}.tar.gz" && \
tar -zxvf tinycc.tar.gz && \
cd tinycc-*/ && \
sed -i "s/#define _VA_LIST_DEFINED/#define __DEFINED_va_list/" include/stdarg.h && \
./configure --cpu=x86 --enable-static --config-musl --prefix=/usr/local && \
make && \
make install
RUN tcc --version
RUN ldd $(which tcc)Gives this
STEP 5: RUN tcc --version
tcc version 0.9.27 (i386 Linux)
--> 74194deb37a
STEP 6: RUN ldd $(which tcc)
/lib/ld-musl-i386.so.1 (0xf7f2e000)
libc.musl-x86.so.1 => /lib/ld-musl-i386.so.1 (0xf7f2e000)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels