简体   繁体   English

VisualGDB和Raspberry Pi

[英]VisualGDB and Raspberry pi

When using this turotial: http://visualgdb.com/tutorials/raspberry/crosscompiler/ . 使用此教程时: http ://visualgdb.com/tutorials/raspberry/crosscompiler/。

I built the solution in Visual Studio 2012, and I got this output: 我在Visual Studio 2012中构建了解决方案,并得到以下输出:

1>------ Build started: Project: LinuxHelloWorld, Configuration: Debug Win32 ------
1>  VisualGDB: Attempting inline build...
1>  VisualGDB: Run "cmd.exe /c "C:\SysGCC\raspberry\bin\make.exe" CONFIG=Debug" in directory "C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld" on local computer
1>  make: *** No targets specified and no makefile found.  Stop.
1>  -------------------------------------------------------------
1>  Command exited with code 2
1>  Executable: cmd.exe
1>  Arguments: /c "C:\SysGCC\raspberry\bin\make.exe" CONFIG=Debug
1>  Directory: C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld
1>VisualGDB : error : Command-line action failed
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDB.exe" /build "C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld\LinuxHelloWorld.vcxproj" "/solution:C:\Users\Kels\LinuxHelloWorld\LinuxHelloWorld.sln" "/config:Debug" "/platform:Win32"" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am confused on what the next step would be for the command-line failure. 我对命令行失败的下一步感到困惑。 Thanks ahead of time!! 提前谢谢!

Added 10/20. 增加10/20。 The Makefile in C:\\Users\\Kels\\LinuxHelloWorld\\LinuxHelloWorld C:\\ Users \\ Kels \\ LinuxHelloWorld \\ LinuxHelloWorld中的Makefile

#Generated by VisualGDB project wizard. 
#Note: VisualGDB will automatically update this file when you add new sources to the project.
#All other changes you make in this file will be preserved.
#Visit http://visualgdb.com/makefiles for more details

#VisualGDB: AutoSourceFiles     #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS

TARGETNAME := LinuxHelloWorld
#TARGETTYPE can be APP, STATIC or SHARED
TARGETTYPE := APP

to_lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

CONFIG ?= DEBUG

CONFIGURATION_FLAGS_FILE := $(call to_lowercase,$(CONFIG)).mak

    include $(CONFIGURATION_FLAGS_FILE)
include $(ADDITIONAL_MAKE_FILES)

ifeq ($(BINARYDIR),)
error:
    $(error Invalid configuration, please check your inputs)
endif

SOURCEFILES := LinuxHelloWorld.cpp
EXTERNAL_LIBS := 
EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib)))

CFLAGS += $(COMMONFLAGS)
CXXFLAGS += $(COMMONFLAGS)
ASFLAGS += $(COMMONFLAGS)
LDFLAGS += $(COMMONFLAGS)

CFLAGS += $(addprefix -I,$(INCLUDE_DIRS))
CXXFLAGS += $(addprefix -I,$(INCLUDE_DIRS))

CFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))
CXXFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))
ASFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))

CXXFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))
CFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))
LDFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))

LDFLAGS += $(addprefix -L,$(LIBRARY_DIRS))

ifeq ($(GENERATE_MAP_FILE),1)
LDFLAGS += -Wl,-Map=$(BINARYDIR)/$(basename $(TARGETNAME)).map
endif

LIBRARY_LDFLAGS = $(addprefix -l,$(LIBRARY_NAMES))

ifeq ($(IS_LINUX_PROJECT),1)
    RPATH_PREFIX := -Wl,--rpath='$$ORIGIN/../
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS)
    LIBRARY_LDFLAGS += -Wl,--rpath='$$ORIGIN'
    LIBRARY_LDFLAGS += $(addsuffix ',$(addprefix $(RPATH_PREFIX),$(dir $(EXTERNAL_LIBS))))

    ifeq ($(TARGETTYPE),SHARED)
        CFLAGS += -fPIC
        CXXFLAGS += -fPIC
        ASFLAGS += -fPIC
        LIBRARY_LDFLAGS += -Wl,-soname,$(TARGETNAME)
    endif

    ifneq ($(LINUX_PACKAGES),)
        PACKAGE_CFLAGS := $(foreach pkg,$(LINUX_PACKAGES),$(shell pkg-config --cflags $(pkg)))
        PACKAGE_LDFLAGS := $(foreach pkg,$(LINUX_PACKAGES),$(shell pkg-config --libs $(pkg)))
        CFLAGS += $(PACKAGE_CFLAGS)
        CXXFLAGS += $(PACKAGE_CFLAGS)
        LIBRARY_LDFLAGS += $(PACKAGE_LDFLAGS)
    endif   
else
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS)
endif

LIBRARY_LDFLAGS += $(ADDITIONAL_LINKER_INPUTS)

all_make_files := $(firstword $(MAKEFILE_LIST)) $(CONFIGURATION_FLAGS_FILE) $(ADDITIONAL_MAKE_FILES)

ifeq ($(STARTUPFILES),)
    all_source_files := $(SOURCEFILES)
