我有一个使用make
在Windows中游泳编译但在linux中失败的项目。在隐式编译到目标文件期间它失败了(我将发布摘录):
arm-none-eabi-gcc -Wl,-Map=All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/List
/PMSCounter.map -Wl,--gc-sections -Wl,-T../../linkerScr/atsamr21g18a.ld -mthumb -nostartfiles -mcpu=cortex-m0plus All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/PMSCounterSensor.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/SZ_DbgLib.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/WSNVisualizer.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/WSNMessageSender.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/WSNCommandHandler.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/WSNRouter.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/WSNDemoApp.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsMemAccess.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsTimer.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsMem.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsWriteData.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsCrcService.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsInit.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsEvents.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/stdPdsDataServer.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/fakePds.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/wlPdsTypesConverter.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/wlPdsTaskManager.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/wlPdsSecurity.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/wlPdsInit.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/wlPdsDataServer.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/S_Nv.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/S_XNv.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/D_XNv-SamR21.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/S_Nv-External.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/D_Nv.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/S_Nv_Stub.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysIdleHandler.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysSleep.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysStat.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysEventsHandler.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysQueue.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysUtils.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysAssert.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysDuplicateTable.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysInit.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysTaskManager.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/dbg.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysMutex.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/sysTimer.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspUsart.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/MaxL.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspTempSensor.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/buttons.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/fakeBSP.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/lcd.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/xyl2rgb.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/joyStick.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspUid.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspI2c.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspVoltageSensor.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspTaskManager.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/hs2xy.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/leds.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/bspSpi.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/csPersistentMem.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/csMem.o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/configServer.o -Wl,-\( ../../../../BitCloud/lib/libBc_All_Atsamr21g18a_Rf233_Gcc.a ../../../../BitCloud/lib/libHAL_SamR21_Atsamr21g18a_8Mhz_Gcc.a -Wl,-\) -o All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Exe/PMSCounter.elf
arm-none-eabi-gcc: error: All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Obj/configServer.o: No such file or directory
arm-none-eabi-gcc: error: ../../../../BitCloud/lib/libHAL_SamR21_Atsamr21g18a_8Mhz_Gcc.a: No such file or directory
Makefile_All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc:172: recipe for target 'All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Exe/PMSCounter.elf' failed
make[1]: *** [All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc/Exe/PMSCounter.elf] Error 1
make[1]: Leaving directory '/mnt/Data/Work_Senzopt/PMS/Codebase/Main_codebase/parking-counter/parking-counter-2/parking-counter-2/Applications/PMSCounter/makefiles/ATSAMR21G18A'
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 2
我尝试在windows和linux中都做make -nd
,在Windows中发生的第一件事是生成所有* .o文件,而在linux中它直接进入链接步骤。但是,我迷失了为什么会发生这种情况,因为从查看makefile,我无法识别平台依赖性。我很欣赏任何关于我做错的提示,谢谢!我的makefile是:
COMPONENTS_PATH = ../../../../BitCloud/Components
CONFIG_NAME = All_SamR21_Atsamr21g18a_Rf233_8Mhz_Gcc
LIST_PATH = $(CONFIG_NAME)/List
EXE_PATH = $(CONFIG_NAME)/Exe
OBJ_PATH = $(CONFIG_NAME)/Obj
include ../../../../BitCloud/lib/Makerules_Atsamr21g18a_Gcc
DEFINES = \
-DBOARD_SAMR21 \
-DAT86RF233 \
-DATSAMR21G18A \
-DHAL_8MHz \
-DNO_SECURITY_MODE \
-DSTACK_TYPE_ALL
INCLUDES = \
-I../.. \
-I../../include \
-I../../../../BitCloud/Components/BSP/SAMR21/include \
-I../../../../BitCloud/Components/SystemEnvironment/include \
-I../../../../BitCloud/lib \
-I../../../../BitCloud/Components/HAL/include \
-I../../../../BitCloud/Components/BSP \
-I../../../../BitCloud/Components/BSP/include \
-I../../../../BitCloud/Components/NWK/include \
-I../../../../BitCloud/Components/NWK/include/private \
-I../../../../BitCloud/Components/ZDO/include \
-I../../../../BitCloud/Components/ZDO/include/private \
-I../../../../BitCloud/Components/APS/include \
-I../../../../BitCloud/Components/APS/include/private \
-I../../../../BitCloud/Components/SystemEnvironment/include \
-I../../../../BitCloud/Components/ConfigServer/include \
-I../../../../BitCloud/Components/ConfigServer/include/private \
-I../../../../BitCloud/Components/PersistDataServer/include \
-I../../../../BitCloud/Components/PersistDataServer/std/include \
-I../../../../BitCloud/Components/PersistDataServer/wl/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Types/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Util/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Timer/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Task/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_ErrH/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Log/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Memory/include \
-I../../../../BitCloud/Components/ZLLPlatform/Infrastructure/N_Init/include \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/S_Nv/include \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/S_XNv/include \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/D_Nv/include \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/D_XNv/include \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/D_XNv/src \
-I../../../../BitCloud/Components/ZLLPlatform/ZLL/S_XNv/src \
-I../../../../BitCloud/Components/Security/TrustCentre/include \
-I../../../../BitCloud/Components/Security/ServiceProvider/include \
-I../../../../BitCloud/Components/HAL/drivers/include \
-I../../../../BitCloud/Components/HAL/drivers/VCP/include \
-I../../../../BitCloud/Components/HAL/cortexm0+/atsamr21/common/include \
-I../../../../BitCloud/Components/MAC_PHY/include \
-I../../../../BitCloud/Components/MAC_PHY/MAC_ENV/include \
-I../../../../BitCloud/Components/MAC_PHY/MAC_HWI/include \
-I../../../../BitCloud/Components/MAC_PHY/MAC_HWD_PHY/include \
-I../../../../BitCloud/Components/MAC_PHY/MAC_HWD_PHY/RF231_RF212/PHY/include \
-I../../../../BitCloud/Components/MAC_PHY/MAC_HWD_PHY/RF231_RF212/MAC_HWD/include
LIBS = \
../../../../BitCloud/lib/libBc_All_Atsamr21g18a_Rf233_Gcc.a \
../../../../BitCloud/lib/libHAL_SamR21_Atsamr21g18a_8Mhz_Gcc.a
SRCS = \
../../src/PMSCounterSensor.c \
../../src/SZ_DbgLib.c \
../../src/WSNVisualizer.c \
../../src/WSNMessageSender.c \
../../src/WSNCommandHandler.c \
../../src/WSNRouter.c \
../../src/WSNDemoApp.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsMemAccess.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsTimer.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsMem.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsWriteData.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsCrcService.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsInit.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsEvents.c \
../../../../BitCloud/Components/PersistDataServer/std/src/stdPdsDataServer.c \
../../../../BitCloud/Components/PersistDataServer/src/fakePds.c \
../../../../BitCloud/Components/PersistDataServer/wl/src/wlPdsTypesConverter.c \
../../../../BitCloud/Components/PersistDataServer/wl/src/wlPdsTaskManager.c \
../../../../BitCloud/Components/PersistDataServer/wl/src/wlPdsSecurity.c \
../../../../BitCloud/Components/PersistDataServer/wl/src/wlPdsInit.c \
../../../../BitCloud/Components/PersistDataServer/wl/src/wlPdsDataServer.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/S_Nv/src/S_Nv.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/S_XNv/src/S_XNv.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/D_XNv/src/D_XNv-SamR21.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/S_Nv/src/S_Nv-External.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/D_Nv/src/D_Nv.c \
../../../../BitCloud/Components/ZLLPlatform/ZLL/S_Nv/src/S_Nv_Stub.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysIdleHandler.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysSleep.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysStat.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysEventsHandler.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysQueue.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysUtils.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysAssert.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysDuplicateTable.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysInit.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysTaskManager.c \
../../../../BitCloud/Components/SystemEnvironment/src/dbg.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysMutex.c \
../../../../BitCloud/Components/SystemEnvironment/src/sysTimer.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspUsart.c \
../../../../BitCloud/Components/BSP/SAMR21/src/MaxL.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspTempSensor.c \
../../../../BitCloud/Components/BSP/SAMR21/src/buttons.c \
../../../../BitCloud/Components/BSP/SAMR21/src/fakeBSP.c \
../../../../BitCloud/Components/BSP/SAMR21/src/lcd.c \
../../../../BitCloud/Components/BSP/SAMR21/src/xyl2rgb.c \
../../../../BitCloud/Components/BSP/SAMR21/src/joyStick.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspUid.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspI2c.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspVoltageSensor.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspTaskManager.c \
../../../../BitCloud/Components/BSP/SAMR21/src/hs2xy.c \
../../../../BitCloud/Components/BSP/SAMR21/src/leds.c \
../../../../BitCloud/Components/BSP/SAMR21/src/bspSpi.c \
../../../../BitCloud/Components/ConfigServer/src/csPersistentMem.c \
../../../../BitCloud/Components/ConfigServer/src/csMem.c \
../../../../BitCloud/Components/ConfigServer/src/configServer.c
PREINCLUDE = MakerulesBc_All_Atsamr21g18a_Rf233_Gcc.h
CSRCS = $(filter %.c, $(SRCS))
OBJS = $(addprefix $(OBJ_PATH)/, $(notdir %/$(subst .c,.o,$(CSRCS))))
ASM_FILE_EXT = s
ifneq (, $(findstring .$(ASM_FILE_EXT), $(SRCS)))
ASRCS = $(filter %.$(ASM_FILE_EXT), $(SRCS))
OBJS += $(addprefix $(OBJ_PATH)/, $(notdir %$(subst .$(ASM_FILE_EXT),.o,$(ASRCS))))
endif
CFLAGS += $(DEFINES)
CFLAGS += $(INCLUDES)
CFLAGS += --include $(PREINCLUDE)
CFLAGS += -g
ASFLAGS = $(INCLUDES)
ASFLAGS += $(filter -mcpu%,$(CFLAGS))
$(OBJ_PATH)/%.o: $(SRCS)
$(CC) $(CFLAGS) $(filter %/$(subst .o,.c,$(notdir $@)), $(SRCS)) -o $@
LD = $(CC)
LINKER_FLAGS = -Wl,-Map=$(LIST_PATH)/$(APP_NAME).map -Wl,--gc-sections
LINKER_FLAGS += -Wl,-T../../linkerScr/atsamr21g18a.ld
LINKER_FLAGS += -mthumb -nostartfiles
LINKER_FLAGS += $(filter -mcpu%,$(CFLAGS))
.PHONY: all directories clean size root_files images
images: $(EXE_PATH)/$(APP_NAME).elf $(EXE_PATH)/$(APP_NAME).hex $(EXE_PATH)/$(APP_NAME).srec $(EXE_PATH)/$(APP_NAME).bin
all: directories images root_files size
$(OBJS): directories
$(EXE_PATH)/$(APP_NAME).elf: $(OBJS)
echo $(OBJS)
$(LD) $(LINKER_FLAGS) $(OBJS) -Wl,-\( $(LIBS) -Wl,-\) -o $@
$(EXE_PATH)/$(APP_NAME).srec: $(EXE_PATH)/$(APP_NAME).elf
$(OBJCOPY) -O srec --srec-len 128 $^ $@
$(EXE_PATH)/$(APP_NAME).hex: $(EXE_PATH)/$(APP_NAME).elf
$(OBJCOPY) -O ihex -R .eeprom $^ $@
$(EXE_PATH)/$(APP_NAME).bin: $(EXE_PATH)/$(APP_NAME).elf
$(OBJCOPY) -O binary --strip-debug --strip-unneeded -R .eeprom $^ $@
root_files: images
cp -f $(EXE_PATH)/*.* ./../../
clean:
rm -rf $(CONFIG_NAME) ../../$(APP_NAME).elf ../../$(APP_NAME).hex ../../$(APP_NAME).srec ../../$(APP_NAME).bin
directories:
@"mkdir" -p $(LIST_PATH)
@"mkdir" -p $(EXE_PATH)
@"mkdir" -p $(OBJ_PATH)
size: $(EXE_PATH)/$(APP_NAME).elf
@echo
@$(SIZE) -td $(EXE_PATH)/$(APP_NAME).elf
ifeq ($(MAKECMDGOALS), fresh)
directories: clean
endif
fresh: all
# eof Makefile
答案 0 :(得分:0)
令人惊讶的是,这适用于Windows。在这个makefile中有很多问题。之一:
OBJS = $(addprefix $(OBJ_PATH)/, $(notdir %/$(subst .c,.o,$(CSRCS))))
这令人困惑。 notdir
对模式没有任何作用,因此添加%/
(仅限于第一个参数!)没有做任何事情。使用subst
也不是一个好主意,因为它会更改.c
的每个实例,即使它出现在文件的中间;例如../x.comp.c
将更改为../x.oomp.o
。这一行应该是:
OBJS = $(patsubst %.c,$(OBJ_DIR)/%.o,$(notdir $(CSRCS)))
接下来,这是不对的:
$(OBJ_PATH)/%.o: $(SRCS)
$(CC) $(CFLAGS) $(filter %/$(subst .o,.c,$(notdir $@)), $(SRCS)) -o $@
这使得每个目标文件都依赖于所有源文件,因此如果您更改任何源文件,则将重建每个目标文件。您也可以创建一个shell脚本而不是使用make。这就是为什么你必须通过配方中的扭曲来找到你想要编译的C文件。更好的是use VPATH。此外,您需要在编译器行中使用-c
选项来构建目标文件...我无法将其添加到您的CFLAGS
中,但最佳实践并未将其添加到您的vpath %.c $(sort $(dir $(CSRCS)))
$(OBJ_PATH)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
无论如何:
$(OBJS): directories
接下来,这条线不好:
directories
每当需要重建directories
目标时,这将重建所有对象,这总是因为没有规则创建该目标:directories
目标永远不会创建名为make -d
的文件它总是过时的。
所有这一切,我无法解释您所看到的错误。链接器抱怨一个不存在的文件,但该文件(显然)是目标的先决条件,这意味着如果它不存在则make会尝试创建它,或者抱怨它是否可以& #39;吨
修复你的makefile后,我建议你运行configServer.o
(因为输出很重要而重定向到一个文件)并搜索<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
echo "User Has submitted the form and entered this name : <b> $name </b>";
echo "<br>You can use the following form again to enter a new name.";
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</form>
目标,看看make有什么说法。