radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.19k stars 2.96k forks source link

Windows 10 build in git failed #18896

Closed bluebanana2021 closed 2 years ago

bluebanana2021 commented 3 years ago

Environment

# copypaste this script into your shell and replace it with the output
Mon Jul 12 06:28:34     2021
bash: r2: command not found
MINGW64_NT-10.0-19043 x86_64

Description

Using git build in Windows 10 (Japanese language) failed at libsdb creation step.

Test

git clone https://github.com/radare/radare2
cd radare2
sys/install.sh

WARNING: Updating from remote repository
Already up to date.
/c/Users/<user>/radare2
configure-plugins: Loading ./plugins.cfg ..
configure-plugins: Generating libr/config.h
configure-plugins: Generating libr/asm/d/config.inc
configure-plugins: Generating libr/config.mk
SHARED: io.shm
STATIC: anal.6502 anal.6502_cs anal.8051 anal.amd29k anal.arc anal.arm_cs anal.rm_gnu anal.avr anal.bf anal.chip8 anal.cr16 anal.cris anal.dalvik anal.ebc ana.gb anal.h8300 anal.hexagon anal.i4004 anal.i8080 anal.java anal.m680x_cs anal.68k_cs anal.malbolge anal.mcore anal.mips_cs anal.mips_gnu anal.msp430 anal.nio2 anal.null anal.or1k anal.pic anal.ppc_cs anal.ppc_gnu anal.pyc anal.riscv ana.riscv_cs anal.rsp anal.s390_cs anal.sh anal.snes anal.sparc_cs anal.sparc_gnu nal.tms320 anal.tricore anal.v810 anal.v850 anal.vax anal.wasm anal.ws anal.x86cs anal.xap anal.xcore_cs anal.xtensa anal.z80 asm.6502 asm.6502_cs asm.8051 as.amd29k asm.arc asm.arm_as asm.arm_cs asm.arm_gnu asm.arm_winedbg asm.avr asm.b asm.chip8 asm.cr16 asm.cris_gnu asm.dalvik asm.dcpu16 asm.ebc asm.gb asm.h8300asm.hexagon asm.hppa_gnu asm.i4004 asm.i8080 asm.java asm.lanai_gnu asm.lh5801 sm.lm32 asm.m680x_cs asm.m68k_cs asm.m68k_gnu asm.malbolge asm.mcore asm.mcs96 sm.mips_cs asm.mips_gnu asm.msp430 asm.nios2 asm.null asm.or1k asm.pic asm.ppc_s asm.ppc_cs asm.ppc_gnu asm.propeller asm.pyc asm.riscv asm.riscv_cs asm.rsp am.s390_cs asm.s390_gnu asm.sh asm.snes asm.sparc_cs asm.sparc_gnu asm.tms320 as.tricore asm.v810 asm.v850 asm.v850_gnu asm.vax asm.wasm asm.ws asm.x86_as asm.86_cs asm.x86_nasm asm.x86_nz asm.xap asm.xcore_cs asm.xtensa asm.z80 bin.any bn.art bin.avr bin.bf bin.bflt bin.bios bin.bootimg bin.cgc bin.coff bin.dex bindmp64 bin.dol bin.dyldcache bin.elf bin.elf64 bin.fs bin.java bin.le bin.mach0 in.mach064 bin.mbn bin.mdmp bin.menuet bin.mz bin.ne bin.nes bin.nin3ds bin.nins bin.ningb bin.ningba bin.nro bin.nso bin.off bin.omf bin.p9 bin.pe bin.pe64 bn.pebble bin.prg bin.psxexe bin.pyc bin.qnx bin.sfc bin.smd bin.sms bin.symbolsbin.te bin.vsf bin.wad bin.wasm bin.xbe bin.xnu_kernelcache bin.z64 bin.zimg bi_ldr.ldr_linux bin_xtr.xtr_dyldcache bin_xtr.xtr_fatmach0 bin_xtr.xtr_pemixed bn_xtr.xtr_sep64 bp.arm bp.bf bp.mips bp.ppc bp.x86 core.a2f core.java core.sixrf crypto.aes crypto.aes_cbc crypto.base64 crypto.base91 crypto.blowfish crypto.ps2 crypto.des crypto.punycode crypto.rc2 crypto.rc4 crypto.rc6 crypto.rol crypo.ror crypto.rot crypto.serpent crypto.xor debug.bf debug.bochs debug.esil debu.gdb debug.io debug.native debug.null debug.qnx debug.rap debug.winkd egg.exec gg.xor esil.dummy fs.ext2 fs.fat fs.fb fs.hfs fs.hfsplus fs.io fs.iso9660 fs.jf fs.minix fs.ntfs fs.posix fs.r2 fs.reiserfs fs.sfs fs.tar fs.udf fs.ufs fs.xfsio.ar io.bfdbg io.bochs io.debug io.default io.fd io.gdb io.gprobe io.gzip io.htp io.ihex io.mach io.malloc io.mmap io.null io.procpid io.ptrace io.qnx io.r2kio.r2pipe io.r2web io.rap io.rbuf io.self io.shm io.socket io.sparse io.tcpslur io.w32 io.w32dbg io.winedbg io.winkd io.zip lang.c lang.cpipe lang.pipe lang.rst lang.spp lang.v lang.vala lang.zig parse.6502_pseudo parse.arm_pseudo parse.tt2intel parse.avr_pseudo parse.chip8_pseudo parse.dalvik_pseudo parse.m68k_psedo parse.mips_pseudo parse.ppc_pseudo parse.riscv_pseudo parse.sh_pseudo parse.ms320_pseudo parse.v850_pseudo parse.wasm_pseudo parse.x86_pseudo parse.z80_psedo
cp: './plugins.cfg' and 'plugins.cfg' are the same file
checking build system type... x86_64-unknown-mingw64_nt-10.0-19043-gnu
checking host system type... x86_64-unknown-mingw64_nt-10.0-19043-gnu
checking target system type... x86_64-unknown-mingw64_nt-10.0-19043-gnu
checking for working directories... current
using prefix '/usr/local'
checking for c compiler... gcc
checking for dynamic library... libc
checking for pkg-config... no
checking for patch... /usr/bin/patch
checking for git... /mingw64/bin/git
checking for gperf... no
checking for libmagic ... no
checking for libz ... yes
checking for libzip ... no
checking for libxxhash ... no
checking declaration of ADDR_NO_RANDOMIZE in sys/personality.h... no
checking declaration of __GLIBC__ in features.h... no
checking function arc4random_uniform() in c... no
checking function explicit_bzero() in c... no
checking function explicit_memset() in c... no
checking function clock_nanosleep() in c... no
checking function sigaction() in c... no
checking function clock_gettime() in c... no
checking cflags  -std=gnu99... yes
checking for libssl ... no
checking pkg-config flags for openssl... no
checking version of library libuv >= 1.0.0... no
creating ./config-user.mk
creating libr/include/r_userconf.h
creating pkgcfg/r_io.pc
creating pkgcfg/r_magic.pc
creating pkgcfg/r_asm.pc
creating pkgcfg/r_bin.pc
creating pkgcfg/r_anal.pc
creating pkgcfg/r_hash.pc
creating pkgcfg/r_cons.pc
creating pkgcfg/r_core.pc
creating pkgcfg/r_lang.pc
creating pkgcfg/r_socket.pc
creating pkgcfg/r_debug.pc
creating pkgcfg/r_reg.pc
creating pkgcfg/r_config.pc
creating pkgcfg/r_flag.pc
creating pkgcfg/r_syscall.pc
creating pkgcfg/r_util.pc
creating pkgcfg/r_search.pc
creating pkgcfg/r_bp.pc
creating pkgcfg/r_parse.pc
creating pkgcfg/r_fs.pc
creating pkgcfg/r_egg.pc
creating pkgcfg/r_crypto.pc
cleaning temporally files... done

