merworth@ut-ngp.UUCP (Boyd Merworth) (11/11/86)
I have been trying to install C++ version 1.1 under 4.3BSD running on a VAX 11/780. Several months ago I saw a posting concerning the following problem but do not remember the fix. This did compile under 4.2BSD. --------------- mv lib/mk/libC.a . CC -O -DBSD -o munch -c lib/static/munch.c CC lib/static/munch.c: cc -c -O -o munch munch..c -lC mv: munch..o: Cannot access: No such file or directory rm munch.o rm: munch.o nonexistent *** Exit 1 Stop. ---------------- Does anyone have a fix to CC for this? Or can anyone point to what has suddenly caused this not to compile under 4.3BSD. Thanks for any advice. ______________ Boyd Merworth The University of Texas at Austin, Computation Center, Austin, TX 78712 merworth@ngp.utexas.edu {ihnp4,allegra,gatech}!ut-ngp!merworth merworth@ngp.ARPA {seismo}!ut-sally!merworth
toddb@tekcrl.UUCP (Todd Brunhoff) (11/11/86)
In article <4278@ut-ngp.UUCP> merworth@ut-ngp.UUCP (Boyd Merworth) writes: >I have been trying to install C++ version 1.1 under 4.3BSD running on >a VAX 11/780. Several months ago I saw a posting concerning the following >problem but do not remember the fix. This did compile under 4.2BSD. > >--------------- >mv lib/mk/libC.a . >CC -O -DBSD -o munch -c lib/static/munch.c >CC lib/static/munch.c: >cc -c -O -o munch munch..c -lC >mv: munch..o: Cannot access: No such file or directory >rm munch.o >rm: munch.o nonexistent >*** Exit 1 > >Stop. I think the problem has to do with a bug in the CC shell script which just happens to work on a SYSV or 4.2BSD system but breaks on 4.3. When the top-level makefile says CC -O -DBSD -o munch -c lib/static/munch.c It eventually exececutes cc -c -o munch munch..c On some systems, the -o is ignored and the outputfile is munch..o. 4.3 does not ignore it, and puts the output file in 'munch', hence, further processing on munch..o breaks. Here are the diffs of the change I made to CC. It also fixes a bug which BSD 'test' has had for some time. --------------- Old CC and New CC-------------- 158,159c158,159 < echo "$ccC $P -c $X $LIBRARY" 1>&2 < $ccC $P -c $X $LIBRARY --- > echo "$ccC $P -c $C $LIBRARY" 1>&2 > $ccC $P -c $C $LIBRARY 166,167c166,167 < echo "$ccC $P $X $LIBRARY" 1>&2 < $ccC $P -c $X >__err # compile, no load --- > echo "$ccC $P $C $LIBRARY" 1>&2 > $ccC $P -c $C >__err # compile, no load 199c199 < if test "$R" -a ! "$PLUSI" --- > if test "$R" != "" -a "$PLUSI" = ""
news@cit-vax.Caltech.Edu (Usenet netnews) (11/12/86)
Organization : California Institute of Technology Keywords: From: jon@oddhack.Caltech.Edu (Jon Leech) Path: oddhack!jon In article <4278@ut-ngp.UUCP> merworth@ut-ngp.UUCP (Boyd Merworth) writes: >mv lib/mk/libC.a . >CC -O -DBSD -o munch -c lib/static/munch.c >CC lib/static/munch.c: >cc -c -O -o munch munch..c -lC >mv: munch..o: Cannot access: No such file or directory >rm munch.o >rm: munch.o nonexistent >*** Exit 1 > >Does anyone have a fix to CC for this? The quickest 'fix' is to change the actions in the 'munch' target in the top-level makefile like this: munch: always $(CC) $(CCFLAGS) -c lib/static/munch.c $(CC) $(CCFLAGS) -o munch munch.o rm munch.o -- Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon) Caltech Computer Science Graphics Group __@/
jjhnsn@ut-ngp.UUCP (James Lee Johnson) (11/15/86)
Todd Brunhoff is correct in his diagnosis of the CC problem under 4.3. However, his fix is a little severe. Replacing $X with $C on the compile command lines will get rid of the offending -o option. Unfortunately, it will also eliminate any valid compile options (e.g. -O) that the C++ user may have specified. Enclosed is a diff of mods to make the CC script more discriminating about passing cc options. This patch also includes Todd Brunhoff's fix to make the tests for a null string work under 4.2BSD. I believe that these mods will work under 4.?BSD and System V. However, they have only been tested under 4.3BSD. Please let me know if you find a problem with them. Technical Details The problem is that "CC" is passing the -o option to the compile only invocation of "cc". While the 4.2BSD C compiler ignored it, it is actually incorrect. It appears that the $X shell variable holds arguments for the compile step. My solution was to not put -o and its argument in the $X variable. Similarly, I handled "*.o" arguments as a special case, copying them to $Z (the shell variable for loader arguments), but not to $X. Conversely, "-O" is handled a a special case that is copied to the $X variable, but not to $Z. Also, it seemed to me that the $LIBRARY shell variable should not be passed to the compile only invocations of "cc". -- James Lee Johnson, UTexas Computation Center, Austin, Texas 78712 ARPA: jjhnsn@ngp.cc.utexas.edu jjhnsn@ut-ngp.ARPA UUCP: allegra!ut-ngp!jjhnsn gatech!ut-ngp!jjhnsn ihnp4!ut-ngp!jjhnsn seismo!ut-sally!jjhnsn harvard!ut-sally!jjhnsn -- *** CC.dst Mon Aug 11 10:21:41 1986 --- CC Fri Nov 14 15:42:15 1986 *************** *** 19,22 **** --- 19,27 ---- cfrontC=${cfrontC-cfront} cppC=${cppC-/lib/cpp} + # + # $Y is C preprocessor arguments (for $cppC) + # $X is C compiler arguments (for $ccC -c) + # $Z is C loader arguments (for $ccC) + # G=0 for A do *************** *** 54,59 **** -c) CF=1 ;; ! -o) X="$X $A" ! Z="$Z $A" OX=1 ;; --- 59,65 ---- -c) CF=1 ;; ! -O) X="$X $A" ! ;; ! -o) Z="$Z $A" OX=1 ;; *************** *** 62,65 **** --- 68,74 ---- -.*) SUF=`expr "$A" : '-\(.*\)'` ;; + *.o) Z="$Z $A" + G=1 + ;; *.c) if test -f $A then *************** *** 128,132 **** XON="" else - X="$X $A" Z="$Z $A" if test $OX --- 137,140 ---- *************** *** 135,138 **** --- 143,147 ---- OX="" else + X="$X $A" G=1 fi *************** *** 156,161 **** if test $CF # -c: skip link edit then ! echo "$ccC $P -c $X $LIBRARY" 1>&2 ! $ccC $P -c $X $LIBRARY EE=$? for A in $MVLIST --- 165,170 ---- if test $CF # -c: skip link edit then ! echo "$ccC $P -c $X" 1>&2 ! $ccC $P -c $X EE=$? for A in $MVLIST *************** *** 197,201 **** esac ! if test "$R" -a ! "$PLUSI" then rm $C --- 206,210 ---- esac ! if test "$R" != "" -a "$PLUSI" = "" then rm $C