ybzhang 发表于 2006-9-11 20:29:28

新手学习linux,怎么运行UNIX环境高级编程的例子?

这几天刚开始学习linux,不会运行《UNIX环境高级编程》的例子。按照readme说的去做了,还是不行,我用的系统是Redhat9.0。哪个高手能详细指点一下吗?

mozilla 发表于 2006-9-12 12:48:18

出什么错了?

ybzhang 发表于 2006-9-12 16:21:18

1.        If you're using either SunOS 4.1.x, SVR4, or BSD/386, copy one of the
        files "Make.def.sun", "Make.def.svr4", or "Make.def.44" into the file
        "Make.defines".This file ("Make.defines") is included by all the
        Makefiles in the individual directories.Edit "Make.defines" as
        appropriate for your system.Note that *YOU MUST MODIFY* "Make.defines"
        with the pathname of the "libmisc.a" library, any special compiler
        flags, etc.

        If you aren't using one of these three systems, start with one of these
        three "Make.def.*" files and edit is as appropriate.I am interested
        in receiving any new versions of this file for additional Unix systems,
        as long as I can include them in future releases of this tar distribution.

2.        If you're using either SunOS 4.1.x, SVR4, or BSD/386, go into one of
        the directories "lib.sun", "lib.svr4", or "lib.44" and type "make" or
        "gmake".(Be sure to read the rest of this file first.)This makes
        the library "libmisc.a" that almost every other program requires.
        This is where the error functions from Appendix B.2 reside, for example.

        Note that 90% of the files in these three lib directories are just
        hard links to each other, as the source file is identical between
        the three systems.

        If you aren't using one of these three systems, pick the directory that
        is closest to your system, and modify as required ...The files with a
        link count of 1 (i.e., those that differ between the three different
        systems) will probably require the most work to port to other systems.
        Note also that the file "systype.sh" is used by the Makefile in these
        lib directories to try and determine which system we're on.You almost
        certainly need to modify this shell script also.

3.        The file "Sourcefiles" lists which source file corresponds to each
        Program in the book.Go into the desired directory and make whatever
        program you want.There is not a master Makefile that make's everything.

4.        Each Makefile may contain entries for programs other than those that
        are distributed in this source release.These are probably for small
        test programs that I wrote while writing the book.Since these programs
        aren't in the book, and since it would take too much time to go through
        and figure out what each one does and document it adequately, they are
        not in this release.


我按照1中所说,将Make.def.44的内容拷贝到文件Make.defines文件之后,在lib.44下执行make命令
/bin/sh :line 1: systype.sh : command not found. 一直print者句话, 好像死循环似的.我刚开始学习linux,还不懂Makefile,shell编程等东东. 请版主多多指点! 谢谢.

mozilla 发表于 2006-9-12 20:01:45

Make.def.xx都有哪些?

ybzhang 发表于 2006-9-13 12:11:01

Make.def.sun", "Make.def.svr4","Make.def.44

mozilla 发表于 2006-9-13 13:34:39

干脆把源码下载地址贴出来,我下下来看看

ybzhang 发表于 2006-9-14 10:21:32

版主说的很对,我怎么就没想起来呢。 :oops:
所有源代码都可用匿名ftp从因特网主机ftp.uu.net的published/books/stevens.advprog.tar.z 文件下载。
刚开始连接的时候有点慢。谢谢了。

mozilla 发表于 2006-9-15 13:25:51

把Makefile里的`systype.sh`改成`./systype.sh`
这代码太老了,在linux下编译很多错误

ybzhang 发表于 2006-9-19 09:07:27

问题已经解决,方法如下:
1. 先去www.apuebook.com下载最新代码;
2. 按照readme说明设置路径;
3. 在 apue.2e路径下运行make命令,在..\apue.2e\lib文件目录下产生libapue.a;
4. 现在即可运行书中的例子,例如运行..\apue.2e\file 目录下的hello.c:
# gcc-O hello.c   -laque   -o hello
   #./hello

tomclarence 发表于 2006-11-29 16:57:55

我怎么不行,搞了半天,还是没有通过,总是说有错误~~~
页: [1]
查看完整版本: 新手学习linux,怎么运行UNIX环境高级编程的例子?