黄色网页视频 I 影音先锋日日狠狠久久 I 秋霞午夜毛片 I 秋霞一二三区 I 国产成人片无码视频 I 国产 精品 自在自线 I av免费观看网站 I 日本精品久久久久中文字幕5 I 91看视频 I 看全色黄大色黄女片18 I 精品不卡一区 I 亚洲最新精品 I 欧美 激情 在线 I 人妻少妇精品久久 I 国产99视频精品免费专区 I 欧美影院 I 欧美精品在欧美一区二区少妇 I av大片网站 I 国产精品黄色片 I 888久久 I 狠狠干最新 I 看看黄色一级片 I 黄色精品久久 I 三级av在线 I 69色综合 I 国产日韩欧美91 I 亚洲精品偷拍 I 激情小说亚洲图片 I 久久国产视频精品 I 国产综合精品一区二区三区 I 色婷婷国产 I 最新成人av在线 I 国产私拍精品 I 日韩成人影音 I 日日夜夜天天综合

NDK編譯Boost(Cygwin環(huán)境)

系統(tǒng) 2649 0

  因?yàn)閙apnik需要部分Boost模塊的支持,所以需要編譯Boost庫(kù)。Boost直接在Windows或者Linux下編譯并不難,幾條指令可以搞定,但是對(duì)于交叉編譯,正如本文將要闡述的使用NDK進(jìn)行編譯,確實(shí)是比較頭疼。借助萬(wàn)能的Google和Baidu,我將看到的方法做以整理并進(jìn)行了親測(cè)。

  不過(guò)在這之前,我想闡明一個(gè)誤區(qū),也是給自己補(bǔ)了個(gè)課。就是Boost庫(kù)在使用的時(shí)候,并不是都需要編譯的。有一小部分和平臺(tái)相關(guān)的模塊必須要編譯,大部分直接引用頭文件即可以使用。畢竟Boost太過(guò)龐大,全部編譯浪費(fèi)時(shí)間,按需使用最佳。以下是從Boost官網(wǎng)摘錄的說(shuō)明,在此不做翻譯了,這點(diǎn)單詞對(duì)碼農(nóng)來(lái)說(shuō),不是事。

The only Boost libraries that must be built separately are:

A few libraries have optional separately-compiled binaries:

  • Boost.DateTime has a binary component that is only needed if you're using its to_string / from_string or serialization features, or if you're targeting Visual C++ 6.x or Borland.
  • Boost.Graph also has a binary component that is only needed if you intend to parse GraphViz files .
  • Boost.Math has binary components for the TR1 and C99 cmath functions.
  • Boost.Random has a binary component which is only needed if you're using random_device .
  • Boost.Test can be used in “header-only” or “separately compiled” mode, although separate compilation is recommended for serious use .
  • Boost.Exception provides non-intrusive implementation of exception_ptr for 32-bit _MSC_VER==1310 and _MSC_VER==1400 which requires a separately-compiled binary. This is enabled by #define BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR.

  接下來(lái)介紹編譯步驟,我是在Windows下使用NDK編譯,所以選擇了Cygwin的環(huán)境,純Linux下方法大同小異。

  NDK版本:官方版 R10c

  Boost版本:1.57

  1、下載boost_1_57_0.tar.gz,將其放到Cygwin虛擬的Linux目錄下,比如/usr/。

  2、打開Cygwin,利用tar zxvf指令將boost_1_57_0.tar.gz解壓。

  3、cd到解壓后的Boost根目錄下,執(zhí)行?./bootstrap.sh,生成boost編譯工具。

  4、用文本編輯器打開根目錄下的project-config.jam文件,修改為如下內(nèi)容:

      
        import os ;

   

if [ os.name ] = CYGWIN || [ os.name ] = NT {  

    androidPlatform = windows ;  

    }  

    else if [ os.name ] = LINUX {  

    androidPlatform = linux-x86_64 ;  

    }  

    else if [ os.name ] = MACOSX {  

    androidPlatform = darwin-x86 ;  

    }  

 