Final report:
 - R_CHECKS_LEVEL = 2
 - PREFIX = /usr/local
 - HAVE_LIB_GMP = 0
 - HAVE_OPENSSL = 0
 - HAVE_LIBUV = 0
 - USE_CAPSTONE = 0
 - HAVE_PTRACE = 1
 - USE_PTRACE_WRAP = 0
 - HAVE_FORK = 1
 - VERSION = 5.4.0-git
 - USE_LIB_ZIP = 0
 - USE_LIB_MAGIC = 0
 - USE_LIB_XXHASH = 0
 - DEBUGGER = 1
 - CC = gcc
 - USERCC = gcc
 - HAVE_ARC4RANDOM_UNIFORM = 0
 - PKGCONFIG = pkg-config
 - HAVE_GPERF = 0
 - HAVE_EXPLICIT_BZERO = 0
 - HAVE_EXPLICIT_MEMSET = 0
 - WANT_DYLINK = 1
 - USEROSTYPE = auto
 - LIBVERSION = 5.4.0-git
 - BUILD = x86_64-unknown-mingw64_nt-10.0-19043-gnu
 - HOST = x86_64-unknown-mingw64_nt-10.0-19043-gnu
 - TARGET = x86_64-unknown-mingw64_nt-10.0-19043-gnu
 - CFLAGS = (null)
 - LDFLAGS = (null)
