gmake更改堆栈大小限制 [英] gmake change the stack size limit

查看:87
本文介绍了gmake更改堆栈大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我当前的环境是

$ ulimit -s
10240

但是,如果我通过gmake运行一个进程,则堆栈大小是无限的.例如(;:使gmake使用shell执行命令,否则它将尝试查找具有该名称的可执行文件)

But if I run a process through gmake, the stack size is unlimited. For instance (the ;: is to make gmake use the shell to execute the command, otherwise it will try to find an executable by that name)

$ cat Makefile
default:
        ulimit -s; :
$ gmake
ulimit -s; :
unlimited

  • 是否可以使gmake不更改限制?

    • is it possible to get gmake not changing the limit?

      如果没有,是否可以将所有规则的限制重置为我想要的值而无需修改它们(虽然我可以更改主Makefile,但有些规则来自所生成的包含文件并更改了生成逻辑开始带来自己的问题).

      if not, is it possible to reset the limit to what I want for all the rules without modifying them (while I may change the main Makefile, some rules comes from included files which are generated and changing the generation logic starts to bring its own problems).

      @MadScientist告诉我,这是3.81的问题,该问题已在3.82中修复.但是我还是很感激的.

      @MadScientist learned me that it is a problem with 3.81 which is fixed in 3.82. But I'd still appreciate a work around.

      推荐答案

      这听起来像 https://savannah.gnu.org/bugs/?22010 已在GNU make 3.82中修复.

      This sounds like https://savannah.gnu.org/bugs/?22010 fixed in GNU make 3.82.

      如果您无法更新GNU make的版本(3.82现在已经超过3年了……),并且您无法向后移植该修补程序,则可以尝试执行以下操作(未经测试);创建一个shell脚本来修改堆栈:

      If you can't update your version of GNU make (3.82 is, like, over 3 years old now...) and you can't backport the patch, you could try something like this (untested); create a shell script to modify the stack:

      $ cat stacksh
      #!/bin/sh
      ulimit -s ...
      exec /bin/sh "$@"
      
      $ chmod 755 stacksh
      

      然后在您的makefile中,重置SHELL以使用您的脚本:

      Then in your makefile, reset SHELL to use your script:

      SHELL := /path/to/stacksh
      

      现在make将调用您的shell脚本来运行命令,而不是/bin/sh

      Now make will invoke your shell script to run commands, instead of /bin/sh

      这篇关于gmake更改堆栈大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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