else
    all_source_files := $(STARTUPFILES) $(filter-out $(STARTUPFILES),$(SOURCEFILES))
endif

source_obj1 := $(all_source_files:.cpp=.o)
source_obj2 := $(source_obj1:.c=.o)
source_obj3 := $(source_obj2:.s=.o)
source_obj4 := $(source_obj3:.S=.o)
source_obj5 := $(source_obj4:.cc=.o)
source_objs := $(source_obj5:.cxx=.o)

all_objs := $(addprefix $(BINARYDIR)/, $(notdir $(source_objs)))

PRIMARY_OUTPUTS :=

ifeq ($(GENERATE_BIN_FILE),1)
PRIMARY_OUTPUTS += $(BINARYDIR)/$(basename $(TARGETNAME)).bin
endif

ifeq ($(GENERATE_IHEX_FILE),1)
PRIMARY_OUTPUTS += $(BINARYDIR)/$(basename $(TARGETNAME)).ihex
endif

ifeq ($(PRIMARY_OUTPUTS),)
PRIMARY_OUTPUTS := $(BINARYDIR)/$(TARGETNAME)
endif

all: $(PRIMARY_OUTPUTS)

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME)
    $(OBJCOPY) -O binary $< $@

$(BINARYDIR)/$(basename $(TARGETNAME)).ihex: $(BINARYDIR)/$(TARGETNAME)
    $(OBJCOPY) -O ihex $< $@

ifeq ($(TARGETTYPE),APP)
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS)
    $(LD) -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP)
endif

ifeq ($(TARGETTYPE),SHARED)
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS)
    $(LD) -shared -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP)
endif

ifeq ($(TARGETTYPE),STATIC)
$(BINARYDIR)/$(TARGETNAME): $(all_objs)
    $(AR) -r $@ $^
endif

-include $(all_objs:.o=.dep)

clean:
ifeq ($(USE_DEL_TO_CLEAN),1)
    del /S /Q $(BINARYDIR)
else
    rm -rf $(BINARYDIR)
endif

$(BINARYDIR):
    mkdir $(BINARYDIR)

#VisualGDB: FileSpecificTemplates       #<--- VisualGDB will use the following lines to define rules for source files in subdirectories
$(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR)
    $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.S $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.s $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.cc $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.cxx $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

#VisualGDB: GeneratedRules  

        #<--- All lines below are auto-generated

I'm also using VisualGDB for Raspberry Pi development, one of the greatest plugins I've seen. 我还将VisualGDB用于Raspberry Pi开发,这是我见过的最出色的插件之一。 From your log it seems that you are using a cross compilation toolchain to make build. 从您的日志看来,您正在使用交叉编译工具链进行构建。 First thing you can do is go to the C:\\Users\\Kels\\LinuxHelloWorld\\LinuxHelloWorld and verify the existence of a Makefile there and check the contents (maybe even add them to the question there so they can be expected). 您可以做的第一件事是转到C:\\Users\\Kels\\LinuxHelloWorld\\LinuxHelloWorld并验证其中是否存在Makefile并检查其内容(甚至可以将它们添加到该问题中,以便可以预期到)。 Another option is to set up compilation on the Pi itself instead of the using a toolchain (this can be done through the project wizard) - it will be slower since Pi cannot be compared to a PC, but then again, any 3rd party libraries which you may need (and most likely you will) can be easily installed on the Pi via apt-get and just used while you will have to cross compile them on your PC if you use the toolchain. 另一个选择是在Pi本身上设置编译,而不是使用工具链(这可以通过项目向导来完成)-由于Pi无法与PC进行比较,因此速度较慢,但​​是与之相比,任何第三方库您可能需要(而且很可能会)可以通过apt-get轻松安装在Pi上,并且仅在使用时使用,如果您使用工具链则必须在PC上交叉编译它们。

UPDATE 更新

Heres is an example Makefile of one of my sample projects: 这是我的一个示例项目的示例Makefile:

#Generated by VisualGDB project wizard. 
#Note: VisualGDB will automatically update this file when you add new sources to the project.
#All other changes you make in this file will be preserved.
#Visit http://visualgdb.com/makefiles for more details

#VisualGDB: AutoSourceFiles     #<--- remove this line to disable auto-updating of SOURCEFILES and EXTERNAL_LIBS

TARGETNAME := RpiOmxTunnelReconfiguration
#TARGETTYPE can be APP, STATIC or SHARED
TARGETTYPE := APP

to_lowercase = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

CONFIG ?= DEBUG

CONFIGURATION_FLAGS_FILE := $(call to_lowercase,$(CONFIG)).mak

include $(CONFIGURATION_FLAGS_FILE)
include $(ADDITIONAL_MAKE_FILES)

ifeq ($(BINARYDIR),)
error:
    $(error Invalid configuration, please check your inputs)
endif

SOURCEFILES := Omx/Component.cpp Omx/ComponentPort.cpp RpiOmxTunnelReconfiguration.cpp
EXTERNAL_LIBS := 
EXTERNAL_LIBS_COPIED := $(foreach lib, $(EXTERNAL_LIBS),$(BINARYDIR)/$(notdir $(lib)))

