2.8 KiB
2.8 KiB
password-analyzer
Description
实现了以下的分析功能:
Compile and Run
Prerequisites
项目使用了 C++23 标准进行编写,需要使用支持 C++23 的编译器进行编译
经过测试的编译器:
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.1 20230801 (GCC)
如果使用 clang++
编译器,需要修改 CMakeLists.txt
,强制使用 libc++
,patch
如下:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ca65a4..5129602 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=mold -Wno-unused-command-line-argument")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,undefined")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
+gset(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+
message(STATUS "[DEPS] Processing spdlog")
FetchContent_Declare(
spdlog
其它依赖:
cmake >= 3.12
make
orninja
git
mold
: 可选,若不需要使用mold
进行链接,请在CMakeLists.txt
中删除-fuse-ld=mold
选项
Compile
编译:
mkdir build
pushd
cmake ..
cmake --build . -j
popd
Run
在 项目根目录 下运行:
# ./build/password-analyzer
[2023-11-05 14:45:17.980] [info] [stat_length(YAHOO)] start...
[2023-11-05 14:45:18.174] [info] 8: 119134
[2023-11-05 14:45:18.174] [info] 6: 79628
[2023-11-05 14:45:18.174] [info] 9: 65963
...