-   Programming (
-   -   Trying to compile souce code that came with AUP book.... (

Scrag 11-15-2004 01:24 PM

Trying to compile souce code that came with AUP book....

I cant seem to be able to compile the soucecode correctly for the book I purchased "Advanced Unix Programming" by Marc Rochkind. I read the directions for this at:

but.....I dont really understand the directions, and dont know where to go from here. Any suggestions, I guess I just am looking for a simplified explination for a noob like me to get this running. The path I have the AUP code located is: /home/scrag/C/AUP and the DIR looks like this:


[scrag@localhost AUP]$ ls
aup2ex.tar.gz  c2/  c4/  c6/  c8/  common/  include/  makebuild.awk*  README*
c1/            c3/  c5/  c7/  c9/  defs.h~*  make      Makefile        ux/
[scrag@localhost AUP]$


Tinkster 11-15-2004 04:16 PM

Sorry mate, but without an actual problem... :)

Which bits of info in that document did you not
understand/could you not follow?


foo_bar_foo 11-15-2004 11:06 PM

that's a singular testamony to the brilliance/insanity of unix makefile systems
and the total unportability of old unix code
basically that ain't ever gonna work
this is what i did
to compile the stuff
copy the *.h files in common and include into c1-c9 copy *.h from include into common
hack /common/makebuild.spec so the line !echo CFLAGS = is blank after the "=" all that stuff is bad
make the shell script like the instructions say and chmod 755 on it
run that shell script that runs the awk script that proccesses the makebuild.spec file -- over and over with c1-c9 and common directories as argument
so now i cd into ./c1 and run make
fails at
make: *** No rule to make target `/common/macrostr.c', needed by `macrostr.o'. Stop.
cd ../common
fails with
make: *** No rule to make target `/common/macrostr.c', needed by `macrostr.o'. Stop.
gcc -c -o macrostr.o macrostr.c
and now the rub -- a million errors from the file macrostr.incl
look at macrostr.incl
what the &*^$ is that crap /???????
i have no idea
i give up
like so many UNIX programming books
this stuff needs to be ported to Linux before you can see what the heck it is.

Scrag 11-16-2004 01:09 AM

Well, thanks for the effort! I finally got my soucecode for my other book "Unix network programming" working after messing with it all day, guess i'll read that one instead ;)

foo_bar_foo 11-16-2004 09:24 PM

i tried this again and got it to work
think i left out the shell variable exports before
steps (hope i don't leave anything out)
put makebuild.awk and what i called in the top dir (from instructions)
set path top line in to top dir
export OS=LINUX
export LIBS="-lncurses -lutil"
export TLIBS="-pthread"
./ c1 (repeat c1-c9 and common)
cd ./common
cp *.h ../c1 (repeat c1-c9)
cd ../include
cp *.h ../c1 (repeat c1-c9 and common)
cd ./c1
make and it fails
make: *** No rule to make target `/common/macrostr.c', needed by `macrostr.o'. Stop
like before
so you have to hack the Makefile in each directory including common
they have

macrostr.o: $(AUPSRC)/common/macrostr.c $(AUPSRC)/common/macrostr.incl
        $(CC) $(CFLAGS) -c  -o $*.o $(AUPSRC)/common/macrostr.c

notice all the rest of the entries have the real path not the variable $(AUPSRC)
just replace $(AUPSRC) with the real path in each one and it works
it appears the crazy author has left you some stupid syntax errors in the code on purpose just to be cleaver teacher but they are easy to fix.

sorry i hade wrong pronouncement before -- not the first time i've ever been wrong :)

now i will look at this code it looks kind of interesting

All times are GMT -5. The time now is 04:43 PM.