简体   繁体   English

什么是大型C ++项目的推荐Eclipse CDT配置(索引器需要永远)

[英]What's the recommended Eclipse CDT configuration for big C++ project (indexer takes forever)

I'm working on some legacy C++ code written using "vi" and "emacs" and I am trying to build an eclipse CDT setup to maintain it (on linux). 我正在研究使用“vi”和“emacs”编写的一些遗留C ++代码,我正在尝试构建一个eclipse CDT设置来维护它(在linux上)。 The two main problems I've been facing are that the indexing takes very long (over 4h) and that even once that's finished, eclipse is barely responsive. 我遇到的两个主要问题是索引需要很长时间(超过4小时),即使一旦完成,eclipse几乎没有响应。

The code base is structured in a "3-4 level deep" manner: 代码库以“3-4级深度”方式构建:

/system/${category}/${library}/
/server/${serverName}/${component}/

Example: 例:

/system/CORE/CommandLine/*.cpp
/system/CORE/Connection/*.cpp
...
/server/Authentication/DB/Objects/*.cpp
/server/Authentication/Main/*.cpp

There are about 200 "modules" under /system/* and around 50 under /server/Authentication/*. 在/ system / *下大约有200个“模块”,在/ server / Authentication / *下大约有50个。 There is also an amazingly convoluted make system with 20 years worth of make-code written by people who wanted to showoff their make abilities :-) 还有一个令人惊讶的复杂的制作系统,有20年的制作代码 ,由想要展示他们的制作能力的人写的:-)

I've tried two approaches so far 到目前为止,我尝试了两种方法

1) Two eclipse cdt projects, namely /system and /Authentication 1)两个eclipse cdt项目,即/ system和/ Authentication

2) One eclipse cdt project per "module" ending up with +200 modules. 2)每个“模块”一个eclipse cdt项目,以+200模块结束。 I even calculated dependencies between modules. 我甚至计算了模块之间的依赖关系。

In both approaches, indexing takes very long. 在这两种方法中,索引都需要很长时间。 On approach 1) I get quite a few problems with non-resolved dependencies. 方法1)我遇到了很多未解决的依赖问题。 With approach 2) eclipse is barely responsive, when I ctrl+click a function I can go for a coffee and come back before it responds... 方法2)eclipse几乎没有响应,当我按住ctrl +点击一个功能我可以去喝咖啡然后在它响应之前回来...

Anyone out there has worked with big projects like these? 那里的任何人都曾参与过像这样的大项目吗? What do you suggest? 你有什么建议?

General recommendation here is to provide more RAM for Eclipse. 这里的一般建议是为Eclipse提供更多RAM。 First, you will need to tweak your eclipse.ini configuration file as the default one is not suitable for big projects. 首先,您需要调整eclipse.ini配置文件,因为默认配置文件不适合大型项目。 Here is my eclipse.ini file: 这是我的eclipse.ini文件:

-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms512M 
-Xmx4096M 
-XX:PermSize=256M 
-XX:MaxPermSize=512M

Here I used -Xmx4096M to provide 4Gb of RAM. 在这里,我使用-Xmx4096M来提供4Gb的RAM。

To improve responsiveness you will also need to configure Indexer Cache limits . 要提高响应速度,还需要配置Indexer Cache限制 I recommend to increase all parameters by 2-3 times, depending on project size. 我建议将所有参数增加2-3倍,具体取决于项目大小。

Using the Project resource filters helped me a lot. 使用Project资源过滤器对我帮助很大。 I removed from the project tree folders which I didn't want either to modify or to submit to indexing. 我从项目树文件夹中删除了我不想修改或提交索引的文件夹。

To create a new filter just right click on the project and then open the Properties panel then reach Resource -> Resource Filters 要创建新过滤器,只需右键单击项目,然后打开“ 属性”面板,然后访问“ 资源” - >“资源过滤器”

http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/resourcefilters.htm http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/concepts/resourcefilters.htm

Sometimes if your project sources are too big (ex: about 5GB ) you need to use a filter otherwise the indexing process never end correctly. 有时,如果项目源太大(例如:大约5GB),则需要使用过滤器,否则索引过程永远不会正确结束。

-Xss8g on eclipse.ini was also needed on Neon to prevent stack overflow. 在Neon上也需要eclipse.ini上的-Xss8g来防止堆栈溢出。

Also consider ulimit -Sv unlimited . 还要考虑ulimit -Sv unlimited

Tested on Ubuntu 14.04. 在Ubuntu 14.04上测试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM