gpt4 book ai didi

c++ - libicuuc.so.52,需要 libboost_regex-mt.so

转载 作者:行者123 更新时间:2023-11-30 05:28:37 25 4
gpt4 key购买 nike

简介

我想编译一个使用 ICU 和 libboost 的代码。为此,我使用了以下 install.sh 文件。问题是我收到此错误:

/usr/bin/ld: warning: libicuuc.so.52, needed by /opt/boost-1.54.0/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)

我知道我必须在cmakeLists.txt 文件中添加一些内容:

set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} -rpath=/opt/icu_52.1/")

但它不起作用:

c++: error: unrecognized command line option ‘-rpath=/opt/icu_52.1/’

当我尝试时: set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} -Wl,-rpath=/opt/icu_52.1/")

错误: /usr/bin/ld:警告:libicuuc.so.52,/opt/boost-1.54.0/lib/libboost_regex-mt.so 需要,不是找到(尝试使用 -rpath 或 -rpath-link)


安装.sh

module load icu-52.1
module load boost_1_54_0
module load qt5.5.0

ENTLK_DIST=/home/hani/ENTLK_DIST

export BOOST_ROOT=/opt/boost-1.54.0/
export ICU_ROOT=/opt/icu_52.1/

export PATH=/opt/qt-5.5.0/bin:$PATH
export LD_LIBRARY_PATH=/opt/qt-5.5.0/lib


#######################################
# compile and install in ENTLK_DIST
#######################################
export ENTLK_DIST=/home/hani/ENTLK_DIST

mkdir -p build && cd build
rm -f CMakeCache.txt
cmake .. -DCMAKE_INSTALL_PREFIX=$ENTLK_DIST
make -j8 && make install

CmakeLists.txt

project(Entlk)
cmake_minimum_required(VERSION 2.6)------------------------------------------------------------------------------
# Support C++11
# ------------------------------------------------------------------------------
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STDCPP11)
if (HAVE_STDCPP11)
message("-- C++11 supported")
add_definitions(-DHAVE_STDCPP11) # to be used in the cpp code
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} -lboost_regex")
else (HAVE_STDCPP11)
message("-- C++11 NOT supported")
set(CMAKE_CXX_FLAGS "-DNO_STDCPP11 ${CMAKE_CXX_FLAGS}")
endif (HAVE_STDCPP11)

# warnings
# disable warnings on unknown pragmas (used by sqlite_modern)
set(CMAKE_CXX_FLAGS "-W -Wall -Wno-unknown-pragmas ${CMAKE_CXX_FLAGS}")

set(CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")

#use Stanford NER instead of MITIE
#set(CMAKE_CXX_FLAGS "-DUSE_STANFORD_NER ${CMAKE_CXX_FLAGS}")

# display install directory
message(STATUS "Install directory is CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")

# ------------------------------------------------------------------------------
# configure third party librairies
# ------------------------------------------------------------------------------
include(cmake/EntlkUtils.cmake)

# Path to look for FindXXX.cmake files
set(CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake" # available in this project
)

find_package(ICU 4.4 REQUIRED)
include_directories(${ICU_INCLUDE_DIRS})


# include Qt (for lima)
include(${CMAKE_SOURCE_DIR}/cmake/manageQt5.cmake)
addQt5Modules(Core Xml)
include_directories(${Qt5_INCLUDES})
set(QT_LIBRARIES "${Qt5_LIBRARIES}")


find_package(Boost 1.46 REQUIRED COMPONENTS regex serialization system filesystem program_options timer log)
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIRS})
# add define needed by Boost Log
set(CMAKE_CXX_FLAGS "-DBOOST_LOG_DYN_LINK ${CMAKE_CXX_FLAGS}")
#message(STATUS "using Boost libraries ${Boost_LIBRARIES}")

最佳答案

添加到您的 CMakeLists.txt 文件:

link_directories(/opt/icu_52.1/lib)

你也可以试试看有没有人写过ICU的find包,反正cmake的标准模块里没有。

关于c++ - libicuuc.so.52,需要 libboost_regex-mt.so,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36743865/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com