How to make a “light” build of GCC with language supports etc. pruned?

只谈情不闲聊 提交于 2021-01-20 17:14:52

问题


Basically I would like to make a light build of GCC with only C/C++ support. Can this be done easily or does it require manual tinkering with source?


回答1:


This is covered in Installing GCC and Configuration

--enable-languages=lang1,lang2,...
Specify that only a particular subset of compilers and their runtime libraries should be built. For a list of valid values for langN you can issue the following command in the gcc directory of your GCC source tree:

         grep language= */config-lang.in

Currently, you can use any of the following: all, ada, c, c++, fortran, go, java, objc, obj-c++. Building the Ada compiler has special requirements, see below. If you do not pass this flag, or specify the option all, then all default languages available in the gcc sub-tree will be configured. Ada, Go and Objective-C++ are not default languages; the rest are.

So, for your case using:

../gcc/configure --enable-languages=c,c++

should be sufficient, besides other needed options, of course.

See also Building

Please note, that re-defining LANGUAGES when calling `make' does not work anymore!




回答2:


You can also use:

make install-strip

to reduce your installed size remarkably



来源:https://stackoverflow.com/questions/14728652/how-to-make-a-light-build-of-gcc-with-language-supports-etc-pruned

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!