collect2:错误:ld以信号11 [分段故障]终止,核心已转储 [英] collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped

查看:253
本文介绍了collect2:错误:ld以信号11 [分段故障]终止,核心已转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当时正在使用GLFW学习OpenGL,但当时对makefile的了解还不多。我使用OpenGL,但是我决定学习更多makefile。经过大量的网站,时间和反复试验后,我想到了这一点:

I was learning OpenGL using GLFW, and didn't have a great understanding of makefiles at the time. I had OpenGL working, but I decided to learn makefiles more. I came up with this after a lot of websites, hours, and trial and error:

EXENAME = "OpenGL Demo"
CC = gcc
SRCS = ../src/OpenGLDemo.c
OBJS = $(SRCS: .c = .o)
CFLAGS = -Wall -g -c
LIBS = -L./libs -lglfw3 C:/Windows/SysWOW64/opengl32.dll C:/Windows/SysWOW64/glu32.dll

all: opengldemo exe

exe: $(OBJS)
    $(CC) $(OBJS) -o $(EXENAME) $(LIBS)

opengldemo: ../src/OpenGLDemo.c
    $(CC) $(CFLAGS) ../src/OpenGLDemo.c

clean:
    rm -f $(EXENAME)

rebuild: clean all

但是,当我编译时,它在尝试生成可执行文件时给出了此错误:

But, when I compile, it gives this error when it tries to build the executable:

collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped
makefile:11: recipe for target 'exe' failed
make: *** [exe] Error 1

它确实生成了可执行文件,但我的计算机说它无法运行。
我尝试搜索互联网,发现gcc错误报告包括此错误。我可能正在做一些愚蠢的操作来获取此错误。
如何解决此错误,它是什么意思?

It does build an executable, but my computer says it can't run it. I tried searching the internet, and found gcc bug reports including this error. There is probably something stupid that I am doing to get this error. How do I fix this error, and what does it mean?

编辑:完整输出:

make
gcc -Wall -g -c ../src/OpenGLDemo.c
gcc ../src/OpenGLDemo.c -o "OpenGL Demo" -L./libs -lglfw3
C:/Windows/SysWOW64/opengl32.dll C:/Windows/SysWOW64/glu32.dll
cygwin warning:
  MS-DOS style path detected: C:/Windows/SysWOW64/opengl32.dll
  Preferred POSIX equivalent is: /cygdrive/c/Windows/SysWOW64/opengl32.dll
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped
makefile:11: recipe for target 'exe' failed
make: *** [exe] Error 1


推荐答案

这表示 ld 工具或以下工具之一它的依赖项存在一个错误,该错误导致无效的内存访问(分段错误),操作系统将使用SIGSEGV(信号11)终止该进程。不管您的构建设置如何,它都不会崩溃。

It means that the ld tool or one of its dependencies has a bug which results in an invalid memory access (segmentation fault) on which the operating system kills the process with SIGSEGV (signal 11). It should not crash regardless of your build setup.

您可能应该在Linux上提交 ld 的错误报告。发行商或直接出售给 ld 工具的供应商(如果您的 ld 工具来自 GNU binutils )。

You should probably file a bug report for ld with your Linux distribution vendor or directly to the vendor of the ld tool (usually GNU in case your ld tool is from the GNU binutils).

这篇关于collect2:错误:ld以信号11 [分段故障]终止,核心已转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