欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

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

系統(tǒng) 2396 0

  因為mapnik需要部分Boost模塊的支持,所以需要編譯Boost庫。Boost直接在Windows或者Linux下編譯并不難,幾條指令可以搞定,但是對于交叉編譯,正如本文將要闡述的使用NDK進行編譯,確實是比較頭疼。借助萬能的Google和Baidu,我將看到的方法做以整理并進行了親測。

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

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.

  接下來介紹編譯步驟,我是在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 = 
        
          <
          
            實際的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路徑請根據(jù)實際情況填寫,另外gcc的版本也可以根據(jù)實際情況進行改動。libraries后面跟需要編寫的Boost模塊,需要哪個加哪個。

  Ps:此步驟和網(wǎng)上流傳的方法有一些出入,按照其說法是”?修改 boost/tools/build/v2/user-config.jam“,但實際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)上的代碼和一個開源項目Boost for Android中的代碼,里面有很多編譯選項我也不是很懂,希望可以和大家交流。不過有一點可以保證,就是順利的編譯。

  順便吐槽下,mapnik確實是個很難配置的東西,我花了很長時間才讓它能用,因為需要太多的其他庫支持,特別是在Android上使用,需要交叉編譯。后面有空我會逐一整理出來,也希望有興趣的朋友一起交流。

?

?

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


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

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

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

【本文對您有幫助就好】

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

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 青青99| 免费激情视频在线观看 | 在线国产一区二区 | 一区二区三区四区高清视频 | 欧美顶级xxxxbbbb | 一级毛片 在线播放 | 久久精品一区 | 久久精品视频5 | 国产精品小黄鸭一区二区三区 | 国产免费一级淫片 | 青青青青久久久久国产的 | 国产精品久久久久久久久久久久 | 天天影视色香欲综合网老头 | 免费国产成人高清视频网站 | 欧美一区二区三区视频 | 欧美精品在线一区 | 日韩欧美中文字幕视频 | 精品视频国产 | 伊人久久国产精品 | 久久婷五月综合 | 欧美日韩一级视频 | 九九九九九九精品任你躁 | 久草8 | 欧美在线中文字幕 | 欧美成人免费在线视频 | 精品久久久久久无码中文字幕 | 国产一精品一av一免费爽爽 | 日韩手机在线观看 | 日本黄视频在线观看 | 一道本不卡视频 | 日本高清天码一区在线播放 | 欧美一区二区在线播放 | 91精品国产综合久久久久久 | 欧美日韩一区二区三区免费视频 | 欧美高清第一页 | 日本高清在线中文字幕网 | 欧美性高清视频免费看www | 国产精品高清在线 | 伊人久久大杳蕉综合大象 | 久久精品日韩 | 久久精品天天中文字幕人 |