ubuntu20.04编译安装ckermit
我呢之前一直使用的是ubuntu18.04,最近在安装了某个软件之后,再加上自己的操作不当最终导致ubuntu系统卡死无法进入桌面环境,早就想更新20.04的我,终于迎来了换最新版ubuntu的理由
常规安装ckermit过程(通过apt下载方式)请参考“Linux安装kermit”这篇文章。本文主要介绍通过源码安装方式。
源码方式安装ckermit 一、源码下载The Kermit Project | Columbia University 注:通过哥伦比亚大学下载常常会因为网络原因导致下载速度过慢,甚至无法下载
这里提供已经下载好的最新版本源码包:
链接: C-Kermit 9.0 source
提取码: 3ssb
解压源码压缩包
unzip x.zip ls ckc302.txt ckcftp.c ckcnet.c ckcssl.h ckcxla.h ckuath.h ckufio.c ckusig.h ckuus6.c ckuver.h ckvioc.c ckvrms.h COPYING.TXT ckcasc.h ckcker.h ckcnet.h ckcsym.h ck_des.c ckucmd.c ckuker.nr ckutio.c ckuus7.c ckuxla.c ckvioc.h ckvrtl.c makefile ckcdeb.h ckclib.c ckcpro.c ckctel.c ck_ssl.c ckucmd.h ckupty.c ckuus2.c ckuusr.c ckuxla.h ckvker.com ckvrtl.h x.zip ckcfn2.c ckclib.h ckcpro.w ckctel.h ck_ssl.h ckucns.c ckupty.h ckuus3.c ckuusr.h ckvcon.c ckvker.mms ckvtio.c ckcfn3.c ckcmai.c ck_crp.c ckcuni.c ckuat2.h ckucon.c ckuscr.c ckuus4.c ckuusx.c ckvcvt.c ckvold.c ckvvms.h ckcfns.c ckcmdb.c ckcsig.h ckcuni.h ckuath.c ckudia.c ckusig.c ckuus5.c ckuusy.c ckvfio.c ckvold.com ckwart.c编译源码
make linux出现错误
In file included from ckucmd.c:41: ckucmd.c: In function ‘cmdconchk’: ckucmd.c:7385:48: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘_cnt’ 7385 | debug(F101,"cmdconchk stdin->_cnt","",stdin->_cnt); | ^~ ckcdeb.h:5129:51: note: in definition of macro ‘debug’ 5129 | ((void)(deblog?dodebug(a,b,(char *)(c),(CK_OFF_T)(d)):0)) | ^ ckucmd.c:7386:14: error: ‘FILE’ {aka ‘struct _IO_FILE’} has no member named ‘_cnt’ 7386 | x = stdin->_cnt; | ^~打开报错文件ckucmd.c,定位到报错行
7371 /* Here we must look inside the stdin buffer - highly platform dependent */ 7372 7373 #ifdef _IO_file_flags /* Linux */ 7374 x = (int) ((stdin->_IO_read_end) - (stdin->_IO_read_ptr)); 7375 debug(F101,"cmdconchk _IO_file_flags","",x); 7376 #else /* _IO_file_flags */ 7377 #ifdef USE_FILE_CNT /* Traditional */ 7378 #ifdef VMS 7379 debug(F101,"cmdconchk (*stdin)->_cnt","",(*stdin)->_cnt); 7380 x = (*stdin)->_cnt; 7381 #else 7382 #ifdef NOARROWKEYS 7383 debug(F101,"cmdconchk NOARROWKEYS x","",0); 7384 #else 7385 debug(F101,"cmdconchk stdin->_cnt","",stdin->_cnt); 7386 x = stdin->_cnt; 7387 #endif /* NOARROWKEYS */ 7388 #endif /* VMS */ 7389 if (x == 0) x = conchk(); 7390 if (x < 0) x = 0; 7391 #else /* USE_FILE_CNT */ 7392 #ifdef USE_FILE__CNT /* HP-UX */ 7393 debug(F101,"cmdconchk stdin->__cnt","",stdin->__cnt); 7394 x = stdin->__cnt; 7395 if (x == 0) x = conchk(); 7396 if (x < 0) x = 0; 7397 #else /* USE_FILE_CNT */ 7398 #ifdef USE_FILE_R /* FreeBSD, OpenBSD, etc */ 7399 debug(F101,"cmdconchk stdin->_r","",stdin->_r); 7400 x = stdin->_r; 7401 if (x == 0) x = conchk(); 7402 if (x < 0) x = 0; 7403 7404 /* Fill in any others here... */ 7405 7406 #endif /* USE_FILE_R */ 7407 #endif /* USE_FILE__CNT */ 7408 #endif /* USE_FILE_CNT */ 7409 #endif /* _IO_file_flags */在7371行的注释告诉我们要关注stdin buffer,这个buf(struct _iobuf也就是FILE结构体)和平台高度相关。而Linux平台下的stdin结构体没有_cnt成员,该成员在MinGW和MSVC编译环境中才有。因此这里应该执行#ifdef _IO_file_flags下的代码,这里需要自己把这个宏添加进去。
注:[参考链接]https://blog.mxslly.com/archives/172.html
进入makefile报错行[6054],及linuxa的标签,在CFLAGS后添加-D_IO_file_flags。
linuxa: @echo 'Making C-Kermit $(CKVER) for Linux 1.2 or later...' @echo 'IMPORTANT: Read the comments in the linux section of the' @echo 'makefile if you have trouble.' $(MAKE) xermit KTARGET=$${KTARGET:-$(@)} "CC = gcc" "CC2 = gcc" \ "CFLAGS = -O -DLINUX -pipe -funsigned-char -DFNFLOAT -DCK_POSIX_SIG \ -DCK_NEWTERM -DTCPSOCKET -DLINUXFSSTND -DNOCOTFMC -DPOSIX -D_IO_file_flags\ -DUSE_STRERROR $(KFLAGS)" "LNKFLAGS = $(LNKFLAGS)" \ "LIBS = $(LIBS) -lm" 四、再次编译再次执行make linux进行编译,编译成功会生成wermit可执行文件,将该可执行文件移动到/usr/local/bin目录下(为了方便使用)。
make linux #注:该命令需要root权限 cp wermit /usr/local/bin/kermit 五、编辑.kermrc(在家目录~/下完成) $ cd ~ $ vim .kermrc #.kermrc文件内容,一般USB转串口会分配为/dev/ttyuSB0,如果是用串口线连接主机的话,需要设置为/dev/ttyS0,设备名根据自己电脑识别的自行修改。 set line /dev/ttyUSB0 set speed 115200 set carrier-watch off set handshake none set flow-control none robust set file type bin set file name lit set rec pack 1000 set send pack 1000 set window 5编辑完成保存退出后,若串口设置这正确,执行 sudo kermit一直出现如下内容。
?SET SPEED has no effect without prior SET LINE Sorry, you must SET LINE or SET HOST first