Auto binfmt Messing Things Up
Docker shouldn't break, but depending on what kernel it's running under, and what the host system exposes to it, it will.
tl;dr: the automatic binfmt_misc handling for Wine / CLR / Mono will seriously screw with you
at times, and it apparently crosses Docker container boundaries where the host system binfmt
handling will interfere with the guest system execution.
You can assimilate the cosmocc executables:
assimilating: /home/max/cosmocc/bin/make
assimilating: /home/max/cosmocc/bin/x86_64-linux-cosmo-objcopy
assimilating: /home/max/cosmocc/bin/aarch64-linux-cosmo-nm
assimilating: /home/max/cosmocc/bin/aarch64-linux-cosmo-ar
assimilating: /home/max/cosmocc/bin/zipcopy
assimilating: /home/max/cosmocc/bin/mkdeps
assimilating: /home/max/cosmocc/bin/aarch64-linux-cosmo-ranlib
assimilating: /home/max/cosmocc/bin/ar.ape
assimilating: /home/max/cosmocc/bin/aarch64-linux-cosmo-size
assimilating: /home/max/cosmocc/bin/aarch64-linux-cosmo-strip
assimilating: /home/max/cosmocc/bin/x86_64-linux-cosmo-ar
assimilating: /home/max/cosmocc/bin/apelink
assimilating: /home/max/cosmocc/bin/cosmoinstall
/home/max/cosmocc/bin/cosmoinstall: not an actually portable executable (the host os uses elf natively)
retrying: /home/max/cosmocc/bin/cosmoinstall
/home/max/cosmocc/bin/cosmoinstall: not an actually portable executable (the host os uses elf natively)
warning: /home/max/cosmocc/bin/cosmoinstall is still a POSIX shell script after assimilation
assimilating: /home/max/cosmocc/bin/sha256sum.ape
assimilating: /home/max/cosmocc/bin/gzip.ape
assimilating: /home/max/cosmocc/bin/cosmoaddr2line
/home/max/cosmocc/bin/cosmoaddr2line: not an actually portable executable (the host os uses elf natively)
retrying: /home/max/cosmocc/bin/cosmoaddr2line
/home/max/cosmocc/bin/cosmoaddr2line: not an actually portable executable (the host os uses elf natively)
warning: /home/max/cosmocc/bin/cosmoaddr2line is still a POSIX shell script after assimilation
assimilating: /home/max/cosmocc/bin/compile.ape
assimilating: /home/max/cosmocc/bin/march-native
When running the cosmocc executable on CachyOS, it still breaks.
$ ./build.sh
make: Entering directory '/home/max'
mkdir -p build
/home/max/cosmocc/bin/cosmocc -O2 -Wall -Wextra -std=c11 -o build/ga ga.c
00f4:fixme:wineusb:add_usb_device Interface 1 has 8 alternate settings; using the first one.
00f4:fixme:wineusb:add_usb_device Interface 3 has 8 alternate settings; using the first one.
00bc:fixme:wineusb:query_id Unhandled ID query type 0x5.
00bc:fixme:wineusb:query_id Unhandled ID query type 0x5.
00bc:fixme:wineusb:query_id Unhandled ID query type 0x5.
...
01a0:fixme:file:server_get_file_info Unsupported info class 1c
01a0:fixme:file:server_get_file_info Unsupported info class 1c
0170:fixme:file:server_get_file_info Unsupported info class 1c
0170:fixme:file:server_get_file_info Unsupported info class 1c
/tmp/fatcosmocc.miyuayctkvsa1.com.dbg: Invalid argument
make: *** [Makefile:26: build/ga] Error 1
make: Leaving directory '/home/max'
Wine starts automatically and then explodes.
Disabling Wine alone doesn't fix the issue, Mono / CLR still trips.
$ ./wine-disable.sh
Disabling: /proc/sys/fs/binfmt_misc/DOSWin
[sudo] password for max:
Disabled 1 Wine binfmt handler(s). State saved to /home/max/wine-binfmt-disabled.
[2.994s] --> [0]
$ ./build.sh
make: Entering directory '/home/max'
/home/max//cosmocc/bin/cosmocc -O2 -Wall -Wextra -std=c11 -o build/ga ga.c
Cannot open assembly '/home/max/cosmocc/bin/../libexec/gcc/x86_64-linux-cosmo/14.1.0/cc1': File does not contain a valid CIL image.
make: *** [Makefile:26: build/ga] Error 1
make: Leaving directory '/home/max'
[0.036s] --> [0]
Then also disable Mono / CLR:
$ ./wine-disable.sh
Disabling: /proc/sys/fs/binfmt_misc/CLR
[sudo] password for max:
Disabling: /proc/sys/fs/binfmt_misc/DOSWin
Disabled 2 MZ binfmt handler(s) (Wine/Mono/CLR). State saved to /home/max/wine-binfmt-disabled.
Then the build finally works, because binfmt doesn't step in and mess things up.
$ ./build.sh
make: Entering directory '/home/max'
/home/max/cosmocc/bin/cosmocc -O2 -Wall -Wextra -std=c11 -o build/ga ga.c
Build complete → build/ga
make: Leaving directory '/home/max'
Inside VirtualBox Ubuntu 26.04:
root@cd38549bbd18:/opt/cosmocc/bin# ./mktemper
mktemper: missing argument
root@cd38549bbd18:/opt/cosmocc/bin# head -10 mktemper
MZqFpD='
@' <<'justine5fn41z'
x
���:6)v0�A�P1��X�̉����t��������W��&���_�����&�����������t@t␦��1�0��p�o�ƃ� ��Ou��'SR��s1��rF������1��r3�r-�π�?���������1��ƾ���������������X��[�Z��1��r��PQ������1۰��YXr��:$v
QV���&�^Y��É���tRV1ɱʬ^
��Z��BIy����������U�
justine5fn41z
#'"
o=$(command -v "$0")
[ x"$1" != x--assimilate ] && type ape >/dev/null 2>&1 && exec ape "$o" "$@"
t="${TMPDIR:-${HOME:-.}}/.ape-1.10"
root@cd38549bbd18:/opt/cosmocc/bin# md5sum -b mktemper
91c36f5aa878e70697caed78633c9ecf *mktemper
root@cd38549bbd18:/opt/cosmocc/bin# uname -a
Linux cd38549bbd18 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64 GNU/Linux
Inside Host CachyOS:
root@ecc55be3242e:/opt/cosmocc/bin# ./mktemper
bash: ./mktemper: cannot execute: required file not found
root@ecc55be3242e:/opt/cosmocc/bin# head -10 mktemper
MZqFpD='
@' <<'justine5fn41z'
x
���:6)v0�A�P1��X�̉����t��������W��&���_�����&�����������t@t␦��1�0��p�o�ƃ� ��Ou��'SR��s1��rF������1��r3�r-�π�?���������1��ƾ���������������X��[�Z��1��r��PQ������1۰��YXr��:$v
QV���&�^Y��É���tRV1ɱʬ^
��Z��BIy����������U�
justine5fn41z
#'"
o=$(command -v "$0")
[ x"$1" != x--assimilate ] && type ape >/dev/null 2>&1 && exec ape "$o" "$@"
t="${TMPDIR:-${HOME:-.}}/.ape-1.10"
root@ecc55be3242e:/opt/cosmocc/bin# md5sum -b mktemper
91c36f5aa878e70697caed78633c9ecf *mktemper
root@ecc55be3242e:/opt/cosmocc/bin# uname -a
Linux ecc55be3242e 7.0.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 17 May 2026 17:23:07 +0000 x86_64 GNU/Linux
- ← Previous
The Greatest Trick - Next →
Benchmarking armv8 Instruction Sets