Opened 12 years ago

Last modified 20 months ago

#332 new bug

libSingular fails to build on gcc 4.6

Reported by: dreyer Owned by: burcin
Priority: major Milestone: 3-1-3 and higher
Component: singular-kernel Version: 3-1-2
Keywords: libSingular Cc:

Description

libSingular fails to build with gcc 4.6, see http://trac.sagemath.org/sage_trac/ticket/11084

Change History (11)

comment:1 Changed 12 years ago by david.kirkby@…

This bug has been seen on both OpenSolaris and Linux

comment:2 Changed 12 years ago by Oleksandr

Component: dontKnowsingular-kernel
Keywords: libSingular added
Owner: changed from somebody to hannes

Does it concern both Singular and libSingular?

comment:3 Changed 12 years ago by hannes

following the comments on sage-trac, this is not a problem of gcc-4.6 or singular-3-1-3 but libsingular, which uses singular-3-1-1. So first libsingular should be updated to 3-1-3 and checked again.

comment:4 Changed 12 years ago by Oleksandr

Owner: changed from hannes to burcin

ok, than it looks like something for Burcin to do?

comment:5 in reply to:  3 Changed 12 years ago by savid.kirkby@…

Replying to hannes:

following the comments on sage-trac, this is not a problem of gcc-4.6 or singular-3-1-3 but libsingular, which uses singular-3-1-1. So first libsingular should be updated to 3-1-3 and checked again.

I downloaded 19 MB file Singular-3-1-3.tar.gz (md5 checksum 57327b58b0210e896298ba797457bbd3) and tried to build this on OpenSolaris 06/2009 on a quad core Xeon processor with gcc 4.6.0. It failed as below.

c++ -O3 -w -fomit-frame-pointer --no-rtti -I.. -I/export/home/drkirkby/Singular-3-1-3  -fno-implicit-templates --no-exceptions -I.. -I/export/home/drkirkby/Singular-3-1-3 -I. -I.. -I/export/home/drkirkby/Singular-3-1-3 -I/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/include  -I/usr/local/include  -DNDEBUG -DOM_NDEBUG -Dix86_SunOS -DHAVE_CONFIG_H -c extra.cc
c++ -O3 -w -fomit-frame-pointer --no-rtti -I.. -I/export/home/drkirkby/Singular-3-1-3  -fno-implicit-templates --no-exceptions -I.. -I/export/home/drkirkby/Singular-3-1-3 -I. -I.. -I/export/home/drkirkby/Singular-3-1-3 -I/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/include  -I/usr/local/include  -DNDEBUG -DOM_NDEBUG -Dix86_SunOS -DHAVE_CONFIG_H -c fehelp.cc
c++ -O3 -w -fomit-frame-pointer --no-rtti -I.. -I/export/home/drkirkby/Singular-3-1-3  -fno-implicit-templates --no-exceptions -I.. -I/export/home/drkirkby/Singular-3-1-3 -I. -I.. -I/export/home/drkirkby/Singular-3-1-3 -I/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/include  -I/usr/local/include  -DNDEBUG -DOM_NDEBUG -Dix86_SunOS -DHAVE_CONFIG_H -c feOpt.cc
c++  -I. -I.. -I/export/home/drkirkby/Singular-3-1-3 -I/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/include  -I/usr/local/include  -DSTANDALONE_PARSER -o libparse libparse_main.o utils.o ../kernel/fegetopt.o -L/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/lib  -L/usr/local/lib -lomalloc
c++ -O3 -w -fomit-frame-pointer --no-rtti -I.. -I/export/home/drkirkby/Singular-3-1-3  -I. -I.. -I/export/home/drkirkby/Singular-3-1-3 -I/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/include  -I/usr/local/include  -fno-implicit-templates --no-exceptions -I.. -I/export/home/drkirkby/Singular-3-1-3 -DNDEBUG -DOM_NDEBUG -Dix86_SunOS -DHAVE_CONFIG_H \
          -o Singular \
          tesths.cc iparith.o mpsr_Tok.o claptmpl.o\
          grammar.o scanner.o attrib.o blackbox.o eigenval_ip.o extra.o fehelp.o feOpt.o ipassign.o ipconv.o ipid.o iplib.o ipprint.o ipshell.o newstruct.o lists.o sdb.o fglm.o interpolation.o silink.o ssiLink.o subexpr.o janet.o wrapper.o libparse.o sing_win.o gms.o pcv.o maps_ip.o walk.o walk_ip.o cntrlc.o misc_ip.o calcSVD.o pipeLink.o Minor.o MinorProcessor.o MinorInterface.o bigintm.o pyobject_setup.o bbcone.o bbfan.o  slInit_Static.o mpsr_Put.o mpsr_PutPoly.o mpsr_GetPoly.o mpsr_sl.o mpsr_Get.o mpsr_GetMisc.o mpsr_Error.o ndbm.o sing_dbm.o  -L/export/home/drkirkby/Singular-3-1-3/kernel -L../kernel -lkernel -L/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/lib  -L/usr/local/lib  -lMPT -lMP -lnsl -lsocket  -lm -lsingfac -lsingcf -lntl -lgmp -lreadline -lcurses -lm  -lnsl -lsocket  -lomalloc_ndebug  ../kernel/mmalloc.o 
