📄 ckuins.txt
字号:
char versus unsigned char stupidity again. Try to find a compiler switch like GCC's "-funsigned-char". Failing that, add -DCKQUERYTYPE=xxx to CFLAGS, where xxx is whatever 'man dn_expand' tells you the type of the 4th argument should be (presumably either char or unsigned char; in the latter case use CHAR to avoid confusion caused by multiple words. Switch Table Overflow (in [112]ckcuni.c) Add -DNOUNICODE to CFLAGS. Compile-time warnings about ck_out() or tgetstr() or tputs(): Easy solution: Add -DNOTERMCAP to CFLAGS. But then you lose the SCREEN function. Real solution: Try all different combinations of the following CFLAGS:-DTPUTSARGTYPE=char -DTPUTSFNTYPE=int-DTPUTSARGTYPE=int -DTPUTSFNTYPE=void Until the warnings go away, except maybe "ck_outc: return with a value in a function returning void", and in that case also add -DTPUTSISVOID. "Passing arg 1 of to tputs() makes pointer from integer without a cast": Add -DTPUTSARG1CONST to CFLAGS. "Undefined symbol: dup2" Add -DNOZEXEC to CFLAGS. "header file 'termcap.h' not found" Add -DNOHTERMCAP to CFLAGS. Other difficulties are generally of the "where is curses.h and what is it called this week?" variety (most easily solved by making symlinks in the include and lib directories), or overzealous complaints regarding type mismatches in function calls because of the totally needless and silly signed versus unsigned char conflict (*), etc. In any case, please send any compilation or linking warnings or errors to the author, preferably along with fixes. * C-Kermit does not use the signed property of chars at all anywhere, ever. So if all chars and char *'s can be made unsigned at compile time, as they can in gcc with "-funsigned-char", they should be. IMPORTANT: If you find any of these hints necessary for a particular make target (or you hit upon others not listed here), PLEASE SEND A REPORT TO:[113]kermit-support@columbia.edu ________________________________________________________________________ 4.1. The Unix Makefile [ [114]Top ] [ [115]Contents ] [ [116]Section Contents ] [ [117]Next ] [ [118]Previous ] If your distribution does not contain a file with the name "makefile" or "Makefile", then rename the file called ckuker.mak to makefile:mv ckuker.mak makefile Then type "make xxx", where xxx is the platform you want to build C-Kermit for. These are listed in the [119]comments at the top of the makefile. For example, to build C-Kermit for Linux, type:make linux Here are some typical examples: Target Description linux Linux, any version on any hardware platform openbsd OpenBSD, any version on any hardware platform aix43 AIX 4.3 aix43g AIX 4.3, built with gcc solaris9 Solaris 9 solaris9g Solaris 9 built with gcc hpux1100 HP-UX 11-point-anything The makefile is quite long, and at least two versions of Unix, SCO Xenix/286 and 2.x BSD, cannot cope with its length. An attempt to "make sco286" gives the message "Make: Cannot alloc mem for env.. Stop". Solution: edit away some or all of the nonrelevant material from the makefile. (A separate version of the makefile is provided for BSD 2.x: ckubs2.mak but C-Kermit 8.0 can't be built for BSD 2.x -- it has simply grown too large.) Some make programs reportedly cannot handle continued lines (lines ending in backslash (\)). If you have a problem with the makefile, try editing the makefile to join the continued lines (remove the backslashes and the following linefeed). Other makefile troubles may occur because tabs in the makefile have somehow been converted to spaces. Spaces and tabs are distinct in Unix makefiles. Similarly, carriage returns might have been added to the end of each line, which also proves confusing to most Unix versions of make. Check to see if there are comments about your particular version in its makefile target itself. In a text editor such as EMACS or VI, search for the make entry name followed by a colon, e.g. "linux:" (if you really are building C-Kermit for Linux, do this now). Check to see if there are comments about your particular version in the [120]ckubwr.txt file ([121]CLICK HERE for the Web version). If you have trouble with building [122]ckwart.c, or running the resulting wart preprocessor program on [123]ckcpro.w: 1. Just "touch" the [124]ckcpro.c file that comes in the distribution and then give the "make" command again, or: 2. Compile ckwart.c "by hand": cc -o wart ckwart.c, or: 3. Try various other tricks. E.g. one Linux user reported that that adding the "static" switch to the rule for building wart fixed everything:wart: ckwart.$(EXT) $(CC) -static -o wart ckwart.$(EXT) $(LIBS) If your compiler supports a compile-time option to treat ALL chars (and char *'s, etc) as unsigned, by all means use it -- and send me email to let me know what it is (I already know about gcc -funsigned-char). To add compilation options (which are explained later in this document) to your makefile target without editing the makefile, include "KFLAGS=..." on the make command line, for example:make linux KFLAGS=-DNODEBUGmake bsd "KFLAGS=-DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET" Multiple options must be separated by spaces. Quotes are necessary if the KFLAGS= clause includes spaces. The KFLAGS are added to the end of the CFLAGS that are defined in the selected makefile target. For example, the "bsd" entry includes -DBSD4 -DTCPSOCKET, so the second example above compiles Kermit with the following options:-DBSD4 -DTCPSOCKET -DKANJI -DNODEBUG -DNOTLOG -DDYNAMIC -UTCPSOCKET (Notice how "-UTCPSOCKET" is used to negate the effect of the "-DTCPSOCKET" option that is included in the makefile target.) WARNING: Be careful with KFLAGS. If you build C-Kermit, change some files, and then run make again using the same make entry but specifying different KFLAGS than last time, make won't detect it and you could easily wind up with inconsistent object modules, e.g. some of them built with a certain option, others not. When in doubt, "make clean" first to make sure all your object files are consistent. Similarly, if you change CFLAGS, LIBS, or any other items in the makefile, or you rebuild using a different makefile target, "make clean" first. If you create a new makefile target, use static linking if possible. Even though this makes your C-Kermit binary bigger, the resulting binary will be more portable. Dynamically linked binaries tend to run only on the exact configuration and version where they were built; on others, invocation tends to fail with a message like:Can't find shared library "libc.so.2.1" ________________________________________________________________________ 4.2. The C-Kermit Initialization File [ [125]Top ] [ [126]Contents ] [ [127]Section Contents ] [ [128]Next ] [ [129]Previous ] (This section is obsolete.) Read [130]Section 5 about the initialization file. ________________________________________________________________________ 4.3. The 2.x BSD Makefile [ [131]Top ] [ [132]Contents ] [ [133]Section Contents ] [ [134]Next ] [ [135]Previous ] This section is obsolete. C-Kermit 6.0 was the last release that could be built on PDP-11 based BSD versions. ________________________________________________________________________ 4.4. The Plan 9 Makefile [ [136]Top ] [ [137]Contents ] [ [138]Section Contents ] [ [139]Next ] [ [140]Previous ] Use the separate makefile [141]ckpker.mk. NOTE: The Plan 9 version of C-Kermit 8.0 has not yet been built. There should be no impediment to building it. However, even when built successfully, certain key features are missing, notably TCP/IP networking. ________________________________________________________________________ 4.5. Makefile Failures [ [142]Top ] [ [143]Contents ] [ [144]Section Contents ] [ [145]Previous ] First, be sure the source files are stored on your current disk and directory with the right names (in lowercase). Second, make sure that the makefile itself does not contain any lines with leading spaces: indented lines must all start with horizontal TAB, and no spaces. Then make sure that your Unix PATH is defined to find the appropriate compiler for your makefile target. For example, on SunOS systems, "make sunos41" builds C-Kermit for the BSD environment, and assumes that /usr/ucb/cc will be used for compilation and linking. If your PATH has /usr/5bin ahead of /usr/ucb, you can have problems at compile or link time (a commonly reported symptom is the inability to find "ftime" during linking). Fix such problems by redefining your Unix PATH, or by specifying the appropriate "cc" in CC= and CC2= statements in your makefile target. During edits 166-167, considerable effort went into making C-Kermit compilable by ANSI C compilers. This includes prototyping all of C-Kermit's functions, and including the ANSI-defined system header files for system and library functions, as defined in K&R, second edition: <string.h>, <stdlib.h>, <unistd.h> (except in NeXTSTEP this is <libc.h>), and <sys/stdtypes.h>. If you get warnings about any of these header files not being found, or about argument mismatches involving pid_t, uid_t, or gid_t, look in ckcdeb.h and make amendments. C-Kermit assumes it is being compiled by an ANSI-compliant C compiler if __STDC__ is defined, normally defined by the compiler itself. You can force ANSI compilation without defining __STDC__ (which some compilers won't let you define) by including -DCK_ANSIC on the cc command line. On the other hand, if your compiler defines __STDC__ but still complains about the syntax of Kermit's function prototypes, you can disable the ANSI-style function prototyping by including -DNOANSI on the command line. For SCO OpenServer, UNIX, ODT, and XENIX compilations, be sure to pick the most appropriate [146]makefile target, and be sure you have installed an SCO development system that is keyed to your exact SCO operating system release, down to the minor version (like 2.3.1). Also note that SCO distributes some of its libraries in encrypted form, and they must be decrypted before C-Kermit can be linked with them. If not, you might see a message like:ld: file /usr/lib/libsocket.a is of unknown type: magic number = 6365 To decrypt, you must supply a key (password) that came with your license. Call SCO for further info. If your compiler uses something other than int for the pid (process id) data type, put -DPID_T=pid_t or whatever in your CFLAGS. If you get complaints about unknown data types uid_t and gid_t, put -DUID_T=xxx -DGID_T=yyy in your CFLAGS, where xxx and yyy are the appropriate types. If your compilation fails because of conflicting or duplicate declarations for sys_errlist, add -DUSE_STRERROR or -DNDSYSERRLIST to CFLAGS. If your compilation dies because getpwnam() is being redeclared (or because of "conflicting types for getwpnam"), add -DNDGPWNAM to your CFLAGS. If that doesn't work, then add -DDCGPWNAM to your CFLAGS (see ckufio.c around line 440). If the compiler complains about the declaration of getpwnam() during an ANSI C compilation, remove the declaration from ckufio.c or change the argument in the prototype from (char *) to (const char *). If you get complaints that getpwuid() is being called with an improper type, put -DPWID_T=xx in your CFLAGS. If you get compile-time warnings that t_brkc or t_eofc (tchars structure members, used in BSD-based versions) are undefined, or structure-member- related warnings that might be traced to this fact, add -DNOBRKC to CFLAGS. If you get a linker message to the effect that _setreuid or _setregid is not defined, add -DNOSETREU to CFLAGS, or add -DCKTYP_H=blah to CFLAGS to make C-Kermit read the right <types.h>-kind-of-file to pick up these definitions. If you get a message that _popen is undefined, add -DNOPOPEN to CFLAGS. If you get a complaint at compile time about an illegal pointer-integer combination in ckufio.c involving popen(), or at link time that _popen is an undefined symbol, add the declaration "FILE *popen();" to the function zxcmd() in ckufio.c (this declaration is supposed to be in <stdio.h>). If making this change does not help, then apparently your Unix does not have the popen() function, so you should add -DNOPOPEN to your make entry, in which case certain functions involving "file" i/o to the standard input and output of subprocesses will not be available. If your linker complains that _getcwd is undefined, you can add a getcwd() function to ckufio.c, or add it to your libc.a library using ar:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -