命令在 Makefile 中隐式线程化?
我有一个“超级”makefile,它启动两个“子”make 文件:
libwebcam: @echo -e "\n调用 libwebcam make。" $(MAKE) -C $(TOPDIR)/libwebcam
uvcdynctrl: @echo -e "\n调用 uvcdynctrl make。" $(MAKE) -C $(TOPDIR)/uvcdynctrl
uvcdynctrl 使用 libwebcam...我注意到这两个构建是由 make 作为单独的线程启动的!因此,有时当 uvcdynctrl 开始构建时,该库不可用,并且我会收到错误。默认情况下,make 不应将命令作为线程启动,因为这只能通过 -j(作业数)来实现,并且根据 make 手册,默认情况下没有线程。我在 Ubuntu 上运行这个。
有人面临同样的问题吗?
苹果92
I have a "super" makefile which launches two "sub" make file:
libwebcam:
@echo -e "\nInvoking libwebcam make."
$(MAKE) -C $(TOPDIR)/libwebcam
uvcdynctrl:
@echo -e "\nInvoking uvcdynctrl make."
$(MAKE) -C $(TOPDIR)/uvcdynctrl
uvcdynctrl uses libwebcam... I noticed that those two builds are launched as separate threads by make ! Thus sometimes the lib is not available when uvcdynctrl starts being built, and I get errors. By default, make should not launch commands as threads since this is available only through -j (number of jobs) and, according to the make manual, there is no thread by default. I run this on an Ubuntu.
Did someone face the same issue ?
Apple92
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道为什么你的命令被线程化,但线程不是问题,依赖才是问题。如果正确设置依赖项,则不会出现此错误,如果不正确,则可能会出现线程或无线程。
在 uvcdynctrl makefile 中,将 libwebcam 作为 uvcdynctrl 的先决条件,并放入制作 libwebcam 的规则。
I don't know why you're commands are being threaded, but threading is not the problem, dependency is. If you set up the dependency correctly this error won't appear and if you don't it may appear, threads or no threads.
In the uvcdynctrl makefile, make libwebcam a prerequisite of uvcdynctrl and put in the rule for making libwebcam.
它们不应同时构建,除非您在顶级调用中指定要 make 的 -j 参数。如果您这样做,那么您需要正确设置依赖项,以注意 uvcdynctrl 依赖于 libwebcam。
They should not be built concurrently unless you specify a -j argument to make at your top-level invocation. If you are doing so, then you need to set up dependencies properly to note that uvcdynctrl depends on libwebcam.