使用vcpkg编译安装libxcrypt库,总是报错,
Building libxcrypt:x64-linux@4.4.36#1...
libxcrypt currently requires the following libraries from the system package manager:
autoconf automake libtool pkg-config
These can be installed on Debian systems via sudo apt install autoconf automake libtool pkg-config
-- Using cached besser82-libxcrypt-v4.4.36.tar.gz.
-- Cleaning sources at /data/vcpkg/buildtrees/libxcrypt/src/v4.4.36-645fb55159.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /data/vcpkg/downloads/besser82-libxcrypt-v4.4.36.tar.gz
-- Using source at /data/vcpkg/buildtrees/libxcrypt/src/v4.4.36-645fb55159.clean
-- Getting CMake variables for x64-linux-dbg
-- Getting CMake variables for x64-linux-rel
-- Generating configure for x64-linux
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
Command failed: /usr/bin/autoreconf -vfi
Working Directory: /data/vcpkg/buildtrees/libxcrypt/src/v4.4.36-645fb55159.clean/
Error code: 1
See logs for more information:
/data/vcpkg/buildtrees/libxcrypt/autoconf-x64-linux-out.log
/data/vcpkg/buildtrees/libxcrypt/autoconf-x64-linux-err.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_make.cmake:728 (vcpkg_execute_required_process)
ports/libxcrypt/portfile.cmake:26 (vcpkg_configure_make)
scripts/ports.cmake:175 (include)
error: building libxcrypt:x64-linux failed with: BUILD_FAILED
Elapsed time to handle libxcrypt:x64-linux: 22 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+libxcrypt
You can submit a new issue at:
https://github.com/microsoft/vcpkg/issues/new?title=[libxcrypt]+Build+error+on+x64-linux&body=Copy+issue+body+from+%2Fdata%2Fvcpkg%2Finstalled%2Fvcpkg%2Fissue_body.md
查看报错log文件,内容如下:
phx@phx-pc:/data/vcpkg$ cat /data/vcpkg/buildtrees/libxcrypt/autoconf-x64-linux-err.log
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I build-aux/m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
autoreconf: running: /usr/bin/autoconf --force
configure.ac:60: error: possibly undefined macro: LT_SYS_SYMBOL_USCORE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
尝试对自动解压目录内的configure.ac文件增加一行
m4_pattern_allow([LT_SYS_SYMBOL_USCORE])
然后手动执行autoreconf -fvi 发现确实不报错了,下面就是修改vcpkg,让vcpkg不再从互联网下载源码文件改成从本地路径加载我修改后的源码文件安装的过程。
打开data/vcpkg/buildtrees/libxcrypt/src/v4.4.36-645fb55159 这个目录,找到configure.ac文件,还是在开头增加m4_pattern_allow([LT_SYS_SYMBOL_USCORE])后保存,记住上面的源码路径信息,后边要用。
打开data/vcpkg/ports/libxcrypt/portfile.cmake文件,注释掉原来从互联网下载源码的配置,增加从本地加载源码的配置,如下:
#vcpkg_from_github(
# OUT_SOURCE_PATH SOURCE_PATH
# REPO besser82/libxcrypt
# REF "v${VERSION}"
# SHA512 61e5e393654f37775457474d4170098314879ee79963d423c1c461e80dc5dc74f0c161dd8754f016ce96109167be6c580ad23994fa1d2c38c54b96e602f3aece
#)
set(SOURCE_PATH "/data/vcpkg/buildtrees/libxcrypt/src/v4.4.36-645fb55159")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
)
再次执行vcpkg install libxcrypt后可以正常安装。