我前段时间准备了Docker Container基于CentOS7.9的映像使用erlang otp从源代码构建22.3.4.11
https://github.com/erlang/otp/releases/download/OTP-22.3.4.11/otp_src-22.3.4.11.tar.gz.一切正常-如预期:
Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [hipe]
Eshell V10.7.2.4 (abort with ^G)
1> gen_sctp:open().
{ok,#Port<0.6>}
2>
现在我正在尝试做同样的事情,但在RockyLinux8.4/8.5DockerImage上,并从源代码构建相同的版本22.3.4.11
。所有这些都在同一台服务器上成功编译(作为基于CentOS 7.x的Docker Image(,但sctp不能正常工作仅适用于Rocky Linux Docker的Image。
Erlang/OTP 22 [erts-10.7.2.4] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [hipe]
Eshell V10.7.2.4 (abort with ^G)
1> gen_sctp:open().
** exception error: bad argument
in function gen_sctp:open/1
called as gen_sctp:open([])
2>
我试图测试22.3.4.23
版本,但显示了相同的错误
我还尝试从Rocky RPM软件包yum install erlang.x86_64
-22.0.7-1.el8
进行安装,一切正常
我想在Rocky上使用自己编译的版本,这样可以方便地将erlang更新到新版本
请告诉我应该如何为Rocky Linux的gen_sctp:open().
修复exception error: bad argument
?
适用于Rocky Linux的Dockerfile 8.5/CentOS 7.9.2009:
# For Rocky Linux
FROM rockylinux/rockylinux:8.5
# For CentOS Linux - comment above FROM and uncomment below FROM
# FROM centos:7.9.2009
### Update Image packages
RUN echo 'tsflags=nodocs' >> /etc/yum.conf &&
yum clean all &&
yum update -y &&
yum install -y
glibc-langpack-en
diffutils
findutils
wget
unzip
gcc
gcc-c++
autoconf.noarch
ncurses-devel
make
unixODBC-devel.x86_64
lksctp-tools
lksctp-tools-devel
ENV ERLANGOTP_VERSION 22.3.4.11
ENV ERLANGOTP_DIR_NAME otp_src_${ERLANGOTP_VERSION}
ENV ERLANGOTP_ARCHIVE otp_src_${ERLANGOTP_VERSION}.tar.gz
RUN wget https://github.com/erlang/otp/releases/download/OTP-${ERLANGOTP_VERSION}/${ERLANGOTP_ARCHIVE} -O /tmp/${ERLANGOTP_ARCHIVE} &&
tar -xf /tmp/${ERLANGOTP_ARCHIVE} -C /tmp &&
pushd /tmp/${ERLANGOTP_DIR_NAME} &&
./otp_build autoconf &&
./configure
--enable-sctp
--prefix=/usr/local
&&
make -j $(nproc) -l $(nproc) &&
make install &&
rm -rf /tmp/${ERLANGOTP_DIR_NAME} /tmp/${ERLANGOTP_ARCHIVE}
Docker构建命令:docker build -t erltest:1.0.0 .
Docker运行测试命令:docker run -it --rm erltest:1.0.0 bash
erl
gen_sctp:open().
CentOS 7.9/Locky Linux 8.5 Docker镜像的SCTP配置结果(在注释中发现SCTP的差异(:
checking for netpacket/packet.h... yes
checking for netinet/sctp.h... yes
checking for sctp_bindx... no
checking for sctp_peeloff... no
checking for sctp_getladdrs... no
checking for sctp_freeladdrs... no
checking for sctp_getpaddrs... no
checking for sctp_freepaddrs... no
checking whether SCTP_UNORDERED is declared... yes
checking whether SCTP_ADDR_OVER is declared... yes
checking whether SCTP_ABORT is declared... yes
checking whether SCTP_EOF is declared... yes
# for CentOS 7.x - below:
checking whether SCTP_SENDALL is declared... yes
# for Rocky Linux - below:
checking whether SCTP_SENDALL is declared... no
checking whether SCTP_ADDR_CONFIRMED is declared... yes
checking whether SCTP_DELAYED_ACK_TIME is declared... yes
checking whether SCTP_EMPTY is declared... yes
checking whether SCTP_UNCONFIRMED is declared... yes
checking whether SCTP_CLOSED is declared... yes
checking whether SCTPS_IDLE is declared... no
checking whether SCTP_BOUND is declared... no
checking whether SCTPS_BOUND is declared... no
checking whether SCTP_LISTEN is declared... no
checking whether SCTPS_LISTEN is declared... no
checking whether SCTP_COOKIE_WAIT is declared... yes
checking whether SCTPS_COOKIE_WAIT is declared... no
checking whether SCTP_COOKIE_ECHOED is declared... yes
checking whether SCTPS_COOKIE_ECHOED is declared... no
checking whether SCTP_ESTABLISHED is declared... yes
checking whether SCTPS_ESTABLISHED is declared... no
checking whether SCTP_SHUTDOWN_PENDING is declared... yes
checking whether SCTPS_SHUTDOWN_PENDING is declared... no
checking whether SCTP_SHUTDOWN_SENT is declared... yes
checking whether SCTPS_SHUTDOWN_SENT is declared... no
checking whether SCTP_SHUTDOWN_RECEIVED is declared... yes
checking whether SCTPS_SHUTDOWN_RECEIVED is declared... no
checking whether SCTP_SHUTDOWN_ACK_SENT is declared... yes
checking whether SCTPS_SHUTDOWN_ACK_SENT is declared... no
checking for struct sctp_paddrparams.spp_pathmtu... yes
checking for struct sctp_paddrparams.spp_sackdelay... yes
checking for struct sctp_paddrparams.spp_flags... yes
checking for struct sctp_remote_error.sre_data... yes
checking for struct sctp_send_failed.ssf_data... yes
checking for struct sctp_event_subscribe.sctp_authentication_event... yes
checking for struct sctp_event_subscribe.sctp_sender_dry_event... yes
checking for sched.h... (cached) yes
...
checking ERTS version... 10.7.2.4
checking OTP release... 22
checking OTP version... 22.3.4.11
我再次测试了内核4.19.x
和5.15.5
的所有内容,并注意到以下内容:
- 在
kernel 4.19.x
上运行的Red Hat 7.x机器:
- 基于
CentOS 7.9
的Docker镜像与erlang otp从源代码构建22.3.4.11
-工作正常({ok,#Port<0.6>}
( - 基于
Rocky Linux 8.5
的Docker镜像与erlang otp从源代码构建22.3.4.11
-不起作用(** exception error: bad argument
(
- 相同的Red Hat 7.x机器,但在
kernel 5.15.5
上运行:
- 基于
CentOS 7.9
的Docker镜像与erlang otp从源代码构建22.3.4.11
-工作正常({ok,#Port<0.6>}
( - 基于
Rocky Linux 8.5
的Docker镜像与erlang otp从源代码构建22.3.4.11
-工作正常({ok,#Port<0.6>}
(
看起来基于Rocky Linux 8.5
创建的Docker Image喜欢现代内核。较旧的4.19.x
内核会导致问题,但较新的5.15.5
内核使用相同的基于Rocky Linux 8.5
的Docker映像可以正常工作——我不知道为什么它会解决问题。
顺便说一句。默认的Rocky Linux 8.5
内核是4.18.0
。