In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the method of installing google's libphonenumber C++ library in Linux". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Libphonenumber dependent library into the cpp can see the three major linux, mac, win system installation instructions README, here is only to record the installation process in Centos6, if you choose the ubuntu system recommended by google, just follow it. I am using Centos6x, because the current version of the libphonenumber library has been migrated to cymbals 11, and the compiler GCC4.4.7 installed by default in Centos6 does not support all the features. In fact, it only supports cymbals 0x, which requires the installation of scl (a tool to install the latest version of the development environment in the centos/redhat series, which is not introduced here). I am using GCC8 compilation installed by Scl The dependent libraries and versions I use are listed below: 1. Cmake: install 2. 8 * yum install cmake-y2 using the system source. Google test: 1.8.1 (requires Clippers 11) * wget https://github.com/google/googletest/archive/release-1.8.1.tar.gz * tar xf release-1.8.1.tar.gz * cd googletest-release-1.8.1 * mkdir build * cd build * cmake-DBUILD_SHARED_LIBS=ON-DCMAKE_INSTALL_PREFIX=. * make & & make install3. RE2: install * yum install re2-devel-y4 using the system source. Protobuffer: 2.6.1 * wget https://github.com/protocolbuffers/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.bz2 * tar xf protobuf-2.6.1.tar.bz2 * cd protobuf-2.6.1 *. / configure & & make & & make install5. ICU: I chose the latest version 64.2 * wget https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-src.tgz * tar xf icu4c-64_2-src.tgz * cd icu/source *. / configure & & make & & make install6. Boost: this is also the source installation * yum install-y boost-devel boost-system boost-thread7. Note: since make install needs to be installed on the system, you are required to provide administrator privileges. It seems that you also need to operate yum, if ordinary users should pay attention to this. After completing the above steps, all the dependent libraries of libphonenumber are installed. Next, let's download and compile the libphonenumber source code git clone https://github.com/google/libphonenumber.git cd libphonenumber/cpp mkdir build cd build cmake. Make. / libphonenumber_testtest are all successful and that's ok. The next step is how to use the libphonenumber library # include # include using namespace std;#include "phonenumbers/phonenumber.h" using i18n 86:18612345678void test_phone_number 86:18612345678void test_phone_number (const string& phone) {string region; string phone_num; auto idx = phone.find ("": ") If (idx! = string::npos) {region = phone.substr (0, idx); phone_num = phone.substr (idx + 1);} else {region = "+ 86"; phone_num = phone;} PhoneNumber pn; pn.set_country_code (std::stoul (region)); pn.set_national_number (std::stoull (phone_num)); PhoneNumberUtil * util = PhoneNumberUtil::GetInstance () / / region code = = ISO Id std::string reg_code; util- > GetRegionCodeForNumber (pn, & reg_code); path of the std::cout library in the system / usr/local/lib/libicuuc.so.64 (0x00007fb7e8384000). When deploying, just copy all the dependent so and deploy them together, so that you don't have to install, compile and install a bunch of libraries on the target system. I'll list all the so that libphonenumber depends on. Please follow the actual situation (I copy to the lib directory of the current directory): [hello@world test-phonenumber] $ls-1 lib libboost_date_time-mt.so libboost_date_time-mt.so.5 libboost_system-mt.so libboost_system-mt.so.5 libboost_thread-mt.so libboost_thread-mt.so.5 libicudata.so.64 libicudata.so.64.2 libicui18n.so.64 libicui18n.so.64.2 libicuuc.so.64 libicuuc .so.64.2 libphonenumber.so libphonenumber.so.8 libphonenumber.so.8.10 libprotobuf.so libprotobuf.so.9 libprotobuf.so.9.0.1 Note: .so and .so.9 are symbolic links corresponding to .so.9.0.1 Specify the dynamic library search path LD_LIBRARY_PATH=./lib before use. This is the end of the content of "what is the libphonenumber C++ library method for installing google in Linux"? Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.