ANDROID_NDK = 
        
          <
          
            實(shí)際的NDK
            
              路徑
              
                >
                
                   ; using gcc : android4.9 : $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-g++ : 
                  
                    <
                    
                      archiver
                      
                        >
                        
                          $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ar 
                          
                            <
                            
                              ranlib
                              
                                >
                                
                                  $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(androidPlatform)/bin/arm-linux-androideabi-ranlib 
                                  
                                    <
                                    
                                      compileflags
                                      
                                        >
                                        
                                          -I$(ANDROID_NDK)/platforms/android-19/arch-arm/usr/include 
                                          
                                            <
                                            
                                              compileflags
                                              
                                                >
                                                
                                                  -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/include 
                                                  
                                                    <
                                                    
                                                      compileflags
                                                      
                                                        >
                                                        
                                                          -I$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/include 
                                                          
                                                            <
                                                            
                                                              compileflags
                                                              
                                                                >
                                                                
                                                                  -fexceptions 
                                                                  
                                                                    <
                                                                    
                                                                      compileflags
                                                                      
                                                                        >
                                                                        
                                                                          -frtti 
                                                                          
                                                                            <
                                                                            
                                                                              compileflags
                                                                              
                                                                                >
                                                                                
                                                                                  -fpic 
                                                                                  
                                                                                    <
                                                                                    
                                                                                      compileflags
                                                                                      
                                                                                        >
                                                                                        
                                                                                          -ffunction-sections 
                                                                                          
                                                                                            <
                                                                                            
                                                                                              compileflags
                                                                                              
                                                                                                >
                                                                                                
                                                                                                  -funwind-tables 
                                                                                                  
                                                                                                    <
                                                                                                    
                                                                                                      compileflags
                                                                                                      
                                                                                                        >
                                                                                                        
                                                                                                          -D__ARM_ARCH_5__ 
                                                                                                          
                                                                                                            <
                                                                                                            
                                                                                                              compileflags
                                                                                                              
                                                                                                                >
                                                                                                                
                                                                                                                  -D__ARM_ARCH_5T__ 
                                                                                                                  
                                                                                                                    <
                                                                                                                    
                                                                                                                      compileflags
                                                                                                                      
                                                                                                                        >
                                                                                                                        
                                                                                                                          -D__ARM_ARCH_5E__ 
                                                                                                                          
                                                                                                                            <
                                                                                                                            
                                                                                                                              compileflags
                                                                                                                              
                                                                                                                                >
                                                                                                                                
                                                                                                                                  -D__ARM_ARCH_5TE__ 
                                                                                                                                  
                                                                                                                                    <
                                                                                                                                    
                                                                                                                                      compileflags
                                                                                                                                      
                                                                                                                                        >
                                                                                                                                        
                                                                                                                                          -Wno-psabi 
                                                                                                                                          
                                                                                                                                            <
                                                                                                                                            
                                                                                                                                              compileflags
                                                                                                                                              
                                                                                                                                                >
                                                                                                                                                
                                                                                                                                                  -march=armv5te 
                                                                                                                                                  
                                                                                                                                                    <
                                                                                                                                                    
                                                                                                                                                      compileflags
                                                                                                                                                      
                                                                                                                                                        >
                                                                                                                                                        
                                                                                                                                                          -mtune=xscale 
                                                                                                                                                          
                                                                                                                                                            <
                                                                                                                                                            
                                                                                                                                                              compileflags
                                                                                                                                                              
                                                                                                                                                                >
                                                                                                                                                                
                                                                                                                                                                  -msoft-float 
                                                                                                                                                                  
                                                                                                                                                                    <
                                                                                                                                                                    
                                                                                                                                                                      compileflags
                                                                                                                                                                      
                                                                                                                                                                        >
                                                                                                                                                                        
                                                                                                                                                                          -mthumb 
                                                                                                                                                                          
                                                                                                                                                                            <
                                                                                                                                                                            
                                                                                                                                                                              compileflags
                                                                                                                                                                              
                                                                                                                                                                                >
                                                                                                                                                                                
                                                                                                                                                                                  -Os 
                                                                                                                                                                                  
                                                                                                                                                                                    <
                                                                                                                                                                                    
                                                                                                                                                                                      compileflags
                                                                                                                                                                                      
                                                                                                                                                                                        >
                                                                                                                                                                                        
                                                                                                                                                                                          -fomit-frame-pointer 
                                                                                                                                                                                          
                                                                                                                                                                                            <
                                                                                                                                                                                            
                                                                                                                                                                                              compileflags
                                                                                                                                                                                              
                                                                                                                                                                                                >
                                                                                                                                                                                                
                                                                                                                                                                                                  -fno-strict-aliasing 
                                                                                                                                                                                                  
                                                                                                                                                                                                    <
                                                                                                                                                                                                    
                                                                                                                                                                                                      compileflags
                                                                                                                                                                                                      
                                                                                                                                                                                                        >
                                                                                                                                                                                                        
                                                                                                                                                                                                          -finline-limit=64 
                                                                                                                                                                                                          
                                                                                                                                                                                                            <
                                                                                                                                                                                                            
                                                                                                                                                                                                              compileflags
                                                                                                                                                                                                              
                                                                                                                                                                                                                >
                                                                                                                                                                                                                
                                                                                                                                                                                                                  -Wa,--noexecstack 
                                                                                                                                                                                                                  
                                                                                                                                                                                                                    <
                                                                                                                                                                                                                    
                                                                                                                                                                                                                      compileflags
                                                                                                                                                                                                                      
                                                                                                                                                                                                                        >
                                                                                                                                                                                                                        
                                                                                                                                                                                                                          -DANDROID 
                                                                                                                                                                                                                          
                                                                                                                                                                                                                            <
                                                                                                                                                                                                                            
                                                                                                                                                                                                                              compileflags
                                                                                                                                                                                                                              
                                                                                                                                                                                                                                >
                                                                                                                                                                                                                                
                                                                                                                                                                                                                                  -D__ANDROID__ 
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                    <
                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                      compileflags
                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                        >
                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                          -DNDEBUG 
                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                            <
                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                              compileflags
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                >
                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                  -O2 
                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                    <
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                      compileflags
                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                        >
                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                          -g ; project : default-build 
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                            <
                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                              toolset
                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                >
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                  gcc-android4.9 ; # List of --with-
                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                    <
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                      library
                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                        > and --without-
                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                          <
                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                            library
                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                              >
                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                 # options. If left empty, all libraries will be built. # Options specified on the command line completely # override this variable. libraries = --with-filesystem --with-thread --with-system --with-regex --with-program_options ;
                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                
                                                                                                                                                                                                                              
                                                                                                                                                                                                                            
                                                                                                                                                                                                                          
                                                                                                                                                                                                                        
                                                                                                                                                                                                                      
                                                                                                                                                                                                                    
                                                                                                                                                                                                                  
                                                                                                                                                                                                                
                                                                                                                                                                                                              
                                                                                                                                                                                                            
                                                                                                                                                                                                          
                                                                                                                                                                                                        
                                                                                                                                                                                                      
                                                                                                                                                                                                    
                                                                                                                                                                                                  
                                                                                                                                                                                                
                                                                                                                                                                                              
                                                                                                                                                                                            
                                                                                                                                                                                          
                                                                                                                                                                                        
                                                                                                                                                                                      
                                                                                                                                                                                    
                                                                                                                                                                                  
                                                                                                                                                                                
                                                                                                                                                                              
                                                                                                                                                                            
                                                                                                                                                                          
                                                                                                                                                                        
                                                                                                                                                                      
                                                                                                                                                                    
                                                                                                                                                                  
                                                                                                                                                                
                                                                                                                                                              
                                                                                                                                                            
                                                                                                                                                          
                                                                                                                                                        
                                                                                                                                                      
                                                                                                                                                    
                                                                                                                                                  
                                                                                                                                                
                                                                                                                                              
                                                                                                                                            
                                                                                                                                          
                                                                                                                                        
                                                                                                                                      
                                                                                                                                    
                                                                                                                                  
                                                                                                                                
                                                                                                                              
                                                                                                                            
                                                                                                                          
                                                                                                                        
                                                                                                                      
                                                                                                                    
                                                                                                                  
                                                                                                                
                                                                                                              
                                                                                                            
                                                                                                          
                                                                                                        
                                                                                                      
                                                                                                    
                                                                                                  
                                                                                                
                                                                                              
                                                                                            
                                                                                          
                                                                                        
                                                                                      
                                                                                    
                                                                                  
                                                                                
                                                                              
                                                                            
                                                                          
                                                                        
                                                                      
                                                                    
                                                                  
                                                                
                                                              
                                                            
                                                          
                                                        
                                                      
                                                    
                                                  
                                                
                                              
                                            
                                          
                                        
                                      
                                    
                                  
                                
                              
                            
                          
                        
                      
                    
                  
                
              
            
          
        
      
    

  其中NDK路徑請(qǐng)根據(jù)實(shí)際情況填寫,另外gcc的版本也可以根據(jù)實(shí)際情況進(jìn)行改動(dòng)。libraries后面跟需要編寫的Boost模塊,需要哪個(gè)加哪個(gè)。

  Ps:此步驟和網(wǎng)上流傳的方法有一些出入,按照其說(shuō)法是”?修改 boost/tools/build/v2/user-config.jam“,但實(shí)際Boost1.57中并沒有生成此文件,懷疑可能跟新版本中Boost修改了Bjam有關(guān)。

  5、執(zhí)行./b2 toolset=gcc-android4.9 link=static threading=multi?target-os=linux --stagedir=android,--stagedir跟生成路徑。

?

  至此,就生成了編譯好的Boost模塊了。其中第四步的代碼是我綜合了網(wǎng)上的代碼和一個(gè)開源項(xiàng)目Boost for Android中的代碼,里面有很多編譯選項(xiàng)我也不是很懂,希望可以和大家交流。不過(guò)有一點(diǎn)可以保證,就是順利的編譯。

  順便吐槽下,mapnik確實(shí)是個(gè)很難配置的東西,我花了很長(zhǎng)時(shí)間才讓它能用,因?yàn)樾枰嗟钠渌麕?kù)支持,特別是在Android上使用,需要交叉編譯。后面有空我會(huì)逐一整理出來(lái),也希望有興趣的朋友一起交流。

?

?

NDK編譯Boost(Cygwin環(huán)境)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論