CentOS下CPPCMS的編譯指南

來源:互聯網
上載者:User

     1.下載最新版本的cppcms
     svn co https://cppcms.svn.sourceforge.net/svnroot/cppcms/framework/trunk  cppcms
     2.解壓
     cd cppcms   
     tar -xjf cppcms_boost.tar.bz2  
     3.建立build目錄
            1.mkdir build 
            2.cd build     
     4.cmake -DCMAKE_INSTALL_PREFIX=/usr/ ..  安裝到/usr/目錄下 ,提示如下錯誤:      

[...ocalhost build]$ cmake -DCMAKE_INSTALL_PREFIX=/usr/ ..

-- Looking for ICU libraries
-- ICU not found, disabling ICU localization backend
GNU Gcrypt or OpenSSL librarys are not found, disabling aes_encryptor
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PCRE_LIB
    linked by target "booster" in directory /home/ryanliang/MySrc/cppcms/cppcms-0.99.4/booster
    linked by target "booster-static" in directory /home/ryanliang/MySrc/cppcms/cppcms-0.99.4/booster
ZLIB_INCLUDE_DIR
   used as include directory in directory /home/ryanliang/MySrc/cppcms/cppcms-0.99.4

-- Configuring incomplete, errors occurred!

在網上找到一個兄弟遇到了同樣的問題(http://stackoverflow.com/questions/6083195/cppcms-build-error-with-libraries):

 他found the answer here:http://cppcms.sourceforge.net/wikipp/en/page/cppcms_1x_build_troubleshooting

       通過輸入如下命令,問題解決:

sudo apt-get install build-essential libpcre3-dev libicu-dev libgcrypt11-dev zlib1g-dev cmake

    但是apt-get以及後面幾個安裝庫都是debian或ubantu系統下才有的,我用的是CentOS,無法用;

解決思路:

   1, 同樣是找不到幾個系統庫,如果能夠在centos下找到與那幾個庫類似的lib安裝或許可行;

  2,通過強大的grep依次找到,安裝如下幾個軟體後,編譯通過;

rpm -ivh rpm-build-4.4.2.3-22.el5.x86_64.rpm        
sudo rpm -ivh rpm-build-4.4.2.3-22.el5.x86_64.rpm   
sudo rpm -ivh pcre-devel-6.6-6.el5.x86_64.rpm       
sudo rpm libicu-devel-3.6-5.16.x86_64.rpm           
sudo rpm -ivh libicu-devel-3.6-5.16.x86_64.rpm      
sudo rpm -ivh libgpg-error-devel-1.4-2.x86_64.rpm   
sudo rpm -ivh libgcrypt-devel-1.4.4-5.el5.x86_64.rpm
sudo rpm -ivh zlib-devel-1.2.3-3.x86_64.rpm         
sudo rpm -ivh zlib-1.2.3-3.x86_64.rpm             

編譯後的結果如下:

[ryanliang@localhost build]$ cmake -DCMAKE_INSTALL_PREFIX=/usr/ ..
-- Looking for ICU libraries
-- ICU Found, building booster locale
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wuliang/MySrc/cppcms-0.99.10.1/build

[ryanliang@localhost build]$ make test
Running tests...
Start processing tests
Test project /home/ryanliang/MySrc/cppcms-0.99.10.1/build
  1/ 76 Testing base64_test                      Passed
  2/ 76 Testing encryptor_test                   Passed
  3/ 76 Testing storage_test                     Passed
  4/ 76 Testing json_test                        Passed
  5/ 76 Testing multipart_parser_test            Passed
  6/ 76 Testing content_type_parser_test         Passed
  7/ 76 Testing cache_backend_test               Passed
  8/ 76 Testing serialization_test               Passed
  9/ 76 Testing xss_test                         Passed
 10/ 76 Testing url_mapper_test                  Passed
 11/ 76 Testing copy_filter_test                 Passed
 12/ 76 Testing tc_test                          Passed
 13/ 76 Testing status_test                      Passed
 14/ 76 Testing async_status_test                Passed
 15/ 76 Testing form_test                        Passed
 16/ 76 Testing cookie_test                      Passed
 17/ 76 Testing internal_forwarder_test          Passed
 18/ 76 Testing forwarder_test                   Passed
 19/ 76 Testing jsonrpc_test                     Passed
 20/ 76 Testing http_timeouts_test_read          Passed
 21/ 76 Testing http_timeouts_test_write         Passed
 22/ 76 Testing file_server_test                 Passed
 23/ 76 Testing file_server_with_listing_test    Passed
 24/ 76 Testing disco_test_http                  Passed
 25/ 76 Testing disco_test_fastcgi_tcp           Passed
 26/ 76 Testing disco_test_scgi_tcp              Passed
 27/ 76 Testing disco_test_fastcgi_unix          Passed
 28/ 76 Testing disco_test_scgi_unix             Passed
 29/ 76 Testing proto_test_async_http            Passed
 30/ 76 Testing proto_test_async_scgi            Passed
 31/ 76 Testing proto_test_async_fastcgi         Passed
 32/ 76 Testing proto_test_async_scgi_unix       Passed
 33/ 76 Testing proto_test_async_fastcgi_unix    Passed
 34/ 76 Testing proto_test_sync_http             Passed
 35/ 76 Testing proto_test_sync_scgi             Passed
 36/ 76 Testing proto_test_sync_fastcgi          Passed
 37/ 76 Testing proto_test_sync_scgi_unix        Passed
 38/ 76 Testing proto_test_sync_fastcgi_unix     Passed
 39/ 76 Testing test_function_function           Passed
 40/ 76 Testing test_function_callback           Passed
 41/ 76 Testing test_ptime_posix_time            Passed
 42/ 76 Testing test_thread_thread               Passed
 43/ 76 Testing test_thread_fork                 Passed
 44/ 76 Testing test_smart_ptr_shared_ptr        Passed
 45/ 76 Testing test_smart_ptr_atomic_counter    Passed
 46/ 76 Testing test_smart_ptr_sp_counter        Passed
 47/ 76 Testing test_log_log                     Passed
 48/ 76 Testing test_nowide_nowide               Passed
 49/ 76 Testing test_iostreams_streambuf         Passed
 50/ 76 Testing test_regex_regex                 Passed
 51/ 76 Testing test_aio_reactor                 Passed
 52/ 76 Testing test_aio_timer                   Passed
 53/ 76 Testing test_aio_event_loop              Passed
 54/ 76 Testing test_aio_socket                  Passed
 55/ 76 Testing test_aio_endpoint                Passed
 56/ 76 Testing test_backtrace_backtrace         Passed
 57/ 76 Testing test_aio_prefork                 Passed
 58/ 76 Testing test_locale_codepage             Passed
 59/ 76 Testing test_locale_message              Passed
 60/ 76 Testing test_locale_ios_prop             Passed
 61/ 76 Testing test_locale_codepage_converter   Passed
 62/ 76 Testing test_locale_date_time            Passed
 63/ 76 Testing test_locale_generator            Passed
 64/ 76 Testing test_locale_config               Passed
 65/ 76 Testing test_locale_utf                  Passed
 66/ 76 Testing test_locale_collate              Passed
 67/ 76 Testing test_locale_convert              Passed
 68/ 76 Testing test_locale_boundary             Passed
 69/ 76 Testing test_locale_formatting           Passed
 70/ 76 Testing test_locale_icu_vs_os_timezone   Passed
 71/ 76 Testing test_locale_std_convert          Passed
 72/ 76 Testing test_locale_std_formatting       Passed
 73/ 76 Testing test_locale_std_collate          Passed
 74/ 76 Testing test_locale_posix_collate        Passed
 75/ 76 Testing test_locale_posix_convert        Passed
 76/ 76 Testing test_locale_posix_formatting     Passed

100% tests passed, 0 tests failed out of 76

[ryanliang@localhost build]$sudo make install
[ 18%] Built target booster
[ 38%] Built target cppcms
[ 38%] Built target base64_test
[ 38%] Built target cache_backend_test
[ 38%] Built target content_type_parser_test
[ 39%] Built target cookie_test
[ 39%] Built target copy_filter_test
[ 58%] Built target cppcms-static
[ 59%] Built target cppcms_config_find_param
[ 59%] Built target cppcms_make_key
[ 59%] Built target cppcms_scale
[ 60%] Built target disco_test
[ 60%] Built target encryptor_test
[ 60%] Built target file_server_test
[ 61%] Built target form_test
[ 61%] Built target forwarder_test
[ 63%] Built target hello_world
[ 63%] Built target http_timeouts_test
[ 63%] Built target json_test
[ 64%] Built target jsonrpc_test
[ 64%] Built target multipart_parser_test
[ 64%] Built target proto_test
[ 65%] Built target serialization_test
[ 65%] Built target skin3
[ 66%] Built target status_test
[ 66%] Built target storage_test
[ 67%] Built target tc_skin
[ 67%] Built target tc_skin_a
[ 68%] Built target tc_skin_b
[ 68%] Built target tc_test
[ 68%] Built target url_mapper_test
[ 69%] Built target xss_test
[ 87%] Built target booster-static
[ 87%] Built target test_aio_endpoint
[ 88%] Built target test_aio_event_loop
[ 88%] Built target test_aio_prefork
[ 88%] Built target test_aio_reactor
[ 89%] Built target test_aio_socket
[ 89%] Built target test_aio_timer
[ 89%] Built target test_backtrace_backtrace
[ 90%] Built target test_function_callback
[ 90%] Built target test_function_function
[ 90%] Built target test_iostreams_streambuf
[ 91%] Built target test_locale_boundary
[ 91%] Built target test_locale_codepage
[ 91%] Built target test_locale_codepage_converter
[ 92%] Built target test_locale_collate
[ 92%] Built target test_locale_config
[ 92%] Built target test_locale_convert
[ 93%] Built target test_locale_date_time
[ 93%] Built target test_locale_formatting
[ 93%] Built target test_locale_generator
[ 94%] Built target test_locale_icu_vs_os_timezone
[ 94%] Built target test_locale_ios_prop
[ 94%] Built target test_locale_message
[ 95%] Built target test_locale_posix_collate
[ 95%] Built target test_locale_posix_convert
[ 95%] Built target test_locale_posix_formatting
[ 96%] Built target test_locale_std_collate
[ 96%] Built target test_locale_std_convert
[ 96%] Built target test_locale_std_formatting
[ 97%] Built target test_locale_utf
[ 97%] Built target test_log_log
[ 97%] Built target test_nowide_nowide
[ 98%] Built target test_ptime_posix_time
[ 98%] Built target test_regex_regex
[ 98%] Built target test_smart_ptr_atomic_counter
[ 99%] Built target test_smart_ptr_shared_ptr
[ 99%] Built target test_smart_ptr_sp_counter
[ 99%] Built target test_thread_fork
[100%] Built target test_thread_thread
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/lib/libcppcms.so.1.0.0

-- Installing: /usr/include/booster/bad_weak_ptr.h
-- Installing: /usr/include/booster/locale
-- Installing: /usr/include/booster/locale/date_time_facet.h
-- Installing: /usr/include/booster/locale/date_time.h
-- Installing: /usr/include/booster/locale/collator.h
-- Installing: /usr/include/booster/locale/util.h
-- Installing: /usr/include/booster/locale/encoding_errors.h
-- Installing: /usr/include/booster/locale/format.h
-- Installing: /usr/include/booster/locale/info.h
-- Installing: /usr/include/booster/locale/boundary.h
-- Installing: /usr/include/booster/locale/generator.h
-- Installing: /usr/include/booster/locale/boundary
-- Installing: /usr/include/booster/locale/boundary/facets.h
-- Installing: /usr/include/booster/locale/boundary/index.h
-- Installing: /usr/include/booster/locale/boundary/types.h
-- Installing: /usr/include/booster/locale/boundary/boundary_point.h
-- Installing: /usr/include/booster/locale/boundary/segment.h
-- Installing: /usr/include/booster/locale/hold_ptr.h
-- Installing: /usr/include/booster/locale/gnu_gettext.h
-- Installing: /usr/include/booster/locale/config.h
-- Installing: /usr/include/booster/locale/time_zone.h
-- Installing: /usr/include/booster/locale/encoding.h
-- Installing: /usr/include/booster/locale/encoding_utf.h
-- Installing: /usr/include/booster/locale/message.h
-- Installing: /usr/include/booster/locale/formatting.h
-- Installing: /usr/include/booster/locale/conversion.h
-- Installing: /usr/include/booster/locale/utf.h
-- Installing: /usr/include/booster/locale/localization_backend.h
-- Installing: /usr/include/booster/ctime.h
-- Installing: /usr/include/booster/enable_shared_from_this.h
-- Installing: /usr/include/booster/clone_ptr.h
-- Installing: /usr/include/booster/log.h
-- Installing: /usr/include/booster/copy_ptr.h
-- Installing: /usr/include/booster/refcounted.h
-- Installing: /usr/lib/libbooster.so.0.0.0
-- Installing: /usr/lib/libbooster.so.0
-- Installing: /usr/lib/libbooster.so
-- Installing: /usr/include/booster/build_config.h
-- Installing: /usr/lib/libbooster.a
-- Up-to-date: /usr/include/booster/build_config.h
[ryanliang@localhost build]$ 

最後安裝的時候會建立下面兩個目錄,將標頭檔放在該目錄下。
/usr/include/cppcms
/usr/include/booster
而在/usr/lib目錄下添加了幾個庫檔案
-- Installing: /usr/lib/libbooster.so.0.0.0
-- Installing: /usr/lib/libbooster.so.0
-- Installing: /usr/lib/libbooster.so
-- Installing: /usr/lib/libbooster.a
-- Installing: /usr/lib/libcppcms.so.1.0.0
-- Installing: /usr/lib/libcppcms.so.1
-- Installing: /usr/lib/libcppcms.so

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.