24 lines
599 B
Nix
24 lines
599 B
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
pkgs.mkShell {
|
|
buildInputs = [
|
|
pkgs.pkg-config
|
|
pkgs.gnumake # For running make
|
|
pkgs.gcc_multi # GCC with multi-lib support (32-bit and 64-bit)
|
|
pkgs.glibc_multi
|
|
pkgs.gccMultiStdenv
|
|
pkgs.binutils
|
|
];
|
|
|
|
# Set up environment variables for cross-compilation to 32-bit
|
|
shellHook = ''
|
|
export CC="gcc -m32 -static"
|
|
export CXX="g++ -m32 -static"
|
|
export LD="ld -m elf_i386"
|
|
echo "32-bit cross-compilation environment with static linking is set up."
|
|
git clone https://github.com/rui314/chibicc
|
|
cd chibicc
|
|
make
|
|
'';
|
|
}
|