首页 > 编程语言 >obproxy 源码编译以及一些问题整理-暂未编译成功

obproxy 源码编译以及一些问题整理-暂未编译成功

时间:2023-11-23 12:33:26浏览次数:41  
标签:lib DEP ob 暂未 编译 源码 usr obproxy include

尝试自己编译下oceanbase 的obproxy 并记录下一些问题,目前是暂未编译成功,因为是openssl 版本包的问题

环境说明

基于了Rocky Linux release 8.8, 同时obproxy 使用了4.2.1 版本的

构建参考命令

这个官方已经提供了,主要就是init debug,make

sh build.sh init
sh build.sh config debug
sh build.sh make

依赖包

  • mariadb mysql 依赖
make  all-am
make[3]: 进入目录“/opt/ob/obproxy-4.2.1/src”
  CXX      lib/ob_worker.lo
  CXX      obproxy/ob_proxy_init.lo
In file included from ./lib/ob_errno.h:15,
                 from ./lib/oblog/ob_log_print_kv.h:20,
                 from ./lib/oblog/ob_log.h:48,
                 from ./lib/ob_define.h:26,
                 from lib/ob_worker.h:18,
                 from lib/ob_worker.cpp:13:
./lib/mysql_errno.h:16:10: fatal error: mariadb/mysqld_error.h: No such file or directory
   16 | #include <mariadb/mysqld_error.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:6268:lib/ob_worker.lo] 错误 1
make[3]: *** 正在等待未完成的任务....
In file included from ./lib/ob_errno.h:15,
                 from ./lib/oblog/ob_log_print_kv.h:20,
                 from ./lib/oblog/ob_log.h:48,
                 from ./lib/ob_define.h:26,
                 from obproxy/ob_proxy_main.h:17,
                 from obproxy/ob_proxy_init.cpp:32:
./lib/mysql_errno.h:16:10: fatal error: mariadb/mysqld_error.h: No such file or directory
   16 | #include <mariadb/mysqld_error.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
   

linux 指定include 文件
buid.sh

 
function sw()
{
  export DEP_DIR;
  export TOOLS_DIR;
  export RUNTIME_DIR;
  export DEP_VAR=$DEP_DIR/var/;
  /sbin/ldconfig -n $DEP_DIR/lib;
  export LD_LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:$DEP_VAR/lib64:/usr/lib/x86_64-linux-gnu;
  export LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:/usr/lib/x86_64-linux-gnu;
  export CPLUS_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:$DEP_VAR/usr/local/include:$DEP_VAR/usr/include:$DEP_VAR/devel/include:/usr/include/x86_64-linux-g$
  export C_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:/usr/include/x86_64-linux-gnu:/usr/local/oceanbase/deps/devel/include;
  export PATH=$DEP_DIR/bin:$TOOLS_DIR/bin:$PATH;
}
  • openssl 依赖
    这种安装是有问题的,继续构建后边会有一些错误,实际上github 也有一个简单的说明,但是估计版本太老了,信息不太对,应该使用oceanbase 自己构建的openssl-static 开发包
 
../deps/easy/src/io/easy_io_struct.h:5:10: fatal error: openssl/ssl.h: No such file or directory
    5 | #include <openssl/ssl.h>
      |          ^~~~~~~~~~~~~~~

安装依赖

yum install -y openssl-devel
  • sqlite3 依赖
In file included from lib/allocator/ob_malloc.cpp:18:
../src/obproxy/obutils/ob_proxy_config.h:16:10: fatal error: sqlite/sqlite3.h: No such file or directory
   16 | #include <sqlite/sqlite3.h>
      |          ^~~~~~~~~~~~~~~~~~

安装依赖

yum install -y libsq3-devel
mkdir -p /usr/include/sqlite
ln -s /usr/include/sqlite3.h  /usr/include/sqlite/sqlite3.h
  • ob sql 解析依赖
../src/obproxy/obutils/ob_proxy_sql_parser.h:29:10: fatal error: ob_sql_parser.h: No such file or directory
   29 | #include <ob_sql_parser.h>

安装

yum install -y oceanbase-ce-utils 

配置include (build.sh ) 如下

