使用gcc构建poco时配方失败

时间:2015-02-18 23:05:34

标签: c++ gcc linker makefile poco

嗨我在尝试使用gcc在cygwin控制台上构建poco时遇到此错误,它与配方失败有关,我不知道如何解决这个...

以下是错误代码:

$ make
make -C /cygdrive/c/poco-1.4.6p4-all/Foundation
make[1]: Entering directory '/cygdrive/c/poco-1.4.6p4-all/Foundation'
** Compiling src/ArchiveStrategy.cpp (debug, shared)
g++  -Iinclude -I/cygdrive/c/poco-1.4.6p4-all/CppUnit/include -I/cygdrive/c/poco-1.4.6p4-all/Foundation/include -I/cygdrive/c/poco-1.4.6p4-all/XML/include -I/cygdrive/c/poco-1.4.6p4-all/Util/include -I/cygdrive/c/poco-1.4.6p4-all/Net/include -I/cygdrive/c/poco-1.4.6p4-all/Crypto/include -I/cygdrive/c/poco-1.4.6p4-all/NetSSL_OpenSSL/include -I/cygdrive/c/poco-1.4.6p4-all/Data/include -I/cygdrive/c/poco-1.4.6p4-all/Data/SQLite/include -I/cygdrive/c/poco-1.4.6p4-all/Data/ODBC/include -I/cygdrive/c/poco-1.4.6p4-all/Data/MySQL/include -I/cygdrive/c/poco-1.4.6p4-all/Zip/include -I/cygdrive/c/poco-1.4.6p4-all/PageCompiler/include -I/cygdrive/c/poco-1.4.6p4-all/PageCompiler/File2Page/include -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY -DPOCO_BUILD_HOST=PB00YCT7  -D_XOPEN_SOURCE=500  -g -D_DEBUG  -c src/ArchiveStrategy.cpp -o /cygdrive/c/poco-1.4.6p4-all/Foundation/obj/CYGWIN/x86_64/debug_shared/ArchiveStrategy.o
Assembler messages:
Fatal error: can't create /cygdrive/c/poco-1.4.6p4-all/Foundation/obj/CYGWIN/x86_64/debug_shared/ArchiveStrategy.o: No such file or directory
/cygdrive/c/poco-1.4.6p4-all/build/rules/compile:53: recipe for target '/cygdrive/c/poco-1.4.6p4-all/Foundation/obj/CYGWIN/x86_64/debug_shared/ArchiveStrategy.o' failed
make[1]: *** [/cygdrive/c/poco-1.4.6p4-all/Foundation/obj/CYGWIN/x86_64/debug_shared/ArchiveStrategy.o] Error 1
make[1]: Leaving directory '/cygdrive/c/poco-1.4.6p4-all/Foundation'
Makefile:62: recipe for target 'Foundation-libexec' failed
make: *** [Foundation-libexec] Error 2

这是一堆接近第53行的代码,显示为错误:

$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
    @echo "** Compiling" $< "(debug, shared)"
    $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@

这可能很容易解决,但我几天都没有弄明白,因为我不是c ++和makefile的专家。

更新:我仍然得到相同的错误,我将添加完整的规则定义文件:

# $Id: //poco/1.4/build/rules/compile#1 $
#
# compile
#
# Compile rule definitions for makefiles
#

#
# Targets
#
.PHONY: all all_static all_shared all_debug all_release \
        clean static_debug static_release shared_debug shared_release

all: $(DEFAULT_TARGET)
all_static: static_debug static_release
all_shared: shared_debug shared_release
all_debug: static_debug shared_debug
all_release: static_release shared_release

#
# Create directories if necessary
#
.PHONY: objdirs libdirs bindirs static_bindirs
objdirs: $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OBJPATH_DEBUG_SHARED) 
libdirs: objdirs $(LIBPATH) 
bindirs: objdirs $(BINPATH)
static_bindirs: objdirs $(BINPATH)/static

$(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OBJPATH_DEBUG_SHARED) $(LIBPATH) $(BINPATH) $(BINPATH)/static:
    $(MKDIR) $@

#
# Rules for compiling
#   
$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
    @echo "** Compiling" $< "(debug, static)"
    $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(STATICOPT_CXX) -c $< -o $@

$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
    @echo "** Compiling" $< "(release, static)"
    $(CXX) $(INCLUDE) $(CXXFLAGS) $(RELEASEOPT_CXX) $(STATICOPT_CXX) -c $< -o $@

$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d
    @echo "** Compiling" $< "(debug, static)"
    $(CC) $(INCLUDE) $(CFLAGS) $(DEBUGOPT_CC) $(STATICOPT_CC) -c $< -o $@

$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d
    @echo "** Compiling" $< "(release, static)"
    $(CC) $(INCLUDE) $(CFLAGS) $(RELEASEOPT_CC) $(STATICOPT_CC) -c $< -o $@

$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
    @echo "** Compiling" $< "(debug, shared)"
    $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@

$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
    @echo "** Compiling" $< "(release, shared)"
    $(CXX) $(INCLUDE) $(CXXFLAGS) $(RELEASEOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@

$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d
    @echo "** Compiling" $< "(debug, shared)"
    $(CC) $(INCLUDE) $(CFLAGS) $(DEBUGOPT_CC) $(SHAREDOPT_CC) -c $< -o $@

$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d
    @echo "** Compiling" $< "(release, shared)"
    $(CC) $(INCLUDE) $(CFLAGS) $(RELEASEOPT_CC) $(SHAREDOPT_CC) -c $< -o $@

#
# Rules for creating dependency information
#
$(DEPPATH)/%.d: $(SRCDIR)/%.cpp
    @echo "** Creating dependency info for" $^
    $(MKDIR) $(DEPPATH)
    $(DEP) $(SRCDIR)/$(patsubst %.d,%.cpp,$(notdir $@)) $@ $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_SHARED) $(OBJPATH_RELEASE_SHARED) $(INCLUDE) $(CXXFLAGS) 

$(DEPPATH)/%.d: $(SRCDIR)/%.c
    @echo "** Creating dependency info for" $^
    $(MKDIR) $(DEPPATH)
    $(DEP) $(SRCDIR)/$(patsubst %.d,%.c,$(notdir $@)) $@ $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_SHARED) $(OBJPATH_RELEASE_SHARED) $(INCLUDE) $(CFLAGS)

depend: $(addprefix $(DEPPATH)/,$(addsuffix .d,$(objects)))

1 个答案:

答案 0 :(得分:0)

我会说问题是该目录不存在。编译器不会创建不存在的目录。在调用编译器之前,尝试修改规则以创建目录:

$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d
        @echo "** Compiling" $< "(debug, shared)"
        mkdir -p $(dir $@)
        $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@