Re: compiling wrapit

From: Alexander Petkov <greenkov_at_nyahnyahspammersnyahnyah>
Date: Fri, 4 Jan 2008 15:56:31 -0700

On Jan 4, 2008 10:22 AM, Alexander Petkov <greenkov_at_gmail.com> wrote:
>
> > > I think your wrapit.c got clobbered again.
> > >
> > > It contains the definitions that are undefined below. Can you recopy
> > > the wrapit.c I gave you, and run "make" again? Don't do a "make
> > > clean" or anything like that, because I think one of the commands
> > > below is clobbering your wrapit.c, and that command probably won't be
> > > run again if you leave everything else alone.
> > >
> > > If the new wrapit.c works this time, then we need to figure
> > > out which command is clobbering it.
> > >
> > > Let me know if you get the above working, and then we can work offline
> > > to see what's happening to wrapit.c.
> > >
> > > --Mary
> >
> > Hi Mary,
> >
> > This time I compiled the wrapit.c you sent me by hand, after which
> > wrapit77 linked without a problem.
> > Something in the generated makefile overwrites wrapit.c, which in my
> > understanding should be a static source file.
> >
> > This time I executed these commands by hand, to avoid using the Makefile:
> > gcc -ansi -fPIC -O -I../../.././include -I/usr/X11R6/include
> > -I/opt/netcdf-3.6.2/gnu/include -I/opt/hdf4/include -DLinux
> > -DMAJOR=2 -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
> > -DNeedFuncProto -c -o wrapit.o wrapit.c
> > gcc -ansi -fPIC -O -o wrapit77 y.tab.o lex.yy.o Symbol.o wrapit.o
> > -L/opt/ncl_ncarg-5.0.0/lib -L/usr/X11R6/lib64
> > -L/opt/netcdf-3.6.2/gnu/lib -L/opt/hdf4/lib -lfl
> >
> > Thanks again for your help,
> > Alex
> >
>
> OK--I tried building again with the Makefile and it works. I am not
> sure why exactly it didn't work prior to you sending me wrapit.c. I
> can try to reproduce the error again.
>
> Alex
>

The error can be reproduced by extracting the source tarball again,
configuring, and running make. Here is the relevant output from make:

/ncl_ncarg-5.0.0/ni/src/mkwrap> make
yacc -d wrapit.y
gcc -ansi -fPIC -O -I../../.././include -I/usr/X11R6/include
-I/opt/hdf4/include -I/opt/netcdf-3.6.2/gnu/include -DLinux
-DMAJOR=2 -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
-DNeedFuncProto -c -o y.tab.o y.tab.c
flex wrapit.l
gcc -ansi -fPIC -O -I../../.././include -I/usr/X11R6/include
-I/opt/hdf4/include -I/opt/netcdf-3.6.2/gnu/include -DLinux
-DMAJOR=2 -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
-DNeedFuncProto -c -o lex.yy.o lex.yy.c
gcc -ansi -fPIC -O -I../../.././include -I/usr/X11R6/include
-I/opt/hdf4/include -I/opt/netcdf-3.6.2/gnu/include -DLinux
-DMAJOR=2 -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
-DNeedFuncProto -c -o Symbol.o Symbol.c
yacc wrapit.y
mv -f y.tab.c wrapit.c
gcc -ansi -fPIC -O -I../../.././include -I/usr/X11R6/include
-I/opt/hdf4/include -I/opt/netcdf-3.6.2/gnu/include -DLinux
-DMAJOR=2 -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped
-DNeedFuncProto -c -o wrapit.o wrapit.c
gcc -ansi -fPIC -O -o wrapit77 y.tab.o lex.yy.o Symbol.o wrapit.o
-L/home/apetkov/ncl/lib -L/usr/X11R6/lib64 -L/opt/netcdf-3.6.2/gnu/lib
-L/opt/hdf4/lib -lfl

Here wrapit.c gets overwritten. This is because it has the same name
as wrapit.y, and a timestamp older than wrapit.y:

ncl_ncarg-5.0.0/ni/src/mkwrap> ls -alh
total 92K
drwxr-xr-x 2 apetkov users 304 2007-10-30 14:40 .
drwxr-xr-x 9 apetkov users 304 2008-01-04 15:19 ..
-rw-r--r-- 1 apetkov users 258 2007-10-05 08:08 Copyright
-rw-r--r-- 1 apetkov users 896 1998-03-27 16:37 fstrings.h
-rw-r--r-- 1 apetkov users 1.1K 1999-06-17 14:06 Keywords.h
-rw-r--r-- 1 apetkov users 3.5K 1998-03-27 16:37 Symbol.c
-rw-r--r-- 1 apetkov users 10K 1999-02-18 10:26 wrapit.c
-rw-r--r-- 1 apetkov users 3.9K 1998-04-20 16:53 wrapit.l
-rw-r--r-- 1 apetkov users 48K 1999-06-18 11:24 wrapit.y
-rw-r--r-- 1 apetkov users 6.0K 1998-03-27 16:37 WSymbol.h
-rw-r--r-- 1 apetkov users 1.5K 2005-10-11 02:20 yMakefile

An implicit rule of the make command (I used version 3.80) overwrites
the .c file due to name collusion and the fact that wrapit.c is older
than wrapit.y. This is the relevant output from running 'make -p':

# Not a target:
wrapit.c: wrapit.y
# Implicit rule search has been done.
# Implicit/static pattern stem: `wrapit'
# Last modified 2008-01-04 15:31:51.450224256
# File has been updated.
# Successfully updated.
# automatic
# @ := wrapit.c
# automatic
# % :=
# automatic
# * := wrapit
# automatic
# + := wrapit.y
# automatic
# | :=
# automatic
# < := wrapit.y
# automatic
# ^ := wrapit.y
# automatic
# ? := wrapit.y
# variable set hash-table stats:
# Load=8/32=25%, Rehash=0, Collisions=2/17=12%
# commands to execute (built-in):
        $(YACC.y) $<
        mv -f y.tab.c $@

So, the solution is to execute "touch wrapit.c " prior to running
make, so the timestamp of this file gets updated.

Thanks for helping me with this,
 Alex
Received on Fri Jan 04 2008 - 15:56:31 MST

This archive was generated by hypermail 2.2.0 : Tue Jan 08 2008 - 10:54:56 MST