/home/admin/oceanbase/include/ob_sql_parser.h
function sw()
{
  export DEP_DIR;
  export TOOLS_DIR;
  export RUNTIME_DIR;
  export DEP_VAR=$DEP_DIR/var/;
  /sbin/ldconfig -n $DEP_DIR/lib;
  export LD_LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:$DEP_VAR/lib64:/usr/lib/x86_64-linux-gnu;
  export LIBRARY_PATH=$DEP_DIR/lib:$DEP_VAR/usr/local/lib64:$DEP_VAR/usr/local/lib:$DEP_VAR/usr/lib64:$DEP_VAR/usr/lib:/usr/lib/x86_64-linux-gnu;
  export CPLUS_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:$DEP_VAR/usr/local/include:$DEP_VAR/usr/include:$DEP_VAR/devel/include:/usr/include/x86_64-linux-gnu:/usr/local/oceanbase/deps/devel/include:/home/admin/oceanbase/include/;
  export C_INCLUDE_PATH=$DEP_DIR/include:${RUNTIME_DIR}/include:/usr/include/x86_64-linux-gnu:/usr/local/oceanbase/deps/devel/include:/home/admin/oceanbase/include/;
  export PATH=$DEP_DIR/bin:$TOOLS_DIR/bin:$PATH;
}

问题

In file included from /home/admin/oceanbase/include/ob_sql_parser.h:17,
                 from ../src/obproxy/obutils/ob_proxy_sql_parser.h:29,
                 from ../src/obproxy/obutils/ob_config_processor.h:41,
                 from ../src/obproxy/omt/ob_cpu_table_processor.h:34,
                 from ../src/obproxy/iocore/net/ob_net_accept.h:47,
                 from ../src/obproxy/iocore/net/ob_net.h:59,
                 from ../src/obproxy/proxy/client/ob_client_utils.h:16,
                 from ../src/obproxy/proxy/client/ob_raw_mysql_client.h:20,
                 from obproxy/proxy/client/ob_mysql_proxy.h:18,
                 from obproxy/ob_proxy.h:20,
                 from obproxy/ob_proxy_main.h:20,
                 from obproxy/main.cpp:17:
/home/admin/oceanbase/include/parse_node.h:403:17: error: conflicting declaration of C function ‘uint64_t parsenode_hash(const ParseNode*, int*)’
  403 | extern uint64_t parsenode_hash(const ParseNode *node, int *ret);
      |                 ^~~~~~~~~~~~~~
In file included from ./lib/hash/ob_hashmap.h:20,
                 from ../src/obproxy/obutils/ob_proxy_config.h:17,
                 from ../src/obproxy/obutils/ob_proxy_config_manager.h:16,
                 from obproxy/obutils/ob_proxy_table_processor.h:20,
                 from obproxy/ob_proxy.h:18,
                 from obproxy/ob_proxy_main.h:20,
                 from obproxy/main.cpp:17:
./lib/hash/ob_hashutils.h:49:17: note: previous declaration ‘uint64_t parsenode_hash(const _ParseNode*)’
   49 | extern uint64_t parsenode_hash(const _ParseNode *node);
      |                 ^~~~~~~~~~~~~~
In file included from /home/admin/oceanbase/include/ob_sql_parser.h:17,
                 from ../src/obproxy/obutils/ob_proxy_sql_parser.h:29,
                 from ../src/obproxy/obutils/ob_config_processor.h:41,
                 from ../src/obproxy/omt/ob_cpu_table_processor.h:34,
                 from ../src/obproxy/iocore/net/ob_net_accept.h:47,
                 from ../src/obproxy/iocore/net/ob_net.h:59,
                 from ../src/obproxy/proxy/client/ob_client_utils.h:16,
                 from ../src/obproxy/proxy/client/ob_raw_mysql_client.h:20,
                 from obproxy/proxy/client/ob_mysql_proxy.h:18,
                 from obproxy/ob_proxy.h:20,
   

以上的依赖不太对,应该使用yum install -y oceanbase-ce-devel 然后移除以上的include 配置,因为这个安装的是可以直接include 查找到的

  • mysql client 依赖
