Compiler¶
GCC/G++¶
gcc/g++ Options¶
-
-dumpmachine
: print the compiler's target machine (for example, arm-linux-gnueabihf) -
-dM -E
:gcc -dM -E - < /dev/null
: 显示所有预定义的宏
-
编译属性
__attribute__
Faster Compilers¶
ccache: a fast C/C++ compiler cache¶
ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Supported languages are C, C++, Objective-C and Objective-C++.
-
install in Ubuntu
-
CMake configuration:
-
Usage with Android NDK
-
To see if ccache is really working, you can use
ccache -s
command, which will display ccache statistics, on second and all subsequent compilations the cache hit values should increase and thus show that ccache is working:
distcc: a fast, free distributed C/C++ compiler¶
distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code across several machines on a network. distcc should always generate the same results as a local build, is simple to install and use, and is usually much faster than a local compile.