rizin icon indicating copy to clipboard operation
rizin copied to clipboard

rz-gg: Cannot find 'gcc' on windows 11

Open dotslashinit-sh opened this issue 1 month ago • 3 comments

Work environment

Questions Answers
OS/arch/bits (mandatory) Windows 11 25H2 Build 26200.6899 x64
File format of the file you reverse (mandatory) (not exactly reversing, but tried compiling a c file)
Architecture/bits of the file (mandatory) (tried compiling to x86)
rizin -v full output, not truncated (mandatory) rizin 0.8.1 @ windows-x86-64 commit: c009cb739ca4fd289e634c2bea432d1e7bcd3676

Expected behavior

The shellcode should be compiled and given as output.

Actual behavior

'gcc' -fPIC -fPIE -pie -fpic -m32 -fno-stack-protector -nostdinc -include 'C:\Users\abinr\Desktop\Tools\rizin-win-installer-clang_cl-64\include\librz/sflib'/'windows-x86-32'/sflib.h -z execstack -fomit-frame-pointer -finline-functions -fno-zero-initialized-in-bss -o 'shellcode.c.tmp' -S 'shellcode.c'

''gcc'' is not recognized as an internal or external command,
operable program or batch file.
ERROR: egg: failure while parsing 'shellcode.c'
ERROR: rz-gg: cannot load file "shellcode.c"

Steps to reproduce the behavior

  • Tried to follow the official guide from here.
  • shellcode.c contents
int main() {
    write(1, "Hello World\n", 13);
    return 0;
}
  • Command used to compile: rz-gg -a x86 -b32 shellcode.c
  • The following command gives the same error: rz-gg -z -o out.h -kw32 shellcode.c

Additional Logs, screenshots, source code, configuration dump, ...

  • Output of gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/Users/abinr/Desktop/Tools/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/15.2.0/lto-wrapper.exe
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/R/winlibs_staging_ucrt64/inst_gcc-15.2.0/share/gcc --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-offload-targets=nvptx-none --with-pkgversion='MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r3' --with-tune=generic --enable-checking=release --enable-threads=posix --disable-sjlj-exceptions --disable-libunwind-exceptions --disable-serial-configure --disable-bootstrap --enable-host-shared --enable-plugin --disable-default-ssp --disable-rpath --disable-libstdcxx-debug --disable-version-specific-runtime-libs --disable-symvers --enable-languages=c,c++,fortran,lto,objc,obj-c++ --disable-gold --disable-nls --disable-stage1-checking --disable-win32-registry --disable-multilib --enable-ld --enable-libquadmath --enable-libada --enable-libssp --enable-libstdcxx --enable-lto --enable-fully-dynamic-string --enable-libgomp --enable-graphite --enable-mingw-wildcard --enable-libstdcxx-time --enable-libstdcxx-pch --with-mpc=/c/Prog/winlibs_staging_ucrt/custombuilt64 --with-mpfr=/c/Prog/winlibs_staging_ucrt/custombuilt64 --with-gmp=/c/Prog/winlibs_staging_ucrt/custombuilt64 --with-isl=/c/Prog/winlibs_staging_ucrt/custombuilt64 --disable-libstdcxx-backtrace --enable-install-libiberty --enable-__cxa_atexit --without-included-gettext --with-diagnostics-color=auto --enable-clocale=generic --enable-libgdiagnostics --with-libiconv --with-system-zlib --with-build-sysroot=/R/winlibs_staging_ucrt64/gcc-15.2.0/build_mingw/mingw-w64 CFLAGS='-I/c/Prog/winlibs_staging_ucrt/custombuilt64/include/libdl-win32   -march=nocona -msahf -mtune=generic -O2 -Wno-error=format' CXXFLAGS='-Wno-int-conversion  -march=nocona -msahf -mtune=generic -O2' LDFLAGS='-pthread -Wl,--no-insert-timestamp -Wl,--dynamicbase -Wl,--high-entropy-va -Wl,--nxcompat -Wl,--tsaware' LD=/c/Prog/winlibs_staging_ucrt/custombuilt64/share/binutils/bin/ld.exe
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r3)

EDIT: I accidently typed x64 instead of x86

dotslashinit-sh avatar Nov 09 '25 07:11 dotslashinit-sh

Same issue for rz-gg -a x64 -b64 shellcode.c

dotslashinit-sh avatar Nov 09 '25 08:11 dotslashinit-sh

The issue is in the latest commit too:

rizin 0.9.0 @ windows-x86-64
commit: ef21a25cc995e2e0e2276f46fd64586554bae254

dotslashinit-sh avatar Nov 09 '25 08:11 dotslashinit-sh

I tried changing the mingw thread model to win32 and it still exists: output for 'gcc -v'

Using built-in specs.
COLLECT_GCC=C:\Users\abinr\Desktop\Tools\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/Users/abinr/Desktop/Tools/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/15.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-15.2.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/buildroot/x86_64-1520-win32-seh-ucrt-rt_v13-rev0/mingw64 --enable-host-shared --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=win32 --enable-libstdcxx-threads=yes --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-mingw-wildcard --enable-fully-dynamic-string --enable-version-specific-runtime-libs --enable-libstdcxx-filesystem-ts=yes --disable-libssp --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/buildroot/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-win32-seh-rev0, Built by MinGW-Builds project' --with-bugurl=https://github.com/niXman/mingw-builds LD_FOR_TARGET=/c/buildroot/x86_64-1520-win32-seh-ucrt-rt_v13-rev0/mingw64/bin/ld.exe --with-boot-ldflags='-pipe -fno-ident -L/c/buildroot/x86_64-1520-win32-seh-ucrt-rt_v13-rev0/mingw64/opt/lib -L/c/buildroot/prerequisites/x86_64-zlib-static/lib -L/c/buildroot/prerequisites/x86_64-w64-mingw32-static/lib  -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc'
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 15.2.0 (x86_64-win32-seh-rev0, Built by MinGW-Builds project)

dotslashinit-sh avatar Nov 09 '25 08:11 dotslashinit-sh