Windows 下 使用 VSCode 和 arm-none-eabi 编译Linux代码时 mkdir 命令出错

编译环境:

IDE: VSCode

交叉编译器:arm-none-eabi

make 命令:Mingw-w64 GCC for Windows 64

源代码管理:git

交叉编译器版本和安装目录: E:\work_soft\gcc-arm-none-eabi-10.3-2021.10

Mingw 版本和目录:E:\work_soft\x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev1

问题描述:

Windows 下使用 make 命令编译一些 Linux 平台编译 OK 的代码时,往往会出错。一个典型的错误是 mkdir  "不是内部或外部命令,也不是可运行的程序" 错误:

PS F:\开源硬件\逆向\1-FNIRSI-1013D\F1C100s_projects> make -C .\projects\hello_led\
make: Entering directory 'F:/开源硬件/逆向/1-FNIRSI-1013D/F1C100s_projects/projects/hello_led'
"mkdir" build/
'"mkdir"' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
make: *** [../../f1c100s_common.mk:63: build/exception.o] Error 1
make: Leaving directory 'F:/开源硬件/逆向/1-FNIRSI-1013D/F1C100s_projects/projects/hello_led'

出错的 Makefile 文件如下:

$(BUILDDIR)/%.o: %.c
	"mkdir" -p $(dir $@)
	$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@

解决办法:

解决办法在文末

更改后编译成功:

Jian@DESKTOP-R4PHV6R MINGW64 /f/F1C100s_projects (master)
$ make -C projects/hello_led/
make: Entering directory 'F:/F1C100s_projects/projects/hello_led'
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf exception.c -o build/exception.o
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf main.c -o build/main.o
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf system.c -o build/system.o
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/arm926/src/image.S -o build/image.o
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/arm926/src/vectors.S -o build/vectors.o
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/arm926/src/cache-v5.S -o build/cache-v5.o
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_clock.c -o build/f1c100s_clock.o   
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_de.c -o build/f1c100s_de.o
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_gpio.c -o build/f1c100s_gpio.o     
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_intc.c -o build/f1c100s_intc.o     
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_pwm.c -o build/f1c100s_pwm.o       
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_sdc.c -o build/f1c100s_sdc.o       
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_timer.c -o build/f1c100s_timer.o   
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_touch.c -o build/f1c100s_touch.o   
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_tvd.c -o build/f1c100s_tvd.o       
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_tve.c -o build/f1c100s_tve.o       
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../f1c100s/drivers/src/f1c100s_uart.c -o build/f1c100s_uart.o     
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../lib/printf/printf.c -o build/printf.o
mkdir -p build/
arm-none-eabi-gcc -c -march=armv5te -mtune=arm926ej-s -mfloat-abi=soft -marm -mno-thumb-interwork -g -ggdb -Wall -fdata-sections -ffunction-sections -ffreestanding -std=gnu99 -Os -fomit-frame-pointer -Wall -fverbose-asm -DLOAD_HEADER  -D__ARM32_ARCH__=5 -D__ARM926EJS__ -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1 -DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD=1 -I. -I../../f1c100s/arm926/inc -I../../f1c100s/drivers/inc -I../../lib/printf ../../lib/syscalls/syscalls.c -o build/syscalls.o
arm-none-eabi-gcc -nostartfiles -Xlinker --gc-sections -T../../f1c100s/f1c100s_dram.ld -Wl,--defsym=DRAM_SIZE=32M,-Map=build/hello_led.map,--cref,--no-warn-mismatch -o build/hello_led.elf build/exception.o build/main.o build/system.o build/image.o build/vectors.o build/cache-v5.o build/f1c100s_clock.o build/f1c100s_de.o build/f1c100s_gpio.o build/f1c100s_intc.o build/f1c100s_pwm.o build/f1c100s_sdc.o build/f1c100s_timer.o build/f1c100s_touch.o build/f1c100s_tvd.o build/f1c100s_tve.o build/f1c100s_uart.o build/printf.o build/syscalls.o -lgcc -lm -lc_nano
arm-none-eabi-objcopy -O binary build/hello_led.elf build/hello_led.bin
   text    data     bss     dec     hex filename
  23243       0 8930452 8953695  889f5f build/hello_led.elf
make: Leaving directory 'F:/F1C100s_projects/projects/hello_led'

更改的 VSCode 默认的终端为 Git 终端:

Windows 下 使用 VSCode 和 arm-none-eabi 编译Linux代码时 mkdir 命令出错_第1张图片

你可能感兴趣的:(Linux)