在调用openssl库时,遇到路径包含问题,于是记录解决的问题如下:
gedit /etc/profile文件,添加如下代码:
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/ssl/include
export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/ssl/include
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib
月度归档:2015年04月
头文件搜索顺序
头文件搜索顺序:
1.由参数-I指定的路径(指定路径有多个路径时,按指定路径的顺序搜索)
2.然后找gcc的环境变量 C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH
3.再找内定目录
/usr/include
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.2/include
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
库文件,但是如果装gcc的时候,是有给定的prefix的话,那么就是
/usr/include
prefix/include
prefix/xxx-xxx-xxx-gnulibc/include
prefix/lib/gcc-lib/xxxx-xxx-xxx-gnulibc/2.8.1/include
动态库搜索路径先后顺序
动态库的搜索路径搜索的先后顺序是:
1.编译目标代码时指定的动态库搜索路径;
2.环境变量LD_LIBRARY_PATH指定的动态库搜索路径;
3.配置文件/etc/ld.so.conf中指定的动态库搜索路径;
4.默认的动态库搜索路径/lib;
5.默认的动态库搜索路径/usr/lib。
centos5.8下的多个gcc版本切换
1.列出可用的gcc版本:
Yum list gcc
gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, …)
gcc-c++.x86_64 : C++ support for GCC
gcc-gfortran.x86_64 : Fortran 95 support
gcc-gnat.x86_64 : Ada 95 support for GCC
gcc-java.x86_64 : Java support for GCC
gcc-objc++.x86_64 : Objective-C++ support for GCC
gcc-objc.x86_64 : Objective-C support for GCC
gcc44.x86_64 : GNU Compiler Collection version 4.4
gcc44-c++.x86_64 : C++ support for GCC version 4.4
gcc44-gfortran.x86_64 : Fortran support for GCC 4.4
2.安装gcc4.4的版本
yum -y install gcc44*
3.列出gcc版本,准备切换新版本
ls /usr/bin/g*
结果中包括以下几个文件:
/usr/bin/g++
/usr/bin/g++44
/usr/bin/gcc
/usr/bin/gcc44
/usr/bin/gcov
/usr/bin/gcov44
4.切换版本
sudo mv /usr/bin/g++ /usr/bin/g++41
sudo mv /usr/bin/gcc /usr/bin/gcc41
sudo mv /usr/bin/gcov /usr/bin/gcov41
sudo mv /usr/bin/gcov44 /usr/bin/gcov
sudo mv /usr/bin/gcc44 /usr/bin/gcc
sudo mv /usr/bin/g++44 /usr/bin/g++
Celery与redis的异步任务
从官方文档,熟悉其使用:
http://docs.celeryproject.org/en/master/getting-started/first-steps-with-celery.html
1.mkdir celerytest
2.cd celerytest
创建以下两个文件。
Tasks.py
from celery import Celery
# app = Celery(‘tasks’, broker=’amqp://guest@localhost//’)
app = Celery(‘tasks’, backend=’redis://localhost:6379/1′, broker=’redis://localhost:6379/0′)
# app = Celery(‘tasks’, broker=’redis://localhost:6379/0′) no result return
@app.task
def add(x, y):
return x + y
————
Test.py
from tasks import add
result = []
if __name__ == ‘__main__’:
for i in range(10):
for j in range(100):
result.append(add.delay(i, j))
for r in result:
print r.ready(),r.get()
在celerytest目录下执行以下命令
3.celery -A tasks worker –loglevel=info
4.运行test.py程序