使用Ubuntu VM + JUCE图形库的非法指令(核心已转储)

时间:2018-10-28 15:23:41

标签: c++ gcc juce

每当我尝试使用JUCE图形库从大学计算机(我相信有i5,但不确定具体细节)上运行编译的程序时,它就会正确运行且没有错误。但是,如果我尝试从家用PC(i7-3770)运行它,则它可以正确编译但会产生SIGILL错误,我已经使用gdb进行了查看,但是我的汇编知识并不是最好的。我尝试使用诸如"-O2 -march=ivybridge"之类的标志和其他方法,但是似乎没有任何组合可以使用。我将代码减少到最低限度,但仍然遇到相同的错误。

main.cpp:

#include <stdio.h>
#include <graphics.h>


int main(void) {
    initialiseGraphics();
    loop( [&](){

    }
    );
    return 0;
}

Makefile:

ifeq ($(origin ROOTDIR), undefined)
ROOTDIR=../..
endif
include $(ROOTDIR)/MakefileDefs.inc

# Build path
BUILD_DIR = build

TARGET = circlesAndRects
CPP_SOURCES = main.cpp

#######################################
# build the application
#######################################
OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(CPP_SOURCES:.cpp=.o)))
vpath %.cpp $(sort $(dir $(CPP_SOURCES)))

CFLAGS += -I$(INCDIR) -I$(JUCEINSTALL)/modules

LIBS =  $(LIBDIR)/libgraphics.a $(JUCELIB) $(LIBDIR)/libufcfgl-30-1.a

$(BUILD_DIR)/%.o: %.cpp Makefile | $(BUILD_DIR)
    $(ECHO) compiling $<
    $(CC) -c $(CFLAGS) $< -o $@

$(BUILD_DIR)/$(TARGET): $(OBJECTS) $(LIBS) Makefile
    $(ECHO) linking $<
    $(CC) $(OBJECTS) $(LIBS) $(LINUXLIBFALGS) $(LDFLAGS) -o $@
    $(ECHO) success

$(BUILD_DIR):
    mkdir -p $@

#######################################
# install
#######################################
install:


#######################################
# clean up
#######################################
clean:
    -rm -fR .dep $(BUILD_DIR)

#######################################
# dependencies
#######################################
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

.PHONY: clean all

gdb信息:

Thread 1 "graphics1" received signal SIGILL, Illegal instruction. 
0x000000000043a6ed in juce::File::isDirectory() const ()

0 个答案:

没有答案