n file included from ./lib/mysqlclient/ob_mysql_statement.h:16,
                 from ./common/mysql_proxy/ob_mysql_proxy.h:18,
                 from ./share/config/ob_system_config.h:18,
                 from ./share/config/ob_server_config.h:17,
                 from share/ob_server_status.h:20,
                 from share/ob_server_status.cpp:14:
./lib/mysqlclient/ob_mysql_result_impl.h:15:10: fatal error: mysql.h: No such file or directory
   15 | #include <mysql.h>
      |          ^~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:6268:share/ob_server_status.lo] 错误 1
 

配置依赖,因为已经安装了

cd /usr/local/oceanbase/deps/devel/include
cp -rf mariadb/* .
  • ssl 问题
obproxy/iocore/net/ob_ssl_processor.cpp: In member function ‘int oceanbase::obproxy::net::ObSSLProcessor::init()’:
obproxy/iocore/net/ob_ssl_processor.cpp:42:44: error: invalid conversion from ‘void* (*)(size_t)’ {aka ‘void* (*)(long unsigned int)’} to ‘void* (*)(size_t, const char*, int)’ {aka ‘void* (*)(long unsigned int, const char*, int)’} [-fpermissive]
   42 |   CRYPTO_set_mem_functions(ObSSLProcessor::malloc_for_ssl, ObSSLProcessor::realloc_for_ssl,
      |                            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
      |                                            |
      |                                            void* (*)(size_t) {aka void* (*)(long unsigned int)}
In file included from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:17,
                 from ../src/obproxy/iocore/net/ob_ssl_processor.h:16,
                 from obproxy/iocore/net/ob_ssl_processor.cpp:15:
/usr/include/openssl/crypto.h:257:17: note:   initializing argument 1 of ‘int CRYPTO_set_mem_functions(void* (*)(size_t, const char*, int), void* (*)(void*, size_t, const char*, int), void (*)(void*, const char*, int))’
  257 |         void *(*m) (size_t, const char *, int),
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
obproxy/iocore/net/ob_ssl_processor.cpp:42:76: error: invalid conversion from ‘void* (*)(void*, size_t)’ {aka ‘void* (*)(void*, long unsigned int)’} to ‘void* (*)(void*, size_t, const char*, int)’ {aka ‘void* (*)(void*, long unsigned int, const char*, int)’} [-fpermissive]
   42 |   CRYPTO_set_mem_functions(ObSSLProcessor::malloc_for_ssl, ObSSLProcessor::realloc_for_ssl,
      |                                                            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      |                                                                            |
      |                                                                            void* (*)(void*, size_t) {aka void* (*)(void*, long unsigned int)}
In file included from /usr/include/openssl/comp.h:16,
                 from /usr/include/openssl/ssl.h:17,
                 from ../src/obproxy/iocore

实际应该安装yum install -y devdeps-openssl-static 但是有如下错误

  file /usr/local/oceanbase/deps/devel from install of devdeps-openssl-static-1.1.1u-22023100710.el8.x86_64 conflicts with file from package devdeps-mariadb-connector-c-3.1.12-12022100422.el8.x86_64
  file /usr/local/oceanbase/deps/devel/include from install of devdeps-openssl-static-1.1.1u-22023100710.el8.x86_64 conflicts with file from package devdeps-mariadb-connector-c-3.1.12-12022100422.el8.x86_64
  file /usr/local/oceanbase/deps/devel/lib from install of devdeps-openssl-static-1.1.1u-22023100710.el8.x86_64 conflicts with file from package devdeps-mariadb-connector-c-3.1.12-12022100422.el8.x86_64
  file /usr/local/oceanbase/deps/devel/lib/pkgconfig from install of devdeps-openssl-static-1.1.1u-22023100710.el8.x86_64 conflicts with file from package devdeps-mariadb-connector-c-3.1.12-12022100422.el8.x86_64
   

尝试解决

 yum  install --downloadonly --downloaddir=/opt/ob devdeps-openssl-static
rpm -ivh devdeps-openssl-static-1.1.1u-22023100710.el8.x86_64.rpm --force
安装的位置
/usr/local/oceanbase/deps/devel/include/openssl/   因为已经配置include了直接继续构建

继续构建发现还是如上的错误

说明

目前基于源码构建还是比较费事的,提供的版本以及文档不全,需要自己踩坑,目前暂时没编译成功

参考资料

https://github.com/oceanbase/obproxy
https://github.com/oceanbase/oceanbase-proxy-doc/blob/V3.1.0/zh-CN/3.installation-and-deployment/3.compile-odp.md
https://mirrors.aliyun.com/oceanbase/development-kit/el/8/x86_64/?spm=a2c6h.25603864.0.0.5cc479dfIUvjmG

标签:lib,DEP,ob,暂未,编译,源码,usr,obproxy,include
From: https://www.cnblogs.com/rongfengliang/p/17851300.html

相关文章

  • Java商城网站系统设计与实现(带源码)
    基于Java的商城网站系统设计与实现功能介绍平台采用B/S结构,后端采用主流的Springboot框架进行开发,前端采用主流的Vue.js进行开发。整个平台包括前台和后台两个部分。前台功能包括:首页、商品详情页、订单、用户中心模块。后台功能包括:总览、订单管理、商品管理、分类管理、标签管理......
  • python编译成可执行文件
    安装pipinstallpyinstaller执行pyinstaller--onefilexxxxx.py会在当前文件的同级目录生成dist文件夹,可执行文件就在里面......
  • 一个基于php+mysql的外卖订餐网站(带源码)
    订饭组一个基于php+mysql的外卖订餐网站,包括前端和后台。测试账号:admin密码:admin运行环境:Apache+PHP+Mysql代码说明htaccessRewrite配置文件,需要放入到项目根目录configs.php需要配置数据库连接信息(主机、用户名、密码),系统常量等data.sql位于data目录中,是数据库备份文件,需要提......
  • openharmonyOS 编译报错:ERROR: Failed :entry:default@LegacyCompileResource
    解决方法:把build包删除,让系统重新生成......
  • 编译栈存储
    总结1.入栈时是从高地址到低地址。2.对函数进行编译时,形式参数和实在参数的存储方式不同,形参是顺序存储,从低地址到高地址,而实参是逆序存储,从高地址向低地址存储。3.数据入栈时,会提升数据类型。如图。若数据是短整型,会提升到长整型;若是浮点型,则会提升到双精度型。4.栈中,高地......
  • strncmp源码,及其在含0x00字符数组中的使用问题
    源码结论,strncmp不能在比较字符数组中同一位置可能均为0x00时使用。#include<string.h>intSTRNCMP(constchar*s1,constchar*s2,size_tn){unsignedcharc1='\0';unsignedcharc2='\0';if(n>=4){size_tn4=n>&......
  • python004超市购物系统-计算机毕业设计源码+LW文档
    摘 要随着国内市场经济这几十年来的蓬勃发展,突然遇到了从国外传入国内的互联网技术,互联网产业从开始的群众不信任,到现在的离不开,中间经历了很多挫折。从当初的传统销售行业抵制互联网销售,到现在传统销售与网络销售的结合模式,都代表着网络购物是一种潮流,是线下实体经济的补充,不再......
  • python005基于BS架构的在线学习与推荐系统-计算机毕业设计源码+LW文档
    摘 要现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本在线学习与推荐系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率......
  • NS-3源码学习(三)Pcap文件分析
    NS-3源码学习(三)Pcap文件分析Pcap文件生成NS-3生成.pcap文件相关函数有EnablePcap()和EnalePcapAll(),支持第一个函数的类有ns3::YansWifiPhyHelperPointToPointEmuHelperCsmaHelper支持第二个函数的类有ns3::YansWifiPhyHelperPointToPointInternetStackHelper......
  • 大学生社会实践申报系统的设计与实现-计算机毕业设计源码+LW文档
    摘 要随着信息技术和网络技术的飞速发展,人类已进入全新信息化时代,传统管理技术已无法高效,便捷地管理信息。为了迎合时代需求,优化管理效率,各种各样的管理系统应运而生,各行各业相继进入信息管理时代,大学生社会实践申报系统就是信息时代变革中的产物之一。任何系统都要遵循系统设......