CFLAGS += $(COMMONFLAGS)
CXXFLAGS += $(COMMONFLAGS)
ASFLAGS += $(COMMONFLAGS)
LDFLAGS += $(COMMONFLAGS)

CFLAGS += $(addprefix -I,$(INCLUDE_DIRS))
CXXFLAGS += $(addprefix -I,$(INCLUDE_DIRS))

CFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))
CXXFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))
ASFLAGS += $(addprefix -D,$(PREPROCESSOR_MACROS))

CXXFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))
CFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))
LDFLAGS += $(addprefix -framework ,$(MACOS_FRAMEWORKS))

LDFLAGS += $(addprefix -L,$(LIBRARY_DIRS))

LIBRARY_LDFLAGS = $(addprefix -l,$(LIBRARY_NAMES))

ifeq ($(IS_LINUX_PROJECT),1)
    RPATH_PREFIX := -Wl,--rpath='$$ORIGIN/../
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS)
    LIBRARY_LDFLAGS += -Wl,--rpath='$$ORIGIN'
    LIBRARY_LDFLAGS += $(addsuffix ',$(addprefix $(RPATH_PREFIX),$(dir $(EXTERNAL_LIBS))))

    ifeq ($(TARGETTYPE),SHARED)
        LIBRARY_LDFLAGS += -Wl,-soname,$(TARGETNAME)
    endif

else
    LIBRARY_LDFLAGS += $(EXTERNAL_LIBS)
endif

LIBRARY_LDFLAGS += $(ADDITIONAL_LINKER_INPUTS)

all_make_files := Makefile $(CONFIGURATION_FLAGS_FILE) $(ADDITIONAL_MAKE_FILES)

ifeq ($(STARTUPFILES),)
    all_source_files := $(SOURCEFILES)
else
    all_source_files := $(STARTUPFILES) $(filter-out $(STARTUPFILES),$(SOURCEFILES))
endif

source_obj1 := $(all_source_files:.cpp=.o)
source_obj2 := $(source_obj1:.c=.o)
source_obj3 := $(source_obj2:.s=.o)
source_objs := $(source_obj3:.S=.o)

all_objs := $(addprefix $(BINARYDIR)/, $(notdir $(source_objs)))

ifeq ($(GENERATE_BIN_FILE),1)
all: $(BINARYDIR)/$(basename $(TARGETNAME)).bin

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME)
    $(OBJCOPY) -O binary $< $@

else
all: $(BINARYDIR)/$(TARGETNAME)
endif

ifeq ($(TARGETTYPE),APP)
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS)
    $(LD) -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP)
endif

ifeq ($(TARGETTYPE),SHARED)
$(BINARYDIR)/$(TARGETNAME): $(all_objs) $(EXTERNAL_LIBS)
    $(LD) -shared -o $@ $(LDFLAGS) $(START_GROUP) $(all_objs) $(LIBRARY_LDFLAGS) $(END_GROUP)
endif

ifeq ($(TARGETTYPE),STATIC)
$(BINARYDIR)/$(TARGETNAME): $(all_objs)
    $(AR) -r $@ $^
endif

-include $(all_objs:.o=.dep)

clean:
ifeq ($(USE_DEL_TO_CLEAN),1)
    del /S /Q $(BINARYDIR)
else
    rm -rf $(BINARYDIR)
endif

$(BINARYDIR):
    mkdir $(BINARYDIR)

#VisualGDB: FileSpecificTemplates       #<--- VisualGDB will use the following lines to define rules for source files in subdirectories
$(BINARYDIR)/%.o : %.cpp $(all_make_files) |$(BINARYDIR)
    $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.c $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.S $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

$(BINARYDIR)/%.o : %.s $(all_make_files) |$(BINARYDIR)
    $(CC) $(CFLAGS) $(ASFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

#VisualGDB: GeneratedRules              #<--- All lines below are auto-generated


$(BINARYDIR)/Component.o : Omx/Component.cpp $(all_make_files) |$(BINARYDIR)
    $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)


$(BINARYDIR)/ComponentPort.o : Omx/ComponentPort.cpp $(all_make_files) |$(BINARYDIR)
    $(CXX) $(CXXFLAGS) -c $< -o $@ -MD -MF $(@:.o=.dep)

As you see here TARGETNAME := RpiOmxTunnelReconfiguration and 如您在这里看到的TARGETNAME := RpiOmxTunnelReconfiguration

ifeq ($(GENERATE_BIN_FILE),1)
all: $(BINARYDIR)/$(basename $(TARGETNAME)).bin

$(BINARYDIR)/$(basename $(TARGETNAME)).bin: $(BINARYDIR)/$(TARGETNAME)
    $(OBJCOPY) -O binary $< $@

else
all: $(BINARYDIR)/$(TARGETNAME)
endif

will always define an output binary file. 将始终定义输出二进制文件。 Maybe recreate the project. 也许重新创建项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM