GNU make的-j选项 [英] GNU make's -j option

查看:105
本文介绍了GNU make的-j选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我了解-j以来,我就很乐意使用-j8.前几天,我正在编译地图集安装,但制作失败.最终,我将其归结为乱序的东西-一旦我回到单线程make上,它就可以很好地工作.这让我感到紧张.编写我自己的make文件时需要注意哪些条件,以避免使用make -j做意外的事情?

Ever since I learned about -j I've used -j8 blithely. The other day I was compiling an atlas installation and the make failed. Eventually I tracked it down to things being made out of order - and it worked fine once I went back to singlethreaded make. This makes me nervous. What sort of conditions do I need to watch for when writing my own make files to avoid doing something unexpected with make -j?

推荐答案

我认为make -j将尊重您在Makefile中指定的依赖项;也就是说,如果您指定objA取决于objB和objC,那么在objB和objC完成之前,make不会开始在objA上工作.

I think make -j will respect the dependencies you specify in your Makefile; i.e. if you specify that objA depends on objB and objC, then make won't start working on objA until objB and objC are complete.

很可能您的Makefile没有足够严格地指定必要的操作顺序,而且很幸运在单线程情况下它可以为您工作.

Most likely your Makefile isn't specifying the necessary order of operations strictly enough, and it's just luck that it happens to work for you in the single-threaded case.

这篇关于GNU make的-j选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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