agunchan commented on issue #469:
URL: 
https://github.com/apache/pulsar-client-cpp/issues/469#issuecomment-2564971731

   > > You can try adding the `boost-regex` dependency to `vcpkg.json` and 
migrating the code from `LegacyFindPackages.cmake` to `CMakeLists.txt`.
   > 
   > I added boost-regex to vcpkg.json
   > 
   > ` { "name": "boost-property-tree", "version>=": "1.83.0" }, { "name": 
"boost-regex", "version>=": "1.83.0" },`
   > 
   > and migrate the code to CMakeLists.txt
   > 
   > ` if (BUILD_PERF_TOOLS) find_package(Boost COMPONENTS program_options 
REQUIRED) endif ()
   > 
   > ```
   > if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 
4.9)
   >     # GCC 4.8.2 implementation of std::regex is buggy
   >     set(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
   >     find_package(Boost COMPONENTS ${BOOST_COMPONENTS})
   >     add_definitions(-DPULSAR_USE_BOOST_REGEX)
   >     MESSAGE(STATUS "Using Boost::Regex")
   > endif()
   > ```
   > 
   > `
   > 
   > cmake -B build -DINTEGRATE_VCPKG=ON -DCMAKE_BUILD_TYPE=Release 
-DBUILD_TESTS=OFF -DBUILD_DYNAMIC_LIB=ON -DBUILD_STATIC_LIB=ON
   > 
   > cmake --build build -j8
   > 
   > I got below error, did I miss some steps?
   > 
   > [ 89%] Linking C executable SampleAsyncConsumerCApi [ 90%] Linking C 
executable SampleConsumerCApi [ 91%] Linking C executable SampleProducerCApi 
../lib/libpulsar.so: undefined reference to 
`boost::scoped_static_mutex_lock::scoped_static_mutex_lock(boost::static_mutex&,
 bool)' ../lib/libpulsar.so: undefined reference to 
`boost::scoped_static_mutex_lock::~scoped_static_mutex_lock()' collect2: error: 
ld returned 1 exit status
   
   I added `set(COMMON_LIBS ${COMMON_LIBS} Boost::regex)`  to CMakeList.txt and 
it works.
   
   `    if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 
4.9)
           # GCC 4.8.2 implementation of std::regex is buggy
           set(BOOST_COMPONENTS ${BOOST_COMPONENTS} regex)
           find_package(Boost COMPONENTS ${BOOST_COMPONENTS})
           set(COMMON_LIBS ${COMMON_LIBS} Boost::regex)
           add_definitions(-DPULSAR_USE_BOOST_REGEX)
           MESSAGE(STATUS "Using Boost::Regex")
       endif() `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to