怎样清除环境变量

2016年12月30日 | 分类: 【技术】

【案例:A】

因为错误设置环境变量,gcc坏掉了

checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/root/mod_gnutls-0.7.5':
configure: error: C compiler cannot create executables
See `config.log' for more details

参考:http://stackoverflow.com/questions/18872796/configure-error-c-compiler-cannot-create-executables-when-installing-ruby-1-9

In my case, the issue is due to the customized LDFLAGS. I was compiling one of python packages. Because my python is installed in a customized location, I had to temporarily set the LDFLAGS variable env. As soon as I unset this env variable, the problem went away. So FYI.

参考:http://blog.csdn.net/weiyidemaomao/article/details/7742605

因为刚才导致出问题的2个环境变量是 CFLAGS 和 LIBS :

unset CFLAGS && unset LIBS

【案例:B】

参考:https://amon.org/gcc

如果之前有执行过:

export CFLAGS="-std=c99"

可以执行以下命令取消:

export CFLAGS=""