Closed dimpase closed 10 years ago
I must have run into the same thing, too, figuring it was an mpir bug, since our patch file comments out that line (see https://github.com/Macaulay2/M2/blob/f60bd90980a4de2cdaa079f55726253b47a22c89/M2/libraries/mpir/patch-2.6.0#L103). So you could work around it by using the configure option that tells M2 to build mpir from source.
Oh, here's what the problem is: the following C++ program will give exactly the same error:
#include <mpir.h>
#include <stdint.h>
#include <mpirxx.h>
I have committed a better fix here: 847d4fa4c568bc9aceabbe941db391d3fff9cd70
As for those compiler flags "-Wno-...", since November 13 our configure script has checked whether those flags are accepted by the compiler, so perhaps you aren't compiling from the latest Macaulay2 sources. To get around it, you could just comment out the lines concerning those warnings from configure.ac and Macaulay2/d/Makefile.in.
OK, great, 847d4fa allows the compilation to succeed. (Still few errors during testing, but that's a different issue).
regarding the compiler flags "-Wno-...", I am compiling from the current default git repo (but no downloading on the fly). Perhaps it's something in external packages that causes this, although this does not seem likely. In case, I use gcc 4.7.3, on OSX 10.6.8.
I'd try by hand with gcc and g++ to see whether they accept both of those flags. (I don't know when the flags were introduced.) Then check lines like S["HAVE_NO_PARENTHESES_EQUALITY"]="yes" in config.status to see what opinion configure had on the issue.
On Mon, Feb 3, 2014 at 5:24 AM, Dmitrii Pasechnik notifications@github.comwrote:
regarding the compiler flags "-Wno-...", I am compiling from the current default git repo (but no downloading on the fly). Perhaps it's something in external packages that causes this, although this does not seem likely. In case, I use gcc 4.7.3, on OSX 10.6.8.
— Reply to this email directly or view it on GitHubhttps://github.com/Macaulay2/M2/issues/92#issuecomment-33939142 .
"-Wno-..." flags are accepted by gcc and g++ which are supposed to be used. However there is a gcc-4.2.1 installed on the system (which should not be picked up due to PATH precedence!) which does not accept this parameters. (Also, cc refers to gcc-4.2.1). Could it be that M2 building process somehow picks up the old gcc/g++ (e.g. by rearranging PATH)? Otherwise I can't explain these warnings...
You could test that theory by adding
type g++
as a command to one of the makefiles. You could also test where g++ is finding cc1plus with something like
g++ -v -Wno-parentheses-equality foo.cc
, or you could even add -v to the compile line in the makefile.
On Tue, Feb 4, 2014 at 5:19 AM, Dmitrii Pasechnik notifications@github.comwrote:
"-Wno-..." flags are accepted by gcc and g++ which are supposed to be used. However there is a gcc-4.2.1 installed on the system (which should not be picked up due to PATH precedence!) which does not accept this parameters. (Also, cc refers to gcc-4.2.1). Could it be that M2 building process somehow picks up the old gcc/g++ (e.g. by rearranging PATH)? Otherwise I can't explain these warnings...
— Reply to this email directly or view it on GitHubhttps://github.com/Macaulay2/M2/issues/92#issuecomment-34046285 .
I was able to isolate the problem about spurious warning messages - they're just a bug in g++:
int x;
char y;
void f () { y=x; }
/*
compile with
g++ -c -Wconversion -Wno-mismatched-tags
get this:
foo.cc: In function 'void f()':
foo.cc:3:15: warning: conversion to 'char' from 'int' may alter its value [-Wconversion]
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-mismatched-tags" [enabled by default]
the warning about -Wno-mismatched-tags is false, because it is not issued when compiling with
g++ -c -Wno-mismatched-tags
info:
Ubuntu 12.04.3 LTS
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs $
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
*/
I guess you meant to write that the bogus warning does not arise if one does
gcc -c -Wno-mismatched-tags
(yes, I still see this on gcc-4.8.2)
On 6 February 2014 13:38, Daniel R. Grayson notifications@github.comwrote:
I was able to isolate the problem about spurious warning messages - they're just a bug in g++:
int x; char y; void f () { y=x; } /* compile with
g++ -c -Wconversion -Wno-mismatched-tags
get this:
foo.cc: In function 'void f()': foo.cc:3:15: warning: conversion to 'char' from 'int' may alter its value [-Wconversion] At global scope: cc1plus: warning: unrecognized command line option "-Wno-mismatched-tags" [enabled by default]
the warning about -Wno-mismatched-tags is false, because it is not issued when compiling with
g++ -c -Wconversion -Wno-mismatched-tags
info:
Ubuntu 12.04.3 LTS $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs $ Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
*/
— Reply to this email directly or view it on GitHubhttps://github.com/Macaulay2/M2/issues/92#issuecomment-34323204 .
Yes, I noticed that each time a file that has some other warning emitted, also gets this warning message. It is a bit annoying, even if it is a bug in g++.
Perhaps the configure script should only put this W option in, in the cases for which it was added (I think that was clang++).
On Feb 6, 2014, at 8:38 AM, Daniel R. Grayson notifications@github.com wrote:
I was able to isolate the problem about spurious warning messages - they're just a bug in g++:
int x; char y; void f () { y=x; } /*
compile withg++ -c -Wconversion -Wno-mismatched-tags
get this:
foo.cc: In function 'void f()': foo.cc:3:15: warning: conversion to 'char' from 'int' may alter its value [-Wconversion] At global scope: cc1plus: warning: unrecognized command line option "-Wno-mismatched-tags" [enabled by default]
the warning about -Wno-mismatched-tags is false, because it is not issued when compiling with
g++ -c -Wconversion -Wno-mismatched-tags
info:
Ubuntu 12.04.3 LTS $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs $ Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
*/
— Reply to this email directly or view it on GitHub.
I've edited the post, thanks.
I've reported the bug.
I think it's better for configure to detect behavior of compilers, rather than identity, which would be more fragile.
Oh, and if you eliminate the source of the other warning, as you should, then the annoyance will go away. So it's rather a nice feature!
It's not a bug (see below) so I have fixed it by having configure test for the positive version of the option.
--- Comment #1 from Harald van Dijk
If there are no warnings, there are no warnings to be suppressed either, so ignoring the option cannot do any harm. This allows code intended to build warning-free to unconditionally add -Wno-* options made available in e.g. GCC 4.9 even when GCC 4.8 is used as the compiler.
If there are warnings, a diagnostic for the -Wno-* option is more useful, as it could point to a typo in the command-line option intended to suppress one of the current warnings, for example:
$ cat test.c int main() { } $ gcc -Wall -Wno-retrun-type -c test.c test.c: In function ‘main’: test.c:1:1: warning: control reaches end of non-void function [-Wreturn-type] int main() { } ^ test.c: At top level: cc1: warning: unrecognized command line option "-Wno-retrun-type" [enabled by default]
On Thu, Feb 6, 2014 at 9:25 AM, Mike Stillman notifications@github.comwrote:
Yes, I noticed that each time a file that has some other warning emitted, also gets this warning message. It is a bit annoying, even if it is a bug in g++.
Perhaps the configure script should only put this W option in, in the cases for which it was added (I think that was clang++).
On Feb 6, 2014, at 8:38 AM, Daniel R. Grayson notifications@github.com wrote:
I was able to isolate the problem about spurious warning messages - they're just a bug in g++:
int x; char y; void f () { y=x; } /* compile with
g++ -c -Wconversion -Wno-mismatched-tags
get this:
foo.cc: In function 'void f()': foo.cc:3:15: warning: conversion to 'char' from 'int' may alter its value [-Wconversion] At global scope: cc1plus: warning: unrecognized command line option "-Wno-mismatched-tags" [enabled by default]
the warning about -Wno-mismatched-tags is false, because it is not issued when compiling with
g++ -c -Wconversion -Wno-mismatched-tags
info:
Ubuntu 12.04.3 LTS
$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs $ Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
*/
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/Macaulay2/M2/issues/92#issuecomment-34327067 .
This is an error message I get while trying to build M2 using Sage-supplied libraries. More specifically, at some point I get
/tmp/M2/M2/Macaulay2/c/scc1 -O version.dd test -e version-exports.h && cmp -s version-exports.h.tmp version-exports.h || cp version-exports.h.tmp version-exports.h test -e version-exports.h && cmp -s version-exports.h.tmp version-exports.h || cp version-exports.h.tmp version-exports.h g++ -O2 -Wno-mismatched-tags -Wreturn-type -Werror -I. -I./../e -I. -I./../c -I./../regex -I/tmp/M2/M2/include -I/tmp/M2/M2/include -I/tmp/M2/M2/libraries/final/include -I/usr/include/libxml2 -DNDEBUG -DNDEBUG -c -Wno-parentheses-equality -Wno-uninitialized -Wno-cast-qual -Wno-unused version-tmp.cc -o version.o In file included from /tmp/M2/M2/libraries/final/include/stdinc.h:34:0, from version.dd:30: /usr/local/src/sage/sage-6.1.rc0/local/include/gmpxx.h: In member function 'intmax_t gmp_expr<__mpz_struct [1], mpz_struct [1]>::get_sx() const': /usr/local/src/sage/sage-6.1.rc0/local/include/gmpxx.h:1710:49: error: 'mpz_get_sx' was not declared in this scope /usr/local/src/sage/sage-6.1.rc0/local/include/gmpxx.h: In member function 'uintmax_t gmp_expr<__mpz_struct [1], mpz_struct [1]>::get_ux() const': /usr/local/src/sage/sage-6.1.rc0/local/include/gmpxx.h:1711:50: error: 'mpz_get_ux' was not declared in this scope At global scope: cc1plus: error: unrecognized command line option "-Wno-parentheses-equality" [-Werror] cc1plus: error: unrecognized command line option "-Wno-mismatched-tags" [-Werror] cc1plus: all warnings being treated as errors make[2]: *\ [version.o] Error 1
To configure, I run ./configure --prefix=/usr/local/src/sage/sage-6.1.rc0/local
Should I be using some special options to get rid of the problem above?
Also, note that in this case gmpxx.h is just a copy of mpirxx.h (there is no "real" GMP being used here in any way).