[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-patch] Building on mingw
From: |
Martin Panter |
Subject: |
Re: [bug-patch] Building on mingw |
Date: |
Sat, 13 Jun 2009 04:50:20 +0000 |
On 05/06/2009, Andreas Gruenbacher <address@hidden> wrote:
> . . .
> > 1. The gnulib getopt stuff seemed to be missing getopt_int.h. I seem
> > to have fixed this by copying the file straight from gnulib.
> >
> > 2. Also in the gnulib stuff, the xstrndup function needs strndup, but
> > I don't think this is present on Windows. I just made the code use
> > strdup and truncate the string, but perhaps you can get a better
> > strndup from gnulib?
>
>
> I have added the missing files from gnulib now.
As well as sticking the files in place, I had to add some stuff to
configure.ac to get them to work (see patch-gnulib.diff). There were
even more missing files, from the "strnlen" and "string" gnulib
modules (both needed by the "strndup" module). The extra files that I
had to add were:
m4/string_h.m4
m4/strnlen.m4
lib/strnlen.c
There's also a string.h file (part of the "string" module) which I
didn't bother to add. I suspect if it were used it might fix these
compiler warnings that I got:
gcc -std=gnu99 -c -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -DENABLE_MERGE
-I. -I./src -I./gl/lib -g -O2 -o gl/lib/strndup.o gl/lib/strndup.c
gl/lib/strndup.c: In function `strndup':
gl/lib/strndup.c:29: warning: implicit declaration of function `rpl_strnlen'
gcc -std=gnu99 -c -DHAVE_CONFIG_H -Ded_PROGRAM=\"ed\" -DENABLE_MERGE
-I. -I./src -I./gl/lib -g -O2 -o gl/lib/xstrndup.o gl/lib/xstrndup.c
gl/lib/xstrndup.c: In function `xstrndup':
gl/lib/xstrndup.c:32: warning: implicit declaration of function `strndup'
gl/lib/xstrndup.c:32: warning: initialization makes pointer from
integer without a cast
I found out you can get the info on what files are needed etc for each
module by looking in gnulib's "module" directory. Eg:
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=modules/strndup
> > 3. The makefile seemed to want getopt.h to exist in the current
> > directory. If I supplied GETOPT_H=gl/lib/getopt.h it fixed the
> > problem.
>
>
> Fixed in the Makefile.in.
Your fix seems to have worked; this problem is gone now.
> > 4. You can't assign stderr into stdout! I guess it works with the gnu
> > C library but apparently not with other C libraries. I just removed
> > the assignment to get it to compile, because I'm not interested in
> > patched output going to stdout for the moment. But I guess the proper
> > fix would be to set a variable somewhere to either stdout or stderr,
> > and change all the message printouts to use it rather than blindly use
> > stdout.
>
>
> I would prefer to dup/dup2 the file descriptors as needed. Does the latest
> alpha version work for you?
I tested running with "-o -" and the dup/dup2 thing seems to work for
me. Although it does seem to be outputting in text mode with CRLF line
endings, despite me always using the "--binary" option.
I don't think I needed the gnulib dup2 stuff, and I suspect that you'd
need to add stuff to configure.ac if it were ever needed.
> > 5. The "rename" function in Mingw, which uses an MS C runtime library,
> > doesn't work if the destination file already exists, so I added
> > "remove (target)" calls before it. This is a special Win32 only
> > workaround though. Perhaps it would be appropriate to use the "rename"
> > stuff out of the gnulib?
>
>
> Also added from gnulib.
After I added stuff to configure.ac (see my diff file again), it seems
to be using the gnulib version of rename, which fixes the problem.
> . . .
> I have uploaded the latest alpha version here:
>
> ftp://alpha.gnu.org/gnu/patch/patch-2.5.9-117-g6d9e60f.tar.gz
>
> Are there any remaining problems (aside from the seek issue)?
Also in my diff file I added entries to Makefile.in; perhaps this
might help with the gnulib files that were missing from the tar file?
patch-gnulib.diff
Description: Text document