通过Vmware构建Linux应用程序
我曾经在 Windows 上使用 Visual Studio 进行开发...(C++)
我们最近将我们的应用程序迁移到 Linux(红帽),目前每个员工正在使用 Vmware 构建自己的应用程序是他自己的虚拟机。原生操作系统仍然是Windows。
起初,似乎使用 g++ 构建比使用 VS 编译器更快,但是,一段时间后,似乎发现它相当慢。是因为我们使用的是Vmware吗? 我们可以采取哪些措施来加快建设进程?
I used to develop using Visual Studio on windows... (C++)
we recently migrated our app to linux (red-hat) , and currently each employee is building his own app is his own virtual machine using Vmware. out native OS is still Windows.
At first, it seemed that building using g++ was faster then using VS compiler, however, after some time, it seems like it tured out to be pretty slow. Is it beacuse we're using Vmware ?
are there things we can do to accelerate the building process ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
g++ 不是一个速度守护进程,但它性能良好。是的,虚拟机的性能可能不稳定,尤其是在磁盘访问方面。您始终可以尝试 ccache 以避免重新编译不需要的部分。
或者,放弃 VMWare(以及底层的 Windows)并在 Linux 上完成这一切。可以使用专用的构建箱,也可以在您自己的机器上。如果您必须有一个功能齐全的GUI来进行写作,QtCreator 完全可以胜任这项任务(不,它不仅仅局限于编写 Qt 应用程序)。
g++ is not a speed daemon, but it performs well. Yes, a VM can have unsteady performance, especially on disk access. You can always try ccache to avoid recompiling the parts you don't need to.
Or, ditch VMWare (and windows underneath) and do it all on Linux. either with a dedicated build box, or on your own machine. if you have to have a full featured GUI for writing, QtCreator is quite up to the task (no, it's not tied to only writing Qt applications).
我从来没有真正注意到 g++ 比 VS 慢或相反,但有一些方法可以使 g++ 运行得更快。
ccache 例如。我尝试了一下,确实加快了编译速度。
<块引用>
ccache 是编译器缓存。它通过缓存以前的编译并检测何时再次进行相同的编译来加速 C/C++ 代码的重新编译
如果您在多核计算机上工作,您可能想要进行多进程编译,如果您正在使用 make you可以执行
make -jX
其中 X 是您的核心数量。 请注意,您必须在虚拟机上启用多核。禁用编译器优化。
也就是说,无论你做什么,虚拟机上的编译都不会像真实机器上的编译那么高效。
I never really noticed that g++ was slower than VS or the opposite, but there is ways to make g++ go a lot faster.
ccache for instance. I tried it and it really speeds up the compilation.
If you're working on a multicore machine you probably want to do multiprocess compilation, if you're using make you can do
make -jX
where X is your number of cores. Note you'll have to enable multicore on your virtual machines.Disable compiler optimizations.
That said, whatever you do, compilation on a virtual machine wont be as efficient as compilation on a real machine.