rename() vs. link(); building from source - Mailing list pgsql-cygwin

From David P. Caldwell
Subject rename() vs. link(); building from source
Date
Msg-id JIEPJODHFFPGJDGMCPBECEMCDIAA.inonit@inonit.com
Whole thread Raw
List pgsql-cygwin
Hello, everyone.

I've been using PostgreSQL successfully on Cygwin for some time.  I've
recently gotten into some applications which require me to load a large
amount of data, so I ran into the error that's been discussed around here
with the inability to recycle the transaction log files:

http://archives.postgresql.org/pgsql-cygwin/2002-04/msg00031.php

The effects of this issue have been quite frustrating to me ... I have to
start my data load and stop back every once in a while to restart it (rather
than leaving it run overnight).  I eventually got annoyed enough to decide
to fix it.

* * *

I saw that the fix had been proposed on the list (I found a Geocrawler page
via Google), and it seemed reasonable to me.  I decided to see if I could
upgrade and get the fix.  Checking the CVS source, I saw that our patch
hasn't made it in yet (although almost precisely the same patch just got
done for NetWare), so I decided "I'll build PostgreSQL from source, and
patch it myself!"

* * *

Got the source from CVS.  I attempted to build it with the default options
(not the options used for the Cygwin package distribution).

Bear in mind that I am inexpert at UNIX, poor at C, and absolutely
incompetent at make.  Thus, I'm really bad at debugging build problems.
(And if you decide to help me, you'll have to be patient with me when
explaining what's going on.)

So, for the benefit of all, here's what I got:

configure went fine, all automated; no changes.

When I attempted make, I got an error having to do with bison (which luckily
had a very easy error message, since I know absolutely nothing about lex and
yacc except what they're used for):

make[3]: Entering directory
`/cygdrive/c/projects/local/external/pgsql/src/backend/parser'
bison -y -d  gram.y
bison: /usr/share/bison.simple: No such file or directory
make[3]: *** [parse.h] Error 2

Well, a little checking revealed that there is a
/usr/share/bison/bison.simple in Cygwin.  Without having any idea what I was
doing, this worked:

ln /usr/share/bison/bison.simple /usr/share/bison.simple

Re-running make got me lots farther (through the whole src/access tree), but
I got stopped here:

make[3]: Entering directory
`/cygdrive/c/projects/local/external/pgsql/src/backend/bootstrap'
bison -y -d  bootparse.y
sed -e 's/^yy/Int_yy/g' -e 's/\([^a-zA-Z0-9_]\)yy/\1Int_yy/g' < y.tab.c >
./bootparse.c
sed -e 's/^yy/Int_yy/g' -e 's/\([^a-zA-Z0-9_]\)yy/\1Int_yy/g' < y.tab.h >
./bootstrap_tokens.h
rm -f y.tab.c y.tab.h
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I. -I../../../src
/include -I/usr/local/include -DBUILDING_DLL=1  -c -o bo
otparse.o bootparse.c
bootparse.y:266: invalid format `#line' directive
bootparse.y:582: invalid format `#line' directive
bootparse.y:1089: warning: `/*' within comment
bootparse.y:339: unterminated character constant
bootparse.y:372: invalid format `#line' directive
make[3]: *** [bootparse.o] Error 1

I don't really have the skills to fix this error ... I looked in bootparse.c
and saw how gcc is getting to bootparse.y in the first place:

#line 80 "bootparse.y"

I don't know what this C preprocessor directive means, so I don't know
exactly how to continue.

$ gcc --version
2.95.3-5

Without including lots of cygcheck debris, I'll just say that my Cygwin
distribution is quite recent unless someone needs more detail than that.

* * *

I did find the /usr/doc/Cygwin/postgresql-7.2.README ... I was intrigued by
the section "Source."  I figured that some combination of build.sh, etc.,
would do it for me ... the file says PostgreSQL builds out of the box with a
perl-related caveat and I wasn't going to build perl, so I was hopeful.  I
was even more excited by:

See CYGWIN-PATCHES/build.sh in the source archive for my exact build
recipe for configuring, making, and packaging this distribution.

However, try as I might, I can't figure out what that refers to.  I've
looked under both the PostgreSQL source tree (thoroughly) and the Cygwin
source tree (not as thoroughly), done net searches, and can't find any
matches for "CYGWIN-PATCHES" ... so I'm stuck there for the moment.

* * *

I was also inspired by my discovery of the pgsql-cygwin mailing list
archives, because I figured building from source has got to be one of the
most common discussion topics, right?  Wow, I couldn't find anyone trying to
do it in the last few months!  My view is that this is a tribute to both
Jason for his package and the folks at Red Hat for their Cygwin install
program.

* * *

So anyway, as for me, I just want to fix my problem.  If we can get the
original patch committed, that would be great for me; if I can successfully
build from source (which may be perfectly well laid-out in that
CYGWIN-PATCHES stuff, if I knew where to find it), that's great too.  I
wanted to make sure that I described everything I've done so far because I
thought some parts might be of general interest ... my apologies if they're
not.

-- David.


pgsql-cygwin by date:

Previous
From: "Leland F. Jackson, CPA"
Date:
Subject: cgywin-postgres install
Next
From: Barry Pederson
Date:
Subject: Re: rename() vs. link(); building from source