最後更新: 2021-07-21
目錄
- INCLUDE_PATH (pkg-config)
- Build Opts
- Optimization
- Options for Debugging
- Centos install new version gcc
INCLUDE_PATH (pkg-config)
Try setting C_INCLUDE_PATH (for C header files) or CPLUS_INCLUDE_PATH (for C++ header files).
The path searched depends on the implementation (and current configuration).
The correct way to find the include path is to use pkg-config (Return metainformation about installed libraries)
pkg-config --cflags gstreamer
--cflags
This prints pre-processor and compile flags required to compile the
packages on the command line, including flags for all their dependen‐
cies. Flags are "compressed" so that each identical flag appears only
once. pkg-config exits with a nonzero code if it can't find metadata
for one or more of the packages on the command line.
gcc -v -E -
-E Stop after the preprocessing stage; do not run the compiler proper.
You can add as many default paths as you want with compiler option - "-I /my/new/path"
The default paths are
- /usr/local/include
- /usr/include
Build Opts
--with-cc-opt
sets additional parameters that will be added to the CFLAGS variable.
不是對所有 Package 也有效
Example: nginx
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
--with-ld-opt
sets additional parameters that will be used during linking.
--with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
Options for Debugging
-g
Produce debugging information in the operating system’s native format (stabs, COFF, XCOFF, or DWARF).
Centos install new version gcc
# 1. Install a package with repository for your system:
yum install centos-release-scl
# On RHEL, enable RHSCL repository for you system:
yum-config-manager --enable rhel-server-rhscl-7-rpms
# 2. Install the collection:
yum install devtoolset-8
# 3. Start using software collections:
scl enable devtoolset-8 bash