zoukankan      html  css  js  c++  java
  • Ubuntu 15.04 clang++ 3.6 编译boost 1.59/1.55

    Ubuntu 15.04已经可以直接通过apt-get insall 安装clang 3.6, 并且预装的gcc版本是4.9.2。这些安装过程在这里介绍。

    首先下载boost源码

    [plain] view plain copy
     
     print?
    1. wget -O boost.1.59.tar.bz2 http://sourceforge.net/projects/boost/files/latest/download?source=files  


    解压

    [plain] view plain copy
     
     print?
    1. tar jxvf ./boost.1.59.tar.bz2   

    指定clang工具,生成编译脚本

    [plain] view plain copy
     
     print?
    1. ./bootstrap.sh --with-libraries=system,filesystem,log,atomic,thread,program_options --with-toolset=clang  

    编译并安装

    [plain] view plain copy
     
     print?
    1. ./b2 toolset=clang cxxflags="-std=c++11"   
    2. sudo ./b2 install --prefix=/usr    

    等一会儿就好。

    要注意的是,boost 1.59 似乎有问题,因为编译安装之后,我的一个简单的使用boost log的程序编译会报错,错误如下:

    [plain] view plain copy
     
     print?
    1. clang++ -g -std=c++11 -I../include -Wall -DBOOST_LOG_DYN_LINK -o  
    2.   
    3. ./object/main.cc.o -c ../src/main.cc In file included from  
    4.   
    5. ../src/main.cc:8: In file included from ../include/helper/logger.h:16:  
    6.   
    7. In file included from /usr/include/boost/log/sinks.hpp:25: In file  
    8.   
    9. included from /usr/include/boost/log/sinks/async_frontend.hpp:42: In  
    10.   
    11. file included from  
    12.   
    13. /usr/include/boost/log/sinks/unbounded_fifo_queue.hpp:29: In file  
    14.   
    15. included from /usr/include/boost/log/detail/event.hpp:25: In file  
    16.   
    17. included from /usr/include/boost/atomic/capabilities.hpp:18: In file  
    18.   
    19. included from /usr/include/boost/atomic/detail/platform.hpp:22:  
    20.   
    21. /usr/include/boost/atomic/detail/gcc-atomic.hpp:35:67: error: unknown  
    22.   
    23. type name 'memory_order' BOOST_FORCEINLINE BOOST_CONSTEXPR int  
    24.   
    25. convert_memory_order_to_gcc(memory_order order) BOOST_NOEXCEPT  
    26.   
    27. /usr/include/boost/atomic/detail/gcc-atomic.hpp:37:22: error: use of  
    28.   
    29. undeclared identifier 'memory_order_relaxed'  


    当我降级到boost 1.55.0后,问题消失。

    http://blog.csdn.net/csfreebird/article/details/48877657

  • 相关阅读:
    Python基础06 循环
    Python基础04 运算
    Python基础02 基本数据类型
    Python基础03 序列
    C++ ------ 引用
    C++ ------ 互斥锁、原子操作的性能测试
    Qt ------ 断开某对信号与槽的connect
    5种网络通信设计模型(也称IO模型)
    Qt ------ 主事件循环与 QEventLoop
    Qt ------ 再论事件循环
  • 原文地址:https://www.cnblogs.com/findumars/p/7433782.html
Copyright © 2011-2022 走看看