Undefined                       first referenced
 symbol                             in file
std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*) claptmpl.o
std::__detail::_List_node_base::_M_unhook() claptmpl.o
std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&) claptmpl.o
std::__detail::_List_node_base::_M_reverse()  claptmpl.o
std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*) claptmpl.o
ld: fatal: symbol referencing errors. No output written to Singular
collect2: ld returned 1 exit status
make[2]: *** [Singular] Error 1
make[2]: Leaving directory `/export/home/drkirkby/Singular-3-1-3/Singular'
make[1]: *** [install] Error 1
make[1]: Leaving directory `/export/home/drkirkby/Singular-3-1-3'
make: *** [/export/home/drkirkby/Singular-3-1-3/ix86-SunOS/Singular-3-1-3] Error 2

comment:6 Changed 12 years ago by dreyer

Meanwhile, I tried the most recent version from svn trunk and got likewise errors on make install, so it's neither a libSingular issue nor a problem of the version being outdated.

comment:7 Changed 12 years ago by david.kirkby@…

I tried to post another comment, but it was rejected by your trac server as spam. On the off chance this gets though, I have posted the comment at the URL mentioned at the top of this post - I unable to even post a link to the Sage trac server.

Dave

comment:8 Changed 12 years ago by dreyer

This what Dave Kirkby's posted on Sage-Trac (but It still guess there is a demangling issue for C++ function names tied to optimization.)

With gcc 4.5.0 the same version builds ok on the same computer, so it does appear to be an issue with gcc 4.6.0.

I would suggest it would be worth trying to build this with Sun Studio (which is a free download)

http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html

on a Linux system. The Sun (Oracle) compiler is much stricter than the GNU compilers, so will show up problems that current versions of GCC may not. It goes without saying this will not build with Sun Studio. (I tried this on a Solaris system, but you should get the same on a Linux machine).

Dave

comment:9 Changed 12 years ago by dreyer

It turned out, that lowering the optimization level to -O2 was was enough (the Sage package currently overrules Singular's optimazation settings) to make the package compatible with gcc 4.6. The original settings of Singular were fine anyway, so was not a bug of Singular.

comment:10 in reply to:  9 ; Changed 12 years ago by David Kirkby

Replying to dreyer:

It turned out, that lowering the optimization level to -O2 was was enough (the Sage package currently overrules Singular's optimazation settings) to make the package compatible with gcc 4.6. The original settings of Singular were fine anyway, so was not a bug of Singular.

Whilst it's true that Sage overwrote Singular's defaults, this could well indicate there is a bug in Singular. See this thread I started on the gcc list some time ago.

(add the obvious start bit, otherwise the spam filter stops me posting) gcc.gnu.org/ml/gcc-help/2010-07/msg00190.html

One of the gcc developers, Ian Lance Taylor, wrote:


The -O3 option should be safe for correct code. An important difference between -O2/-O3 and -O1 is that -O2 and -O3 enable strict aliasing and strict overflow. Those options provide better optimization for correct code, but are far more likely to cause unexpected code generation for incorrect code. See the -fstrict-aliasing and -fstrict-overflow options.

The main difference between -O3 and -O2 is that -O3 enables more speculative optimizations. These should not miscompile your code, but they may cause your program to run more slowly.

Ian


That said, it could well be a bug in gcc. But the fact on one platform (OpenSUSE on the Itanium processor) Sage has to reduce the optimisation to -O0, makes me suspect there is some code in Singular which may not be correct. Pinpointing that would be a lot easier if Singular could build with the Sun compiler.

It's also annoying that libtool throws to /dev/null any warning messages. That's the default behavior, but I know it can be overridden, but I forget how. If the warnings could be shown, it might help isolate any code that gcc thinks is suspect.

One should also note that Sage has a huge number of patches to Singular - I've no idea what all them are supposed to do, but it's quite possible one of them is the source of our problems when compiling with -O3.

David Kirkby

comment:11 in reply to:  10 Changed 12 years ago by dreyer

That said, it could well be a bug in gcc. But the fact on one platform (OpenSUSE on the Itanium processor) Sage has to reduce the optimisation to -O0, makes me suspect there is some code in Singular which may not be correct. Pinpointing that would be a lot easier if Singular could build with the Sun compiler.

Right, but for now this is the best patch we have.

One should also note that Sage has a huge number of patches to Singular - I've no idea what all them are supposed to do, but it's quite possible one of them is the source of our problems when compiling with -O3.

Yeah, most of them are mine. These were immediately fixed in upstream Singular now, as the corresponding Trac tickets clearly state. (In fact, those patches are backports of the issues fixed upstream before!)

There are also some patches regarding cygwin, which never were reported upstream by the Sage-Windows people. I guess this is intended because they would not apply upstream, because of the different cygwin setups.

Note: See TracTickets for help on using tickets.