【初识mac】安装cmake编译的小问题

本次报错发生在配置fluffos环境的时候。

首先按照官网的编译操作,拉取了fluffos v2019的源码,然后通过brew安装编译环境:

brew install cmake pkg-config mysql pcre libgcrypt libevent openssl jemalloc icu4c

下载没有问题。

mkdir build &&cd build

新建编译文件夹。

OPENSSL_ROOT_DIR="/usr/local/opt/openssl" ICU_ROOT="/usr/local/opt/icu4c"
cmake ..

第一行配置openssl目录和icu4c目录,第二行编译fluffos的目录,在这里我使用cmake ..并未成功,所以我直接使用cmake /users/2233/fluffos编译fluffos的目录。

在执行的时候发生了报错,如下:

CMake Error at /opt/homebrew/Cellar/cmake/3.25.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR SSL) (Required is at least version "1.0.1")
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.25.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/Cellar/cmake/3.25.2/share/cmake/Modules/FindOpenSSL.cmake:613 (find_package_handle_standard_args)
src/CMakeLists.txt:200 (find_package)

这个报错原因很简单,其实我忘了我的brew是默认的配置,他会将使用brew install安装的包放在他自己默认的地址里,也就是/opt/homebrew/Cellar中,并且都是‘包名/版本号’的方式放置不同的版本。

所以我将上面的命令进行了修改,如下:

OPENSSL_ROOT_DIR="/opt/homebrew/Cellar/openssl@3/3.0.8" ICU_ROOT="/opt/homebrew/Cellar/icu4c/72.1"
cmake /Users/2233/fluffos/build

重新编译是成功的,这个错误很小,但是经常会发生,朋友们在使用上面的命令的时候要对一下自己的目录,不然也会报错。

猜你喜欢

转载自blog.csdn.net/Joker6578/article/details/129099167