Home My Page Projects gf2x
Summary Activity Tracker Lists Tasks News SCM Files

[#16531] Configure script fails finding the number of bits in an unsigned long.

Date:
2013-10-13 09:25
Priority:
3
State:
Closed
Submitted by:
David Kirkby (drkirkby)
Assigned to:
Emmanuel Thomé (thome)
Hardware:
Sun
Product:
none
Operating System:
Solaris
Component:
none
Version:
none
Severity:
none
Resolution:
Works For Me
URL:
Summary:
Configure script fails finding the number of bits in an unsigned long.

Detailed description
The error message below should be pretty self-explanatory. The hardware is a Sun Ultra 27 workstation with a quad core Xeon processor. The operating system is OpenSolaris, which is a 64-bit OS, though I probably need a 32-bit build since its part of Sage (http://www.sagemath.org/) which will to my knowledge not build properly 64-bit on this machine.

I've attached config.log.

drkirkby@hawk:~/gf2x-1.1$ cat /etc/release
OpenSolaris Development snv_134 X86
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 01 March 2010

which I know is a bit old, but I can't be bothered to update to the latest release of Solaris.

drkirkby@hawk:~/gf2x-1.1$ ./configure
checking build system type... i386-pc-solaris2.11
checking host system type... i386-pc-solaris2.11
checking target system type... i386-pc-solaris2.11
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... gawk
checking whether make -j12 sets $(MAKE)... yes
checking how to print strings... print -r
checking for style of include used by make -j12... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/ggrep
checking for egrep... /usr/bin/ggrep -E
checking for fgrep... /usr/bin/ggrep -F
checking for ld used by gcc... /usr/ccs/bin/ld
checking if the linker (/usr/ccs/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -p
checking the name lister (/usr/bin/nm -p) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786240
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-pc-solaris2.11 file names to i386-pc-solaris2.11 format... func_convert_file_noop
checking how to convert i386-pc-solaris2.11 file names to toolchain format... func_convert_file_noop
checking for /usr/ccs/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... print -r --
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -p output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -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 for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... solaris2.11 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/ccs/bin/ld
checking if the linker (/usr/ccs/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... solaris2.11 ld.so
checking how to hardcode library paths into programs... immediate
checking warning verbosity option... -Wall -W for C++ -Wall -W for C
checking for gcc option to accept ISO C99... -std=gnu99
checking build system compiler gcc -std=gnu99... yes
checking for build system executable suffix...
checking whether gcc -std=gnu99 and cc understand -c and -o together... yes
checking size of unsigned long... 4
checking whether gcc -std=gnu99 can compile and run sse-2 code... yes
checking whether gcc -std=gnu99 can compile pclmulqdq and if it is supported by the hardware... no
configure: using ABI="default"
configure: CC="gcc -std=gnu99"
configure: CFLAGS="-g -O4 -Wall -W"
configure: CPPFLAGS=""
configure: hwdir="x86_sse2"
checking the number of bits in an unsigned long... configure: error: test program failed
drkirkby@hawk:~/gf2x-1.1$
Message  ↓
Date: 2017-06-20 14:02
Sender: Paul Zimmermann

for the record, the fix is git revision b39d7c2

Date: 2017-06-20 13:58
Sender: Paul Zimmermann

it seems too complex for David Kirkby to check the bug is solved, therefore we assume it is solved.

Date: 2017-06-13 11:20
Sender: Paul Zimmermann

David, please could you confirm the bug is solved?

Date: 2013-10-22 17:56
Sender: Emmanuel Thomé

[grrr. The gforge tracker component sucks. Not even capable to regexp-match "bug\s(\d+)" as bugzilla does.]

Date: 2013-10-22 17:55
Sender: Emmanuel Thomé

Jean-Pierre,

Your two enhancement suggestions are covered by the entries bug 16565 and bug 16566. Please report any feedback pertaining to these in the corresponding entries.

Thanks,

E.

Date: 2013-10-22 17:03
Sender: Emmanuel Thomé

Revision 161 has a fix attempt.

Date: 2013-10-22 16:59
Sender: Emmanuel Thomé

Hi,

Thanks Jean-Pierre for your feedback.

This turns out to be a documented pitfall in the autoconf manual about the solaris tr.

I confess that I have no access to a solaris machine, and I have not had one for years and years. (yet I do remember the pain it was dealing with the idiosyncrasies of solaris' blend of unix, both relative to behaviour of "standard" tools, and locations for just about anything in the filesystem hierarchy). That some fragment of shell I write shows a mark of bash-ism is no surprise to me.

I wonder if I'm doing any more good than arm when passing the output of that config test through tr, in fact. After all, there seems to be no possibility for stdout to contain anything else than just digits (or the whole build system is a can of worms, which we've probably detected sooner at this point). So I'll just remove the piping through tr.

[I'll look into your other suggestions -- both make sense to me. thanks.]

E.

Date: 2013-10-22 16:32
Sender: Jean-Pierre Flori

hum the [0-9] syntax does not seem POSIX compliant...
A better solution could be to explicitly set LC_COLLATE=POSIX or C and call /usr/xpg4/bin/tr which supports POSIX range syntax on Solaris.

David surely has an opinion on which is the best option as far as Solaris is concerned.
I'm not really a Solaris power user...

Date: 2013-10-22 15:54
Sender: Jean-Pierre Flori

Ok, the problem is simply the line
"cat contest.out | tr -d -c 0-9"
Note that
"cat conftest.out | tr -d -c [0-9]"
works fine.

A few other comments, slightly unrelated:
* it may be nice to automagically add -m64 to CFLAGS on [Open]Solaris when ABI=64 is explicitely set (I seem to remember GMP does it). Anyway, setting CC="gcc -m64" seems to work (or adding -m64 to CFLAGS").
* it would be nice to have a magic option to disable optimization (at the moment one has to use different flags depending on the hardware; for example --disable-sse2 on x86, and --disable-pclmul on x86_64. In particular the code does not compile on x86_64 with --disable-sse2, which I can understand as all known x86_64 CPUs support SSE2, but it would be nice to have a single simple way to tell gf2x "just drop all that is potentially supported", without having to check the type of CPU first).

Date: 2013-10-22 13:38
Sender: Jean-Pierre Flori

FYI, I get a similar error when trying to build a 64 bit (passing ABI=64 or -m64 to gcc) version of gf2x on Solaris (sparc).
Note that on Solaris, GCC produces 32 bit binaries by default, and that's why I did not encounter that problem before.

I'm in a rush right now but will post further details later.

Date: 2013-10-14 14:22
Sender: David Kirkby

Hi Emmanuel,
first it was not me that raised the possibility of it being an SSE-2 related issue. Someone else did, and I just pointed out the CPU I have (Intel Xeon, W3580, quad core, 8 threads, 3.33 GHz), does support SSE2.

On Solaris, binaries are built 32-bit by default, although if the -m64 option is passed to gcc, a 64-bit version will be created.

I run the test program, invoking gcc with no command line arguments, which results in the file conftest.out having the number "32" in it.

I also compiled the program with the -m64 option, to build a 64-bit version of the program. In that case the file has the number "64" in it.

If you would like an account on this workstation, so you can try different things, you are welcome to have one.

Dave

Date: 2013-10-14 12:57
Sender: Emmanuel Thomé

Hi.

I'm answering here to the different concerns you raised.

In your post to sage-devel, you mentioned the SSE-2 capabilities. This does not seem to be anyhow related to the failure you encounter here.

Checking #bits after having checked sizeof(long) does make sense, unfortunately. There is no golden rule that 1 size unit means 8 bits (even though a byte _is_ defined to have size 1).

Could you please post the results of an execution attempt of the following source code (which is the failing check in the configure script) ?:
#include <stdio.h>
int main() {
unsigned long x = 1UL;
unsigned long y;
FILE * f = fopen("conftest.out","w");
int i = 1;
for( ; ; i++) {
y = x << 1;
if (y < x) {
break;
}
x = y;
}
fprintf(f,"%d\n",i);
fclose(f);
return 0;
}

Thanks,

E.

Attachments:
Size Name Date By Download
38 KiBconfig.log2013-10-13 09:25drkirkbyconfig.log
Field Old Value Date By
status_idOpen2017-06-20 13:58zimmerma
close_dateNone2017-06-20 13:58zimmerma
ResolutionAwaiting Response2017-06-20 13:58zimmerma
ResolutionNone2013-10-22 17:03thome
assigned_tonone2013-10-14 12:57thome
File Added3123: config.log2013-10-13 09:25drkirkby