c - OpenWall bcrypt 库集成
问题描述
我在我的项目中集成 OpenWall bcrypt 库时遇到问题,无论是在 linux 上还是在 windows 上。
这是我所做的:
- 从https://www.openwall.com/crypt下载了库
- 执行 makefile 以生成 .o 文件
- 在我的编译命令行中包含这些文件(请参阅下面的 bash 文件)
- 在我的源代码中添加了#include "ow-crypt.h"
- 尝试使用函数 crypt_gensalt
- 出现链接错误
我的 bash 文件用于编译:
project_root=/home/ubuntu/lamodal-dev
lws_lib_dir_path=/usr/local/lib
libxml_include_dir_path=/usr/include/libxml2
lws_lib_name=websockets
libxml_lib_name=xml2
sqlite3_lib_name=sqlite3
debug_compile_flags="\
-g \
-Wall \
-Wno-unused-variable \
-Wno-unused-but-set-variable \
-Wno-unused-result"
g++ -pthread -std=c++11 $debug_compile_flags \
-I$libxml_include_dir_path \
-L$lws_lib_dir_path \
$project_root/code/third/openwall/bcrypt/crypt_blowfish.o \
$project_root/code/third/openwall/bcrypt/crypt_gensalt.o \
$project_root/code/third/openwall/bcrypt/wrapper.o \
$project_root/code/third/openwall/bcrypt/x86.o \
../../code/lamodal-dev.cpp \
-l$lws_lib_name \
-l$libxml_lib_name \
-l$sqlite3_lib_name \
-lcrypt \
-o ../../bin/linux/lamodal-dev.run
输出:
undefined reference to `crypt_gensalt(char const*, unsigned long, char const*, int)'
我不应该链接什么?
解决方案
推荐阅读
- reactjs - 难以为 3 个数组对象编写代码
- node.js - 没有登录graylog服务器,也没有收到任何错误
- c# - 移动图像的原点以将其带回c#中的中心
- asp.net-mvc-5 - 检测 MVC 模型绑定中的违规文本
- java - 如何计算自定义 Epoch 时间?不是 UNIX 时代
- square-connect - 方现金招标流程
- spring - Spring Integration Sftp Streaming Inbound Channel Adapter 多次处理同一个文件
- html - 菜单不会出现在视差图像之上
- angular - 尝试在 Angular 6 中使用对象 Object 作为数组
- mongodb - golang 中的聚合查询