服务器环境java1.8.0_202+libzmq4.3.5+jzmq3.1.0编译安装

内容目录

服务器环境
centos7.9

不能寻路或者启动报错recast 异常断开进不去游戏,检查有没缺失这个文件

/usr/local/lib/librecast.so
github地址 https://github.com/recastnavigation/recastnavigation

1 设置java环境

升级jdk

官网下载jdk-8u202-linux-x64.rpm https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html


rpm -ivh /root/jdk-8u202-linux-x64.rpm
wait
sed -r -i '/java|CLASSPATH|JAVA_HOME|LD_LIBRARY_PATH/ s/^/#&/' /etc/profile
echo "#set java environment
JAVA_HOME=/usr/java/jdk1.8.0_202-amd64
CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar
PATH=\$JAVA_HOME/bin:\$PATH
LD_LIBRARY_PATH=/usr/local/lib:\$LD_LIBRARY_PATH
export JAVA_HOME CLASSPATH PATH LD_LIBRARY_PATH" >> /etc/profile
echo -e "\e\033[33m jdk_rpm install ok! \e[0m"
ldconfig
source /etc/profile && java -version

2安装 libzmq v4.3.4

java 环境上一步已配置

首先安装构建zeromq的依赖工具:

yum install libtool gcc gcc-c++ make libuuid-devel autoconf automake
yum -y install git
git clone https://github.com/zeromq/libzmq.git

git境内速度不佳使用 git clone https://github.com.cnpmjs.org/zeromq/libzmq.git

切换目录

cd libzmq/

查看tag

git tag

tag只是快照,检出到本地自定义分支glv4.3.4

git checkout -b glv4.3.5 v4.3.5

查看是否切换成功

git branch

配置、构建、安装、验证:

./autogen.sh
./configure
make -j4 && sudo make install

验证 进入目录

cd /root/libzmq/perf/
./local_lat tcp://127.0.0.1:65432 1 100

打开另一个终端 进入目录

cd /root/libzmq/perf/
./remote_lat tcp://127.0.0.1:65432 1 100

返回 message size: 1 [B] roundtrip count: 100 average latency: 24.860 [us] 表示成功

3安装jzmq (雷同上面)

cd /root/
git clone https://github.com/zeromq/jzmq.git

git境内速度不佳使用 git clone https://github.com.cnpmjs.org/zeromq/jzmq.git

cd jzmq/
git tag

tag只是快照,检出到本地自定义分支jzmq3.1.0

git checkout -b jzmq3.1.0 v3.1.0

查看branch 返回jzmq3.1.0 master

git branch

vim src/main/c++/Event.cpp

编辑Event.cpp ,参考代码对比 https://github.com/zeromq/jzmq/commit/eb40d6db43ce3545e623dad6cc6721a90885b5ba 替换不然make install报错

#Event.cpp:60:5: error: 'zmq_event_t' was not declared in this scope
:<<!
Event.cpp: In function '_jobject* Java_org_zeromq_ZMQ_00024Event_recv(JNIEnv*, jclass, jlong, jint)':
Event.cpp:60:5: error: 'zmq_event_t' was not declared in this scope
     zmq_event_t event;
     ^
Event.cpp:60:17: error: expected ';' before 'event'
     zmq_event_t event;
                 ^
Event.cpp:72:13: error: 'event' was not declared in this scope
     memcpy(&event.event, data, sizeof(event.event));
             ^
Event.cpp:148:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[2]: *** [libjzmq_la-Event.lo] Error 1
make[2]: Leaving directory `/root/jzmq/src/main/c++'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/root/jzmq/src/main/c++'
make: *** [install-recursive] Error 1
!

raw格式查看https://raw.githubusercontent.com/zeromq/jzmq/eb40d6db43ce3545e623dad6cc6721a90885b5ba/src/main/c%2B%2B/Event.cpp 复制 编辑到 src/main/c++/Event.cpp

./autogen.sh
./configure
make -j4 && sudo make install

编译后文件位置

#so文件
#/usr/local/lib
#jar
#/usr/local/share/java/zmq.jar

[root@iZuf6hegfy8iwwureeshuiZ jzmq]# cd /usr/local/lib
[root@iZuf6hegfy8iwwureeshuiZ lib]# ll
total 48944
-rw-r--r-- 1 root root   626664 May 15 11:57 libjzmq.a
-rwxr-xr-x 1 root root      957 May 15 11:57 libjzmq.la
lrwxrwxrwx 1 root root       16 May 15 11:57 libjzmq.so -> libjzmq.so.0.0.0
lrwxrwxrwx 1 root root       16 May 15 11:57 libjzmq.so.0 -> libjzmq.so.0.0.0
-rwxr-xr-x 1 root root   277312 May 15 11:57 libjzmq.so.0.0.0
-rw-r--r-- 1 root root 36889226 May 15 10:39 libzmq.a
-rwxr-xr-x 1 root root      925 May 15 10:39 libzmq.la
lrwxrwxrwx 1 root root       15 May 15 10:39 libzmq.so -> libzmq.so.5.2.5
lrwxrwxrwx 1 root root       15 May 15 10:39 libzmq.so.5 -> libzmq.so.5.2.5
-rwxr-xr-x 1 root root 12304192 May 15 10:39 libzmq.so.5.2.5
drwxr-xr-x 2 root root     4096 May 15 10:39 pkgconfig
drwxr-xr-x 3 root root     4096 Apr 20 12:07 python3.6
[root@iZuf6hegfy8iwwureeshuiZ lib]# stat /usr/local/share/java/zmq.jar
  File: ‘/usr/local/share/java/zmq.jar’
  Size: 49293           Blocks: 104        IO Block: 4096   regular file
Device: fd01h/64769d    Inode: 928023      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-05-15 11:57:22.744031172 +0800
Modify: 2021-05-15 11:57:22.744031172 +0800
Change: 2021-05-15 11:57:22.744031172 +0800

4 安装dos2unix

yum install -y dos2unix

5 centos7关闭firewalld安装iptables 主要为了兼容centos6游戏服的批量操作

systemctl stop firewalld
systemctl disable firewalld
yum -y install iptables

yum install iptables-services.x86_64 -y
yum -y install bind-utils

安装mysql 能支持mysql mysqldump的后续操作

yum install mysql 

修改open file数量,然后重启生效

echo " 
* soft nofile 65535
* hard nofile 65535
" >>/etc/security/limits.conf
reboot

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注