[Nauty-list] Building 24r2 on MinGW
William Rummler
w.a.rummler at gmail.com
Mon Mar 12 06:35:01 EST 2012
On Sun, Mar 11, 2012 at 8:11 AM, Brendan McKay <bdm at cs.anu.edu.au> wrote:
> * William Rummler <w.a.rummler at gmail.com> [120311 11:31]:
>> I recently built nauty on MinGW on Windows 7 64-bit using
>> configure/make, and seemed to need to make three changes for success.
>> I just wanted to report them here for the record and for possible
>> improvement of the build process:
>
> Thanks William, it is very useful.
>
>> 1. I changed HAS_STDIO_UNLOCK from 1 to 0 at nauty.h:24 when I
>> encountered many undefined reference messages about lock-related
>> functions during linking with gtools.o.
>
> The configure script checks if getc_unlocked() and flockfile()
> exist. If I've done it correctly, HAS_STDIO_UNLOCK should only
> be set to 1 if they do. Can you please tell send me the output
> of configure, and some examples of the error messages you get?
> It feels like a MinGW bug, but I don't have it to test. If
> necessary, a MinGW exception can be made in configure.
For completeness, here are the complete outputs of configure followed
by make. It looks like getc_unlocked and flockfile are being detected
as not present. The corresponding code for setting
stdio_unlock/HAS_STDIO_UNLOCK in configure.ac seems to be logically
correct. I gave a manifestly false condition to the if command at
configure.ac:224 (changing it to "if test 1 -eq 0; then") and
HAS_STDIO_UNLOCK *still* came out as 1 in nauty.h, so perhaps
something is wrong with MinGW's autoconf/AC_SUBST. I wasn't able to
get echo output from either branch of the if at configure.ac:224, so I
couldn't easily tell which branch was ever taken.
$ ./configure
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking if gcc supports -O4 flags... yes
checking if gcc supports -march=i686 flags... yes
CFLAGS= -O4 -march=i686
MORECFLAGS=
checking for sys/wait.h that is POSIX.1 compatible... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for unistd.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/wait.h... (cached) no
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking for pid_t... yes
checking if malloc is declared in stdlib.h or malloc.h... 1
checking if ftell is declared in stdio.h... 1
checking if fdopen is declared in stdio.h... 1
checking if popen is declared in stdio.h... 1
checking if putenv is declared in stdlib.h... 1
checking if setenv is declared in stdlib.h... 0
checking if INFINITY is declared in math.h... 1
checking for int... yes
checking size of int... 4
checking for long... yes
checking size of long... 4
checking for long long... yes
checking size of long long... 8
checking for an ANSI C-conforming const... yes
checking for isatty... yes
checking for times... no
checking for time... yes
checking for gettimeofday... yes
checking for times... (cached) no
checking for getrusage... no
checking for perror... yes
checking for pipe... no
checking for wait... no
checking for popen... yes
checking for putenv... yes
checking for setenv... no
checking for getc_unlocked... no
checking for flockfile... no
checking for gsort... no
checking for sort... sort
checking if sort supports the -k switch... 1
configure: creating ./config.status
config.status: creating makefile
config.status: creating nauty.h
config.status: creating naututil.h
config.status: creating gtools.h
$ make
gcc -c -O4 -march=i686 naututil.c
gcc -c -O4 -march=i686 nauty.c
gcc -c -O4 -march=i686 nautil.c
gcc -c -O4 -march=i686 nautinv.c
gcc -c -O4 -march=i686 naugraph.c
gcc -c -O4 -march=i686 rng.c
gcc -o dreadnaut -O4 -march=i686 dreadnaut.c \
naututil.o nauty.o nautil.o nautinv.o naugraph.o rng.o
gcc -c -O4 -march=i686 gtools.c
gcc -o copyg -O4 -march=i686 copyg.c gtools.o
gtools.o:gtools.c:(.text+0xfc): undefined reference to `flockfile'
gtools.o:gtools.c:(.text+0x104): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x169): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x203): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x258): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x2d6): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x316): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x353): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x366): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x392): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3a3): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3b4): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3c5): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3d6): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3e7): more undefined references to `getc_unlocked' fo
llow
gtools.o:gtools.c:(.text+0x465): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x4a0): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x4e8): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x4f9): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x50a): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x51b): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x52c): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x53d): more undefined references to `getc_unlocked' fo
llow
gtools.o:gtools.c:(.text+0x2f0f): undefined reference to `flockfile'
gtools.o:gtools.c:(.text+0x2f17): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x2fc9): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x3034): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3054): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x30e7): undefined reference to `flockfile'
gtools.o:gtools.c:(.text+0x30ff): undefined reference to `getc_unlocked'
gtools.o:gtools.c:(.text+0x3158): undefined reference to `funlockfile'
gtools.o:gtools.c:(.text+0x3176): undefined reference to `funlockfile'
collect2: ld returned 1 exit status
make: *** [copyg] Error 1
>
>> 2. I removed the shortg dependency from the gtools target in makefile.
>> I realize that it can't be built without pipes, but the rest of the
>> dependencies can, and being unable to build shortg shouldn't need to
>> halt the whole build process. Maybe configure could determine (or
>> already determines, I think actually) whether pipes/wait are available
>> and could omit the shortg dependency if not.
>
> Yes, good idea. I'll do that.
It might not be worth the effort at this point, but it could be nice
to have a self-contained version of shortg that doesn't pipe to sort,
maybe as a script using a slightly modified shortg, since shell pipes
seem to work in MinGW. I don't know how that would affect other
subtleties of shortg, though. Perhaps this is harder than I think.
Thanks again,
William
>
>> 3. I commented out CPUDEFS at planarity.h:44 because CPUDEFS does not
>> seem to be getting defined by the preprocessor back in naututil.h,
>> leading to a cascade of syntax errors during compilation of planarg.
>
> That's a bug, it should be
> #ifdef CPUDEFS
> CPUDEFS
> #endif
>
> Cheers, Brendan.
>
>
>> Thanks,
>> William
>>
>> _______________________________________________
>> Nauty-list mailing list
>> Nauty-list at cs.anu.edu.au
>> http://dcsmail.anu.edu.au/cgi-bin/mailman/listinfo/nauty-list
More information about the Nauty
mailing list