Windows Bash - Emacs 构建失败 : Memory Protection Enabled

标签 windows bash emacs win-bash

我正在尝试在 Windows Bash(WinBash?Win-Bash?)中编译 emacs-24.4,但是遇到了一个问题,即 Windows 似乎启用了内存保护,这会破坏 emacs 构建。

“make”后出现的错误(./configure 工作正常)是:

Dumping under the name emacs
**************************************************
Warning: Your system has a gap between BSS and the
heap (25164600 bytes).  This usually means that exec-shield
or something similar is in effect.  The dump may
fail because of this.  See the section about
exec-shield in etc/PROBLEMS for more information.
**************************************************
/bin/bash: line 7:  6853 Segmentation fault      (core dumped) ./temacs --batch --load loadup bootstrap
make[1]: *** [bootstrap-emacs] Error 1
make[1]: Leaving directory `/home/tdwyer/bin/emacs-24.5_linux_build/src'
make: *** [src] Error 2

在 etc/PROBLEMS 文件中,相关部分给出:

*** Segfault during `make bootstrap' under the Linux kernel.

In Red Hat Linux kernels, "Exec-shield" functionality is enabled by
default, which creates a different memory layout that can break the
emacs dumper.  Emacs tries to handle this at build time, but if this
fails, the following instructions may be useful.

Exec-shield is enabled on your system if

    cat /proc/sys/kernel/exec-shield

prints a value other than 0.  (Please read your system documentation
for more details on Exec-shield and associated commands.)

Additionally, Linux kernel versions since 2.6.12 randomize the virtual
address space of a process by default.  If this feature is enabled on
your system, then

   cat /proc/sys/kernel/randomize_va_space

prints a value other than 0.

When these features are enabled, building Emacs may segfault during
the execution of this command:

    ./temacs --batch --load loadup [dump|bootstrap]

To work around this problem, you can temporarily disable these
features while building Emacs.  You can do so using the following
commands (as root).  Remember to re-enable them when you are done,
by echoing the original values back to the files.

    echo 0 > /proc/sys/kernel/exec-shield
    echo 0 > /proc/sys/kernel/randomize_va_space

Or, on x86, you can try using the `setarch' command when running
temacs, like this:

    setarch i386 -R ./temacs --batch --load loadup [dump|bootstrap]

or

    setarch i386 -R make

(The -R option disables address space randomization.)

而且,不出所料,如果我查看它是否已启用..它是:

$ cat /proc/sys/kernel/randomize_va_space
2

但不幸的是,我尝试禁用它(甚至以管理员身份运行 bash),但失败了:

$ sudo echo 0 > /proc/sys/kernel/randomize_va_space
bash: /proc/sys/kernel/randomize_va_space: Permission denied

此外,setarch 无法使用以下方式工作:

setarch x86_84 -R make 

建议?

最佳答案

查看说明: https://askubuntu.com/questions/318315/how-can-i-temporarily-disable-aslr-address-space-layout-randomization

重要部分:

to disable it, run

echo 0 | sudo tee /proc/sys/kernel/randomize_va_space

and to enable it again, run

echo 2 | sudo tee /proc/sys/kernel/randomize_va_space

关于Windows Bash - Emacs 构建失败 : Memory Protection Enabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38905344/

相关文章:

linux - ^M 落后于操作系统版本?

linux - 在 2 个文件中查找匹配项并打印匹配项上方的字段

linux - Bash - 用给定的日期计算

emacs - 如何在 Emacs 组织模式下查看新缓冲区中的 "Notes"?

emacs - 在 elisp 中,如何将函数放入变量中?

emacs - 如何在 Emacs 中使用 astyle?

windows - 自动生成对 powershell 命令的响应?

windows - 如何从字体文件中获取字体名称?

c++ - win32 : check if window is minimized

java - 如何从使用netbeans编写的java代码访问shell脚本文件中的变量值