首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GNU在Ubuntu-20.04上制造3.82运行时错误:分段错误(内核转储)

GNU在Ubuntu-20.04上制造3.82运行时错误:分段错误(内核转储)
EN

Stack Overflow用户
提问于 2022-08-21 12:34:49
回答 1查看 162关注 0票数 0

我从GNU下载了gnu-mak-3.82,并在我的Ubuntu-20.04机器上的一个特定目录(例如dir)上制作和安装它。

然后我跑了

代码语言:javascript
复制
$file dir/make

它返回:

ELF 64位LSB共享对象,x86-64,version 1 (SYSV),动态链接,解释器/LSB 64/ld-Linux-x86-64.so.2,BuildIDsha1=ef2934bdbc32938713fd4cb1c9a733e8b6785af0,for GNU/Linux3.2.0,带有debug_info,没有剥离

当我跑的时候

代码语言:javascript
复制
$dir/make --version

它返回:

代码语言:javascript
复制
GNU Make 3.82
Built for x86_64-unknown-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

当我使用最简单的Makefile运行它时,它会生成错误:

分段故障(堆芯倾弃)

为什么?我还需要做哪些额外的工作才能使它正常工作?

EN

回答 1

Stack Overflow用户

发布于 2022-08-27 09:01:14

根据@steeldriver的提示,我对dir.c做了以下更改。

代码语言:javascript
复制
diff --git a/dir.c b/dir.c
index adbb8a9..c343e4c 100644
--- a/dir.c
+++ b/dir.c
@@ -1299,15 +1299,40 @@ local_stat (const char *path, struct stat *buf)
 }
 #endif
 
+/* Similarly for lstat.  */
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
+# ifndef VMS
+#  ifndef HAVE_SYS_STAT_H
+int lstat (const char *path, struct stat *sbuf);
+#  endif
+# else
+    /* We are done with the fake lstat.  Go back to the real lstat */
+#   ifdef lstat
+#     undef lstat
+#   endif
+# endif
+# define local_lstat lstat
+#elif defined(WINDOWS32)
+/* Windows doesn't support lstat().  */
+# define local_lstat local_stat
+#else
+static int
+local_lstat (const char *path, struct stat *buf)
+{
+  int e;
+  EINTRLOOP (e, lstat (path, buf));
+  return e;
+}
+#endif
+
 void
 dir_setup_glob (glob_t *gl)
 {
   gl->gl_opendir = open_dirstream;
   gl->gl_readdir = read_dirstream;
   gl->gl_closedir = free;
+  gl->gl_lstat = local_lstat;
   gl->gl_stat = local_stat;
-  /* We don't bother setting gl_lstat, since glob never calls it.
-     The slot is only there for compatibility with 4.4 BSD.  */
 }

然后重新制作并运行它。它可以正常工作,没有任何警告或错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73434446

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档