Generating r_version.h file
radare2
1
Makefile:264: warning: overriding recipe for target 'all'
Makefile:82: warning: ignoring old recipe for target 'all'
Makefile:264: warning: overriding recipe for target 'all'
Makefile:82: warning: ignoring old recipe for target 'all'

>>>>>>>>
HOST SDB
>>>>>>>>

CC main.c
CC cdb.c
CC buffer.c
CC cdb_make.c
CC ls.c
CC sdbht.c
main.c: In function 'gen_gperf':
main.c:760:3: warning: implicit declaration of function 'ftruncate'; did you men 'strncat'? [-Wimplicit-function-declaration]
   ftruncate (wd, 0);
   ^~~~~~~~~
   strncat
CC ht_uu.c
CC sdb.c
CC num.c
CC base64.c
CC match.c
CC json.c
CC ns.c
CC lock.c
CC util.c
CC disk.c
CC query.c
CC array.c
CC fmt.c
lock.c: In function 'sdb_lock':
lock.c:36:18: warning: implicit declaration of function 'getpid'; did you mean getcwd'? [-Wimplicit-function-declaration]
  pid = sdb_itoa (getpid (), pidstr, 10);
                  ^~~~~~
                  getcwd
CC journal.c
CC text.c
CC dict.c
CC ht_pp.c
CC ht_up.c
CC ht_pu.c
journal.c: In function 'sdb_journal_clear':
journal.c:97:11: warning: implicit declaration of function 'ftruncate'; did youmean 'strncat'? [-Wimplicit-function-declaration]
   return !ftruncate (s->journal, 0);
           ^~~~~~~~~
           strncat
CC set.c
CC diff.c
AR libsdb.a
ar: creating libsdb.a
BIN sdb
sdb/sdb: PE32+ executable (console) x86-64, for MS Windows
Makefile:264: warning: overriding recipe for target 'all'
Makefile:82: warning: ignoring old recipe for target 'all'
Makefile:264: warning: overriding recipe for target 'all'
Makefile:82: warning: ignoring old recipe for target 'all'

>>>>>>>>>>
TARGET SDB
>>>>>>>>>>

make[4]: *** No rule to make target 'libsdb.'.  Stop.
make[3]: *** [Makefile:144: sdb-target] Error 2
make[2]: *** [Makefile:117: sdb/src/libsdb.a] Error 2
make[1]: *** [Makefile:120: sdbs] Error 2
make: *** [Makefile:51: all] Error 2
trufae commented 3 years ago

For windows we recommend to use meson+ninja, thats how its build in the ci. Using acr maybe you can give it a try and use —with-ostype=windows , for meson:

meson b
ninja -C b
trufae commented 3 years ago

Also, mingw support was removed a while ago because their sdk was shipping some invalid headers that break at runtime. You may use visual studio.

but i agree that mingw and acr support should be back as its been broken for a while because it was not maintained and focused on meson

trufae commented 2 years ago

i have added proper batch scripts to build r2 on windows. you the following and it should work:

preconfigure
configure
make

it will find vs, python, git, meson, ninja to set the env accordingly, if anything goes wrong let me know.