majintao0131 / yaml-cpp

Automatically exported from code.google.com/p/yaml-cpp
MIT License
0 stars 0 forks source link

yaml-cpp library 0.2.1 cannot compile with older gcc #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
yaml-cpp 0.2.1+ library cannot be compiled with gcc 3.2.3 because of
changes in node.h, nodeimpl.h and new nodereadimpl.h.

The compiler output (with all warnings enabled which is my default
settings) follows:

g++32 -pthread -fident -Wall -c parser.cpp -o ../os/Linux/obj/parser.o
-I../include
In file included from parser.cpp:1:
../include/crt.h:1:9: warning: #pragma once is obsolete

[THE WHOLE BUNCH OF obsolete #pragma once WARNINGS HERE]

../include/nodeimpl.h:1:9: warning: #pragma once is obsolete
In file included from ../include/nodeimpl.h:7,
                 from ../include/node.h:135,
                 from ../include/parser.h:11,
                 from parser.cpp:2:
../include/nodeutil.h:1:9: warning: #pragma once is obsolete
In file included from ../include/node.h:135,
                 from ../include/parser.h:11,
                 from parser.cpp:2:
../include/nodeimpl.h: In function `bool YAML::operator==(const T&, const
   YAML::Node&)':
../include/nodeimpl.h:82: syntax error before `>' token
../include/nodeimpl.h:83: warning: no return statement in function returning
   non-void
../include/nodeimpl.h: In function `bool YAML::operator==(const YAML::Node&,
   const T&)':
../include/nodeimpl.h:87: syntax error before `>' token
../include/nodeimpl.h:88: warning: no return statement in function returning
   non-void
../include/nodeimpl.h: In function `bool YAML::operator!=(const T&, const
   YAML::Node&)':
../include/nodeimpl.h:92: syntax error before `>' token
../include/nodeimpl.h:93: warning: no return statement in function returning
   non-void
../include/nodeimpl.h: In function `bool YAML::operator!=(const YAML::Node&,
   const T&)':
../include/nodeimpl.h:97: syntax error before `>' token
../include/nodeimpl.h:98: warning: no return statement in function returning
   non-void
In file included from ../include/node.h:136,
                 from ../include/parser.h:11,
                 from parser.cpp:2:
../include/nodereadimpl.h:1:9: warning: #pragma once is obsolete
In file included from ../include/node.h:136,
                 from ../include/parser.h:11,
                 from parser.cpp:2:
../include/nodereadimpl.h: In member function `bool YAML::Node::Read(T&)
   const':
../include/nodereadimpl.h:53: syntax error before `,' token
../include/nodereadimpl.h:53: syntax error before `)' token
../include/nodereadimpl.h:54: warning: no return statement in function
   returning non-void
In file included from parser.cpp:3:
scanner.h:1:9: warning: #pragma once is obsolete
In file included from scanner.h:13,
                 from parser.cpp:3:
stream.h:1:9: warning: #pragma once is obsolete
In file included from scanner.h:14,
                 from parser.cpp:3:
token.h:1:9: warning: #pragma once is obsolete
../include/nodereadimpl.h: In member function `bool YAML::Node::Read(T&) const
   [with T = std::basic_string<char, std::char_traits<char>,
   std::allocator<char> >]':
../include/nodeimpl.h:46:   instantiated from `const YAML::Node*
YAML::Node::FindValueForKey(const T&) const [with T =
std::basic_string<char, std::char_traits<char>, std::allocator<char> >]'
../include/nodeimpl.h:34:   instantiated from `const YAML::Node*
YAML::Node::FindValue(const T&) const [with T = std::string]'
../include/nodeimpl.h:73:   instantiated from here
../include/nodereadimpl.h:51: warning: no return statement in function
   returning non-void

The previous error comes from the yaml-cpp 0.2.1 built on RedHat Linux
3.4.6-9 by the following gcc (through a custom makefile):

$ g++32 -v
Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--enable-languages=c,c++ --disable-libgcj --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47.3)

Original issue reported on code.google.com by pole...@gmail.com on 9 Sep 2009 at 7:46

GoogleCodeExporter commented 9 years ago
Hmm.. this may be hard to debug. I can't seem to get gcc 3.2.3 installed on my 
mac
(at the moment - I'll try again later; I'll also try on Linux later). In the
meantime, the main error seems to be

../include/nodereadimpl.h: In member function `bool YAML::Node::Read(T&)
   const':
../include/nodereadimpl.h:53: syntax error before `,' token
../include/nodereadimpl.h:53: syntax error before `)' token

Can you narrow down which ',' it doesn't like? (Maybe move each to a separate 
line so
it tells you which line it is?) And also which ')' it doesn't like?

And worst case scenario I'll revert these changes. I had intended these as a 
slightly
experimental branch, but I was lazy and didn't actually branch after 0.2.0; but 
then
there was a reasonably major bug that I found in 0.2.0 (with complex keys 
(e.g., ?
key : value)) and I felt like it was urgent to patch it. But it's certainly 
possible
to revert just these Node::Read changes and keep the bug fix.

Original comment by jbe...@gmail.com on 9 Sep 2009 at 4:48

GoogleCodeExporter commented 9 years ago
I've tried installing gcc 3.2.3 on Ubuntu, but I've been unable. It doesn't 
exist in
the package manager (the earliest version is 3.4), so I tried compiling from 
source.
It appears that gcc 3.2.3. doesn't compile with gcc 4.* (I googled around, and 
other
people seemed to be having similar troubles).

So I installed gcc 3.4. and tried to compile gcc 3.2.3 using that, but I also 
ran
into compiling trouble.

I also asked my sysadmin at work to install gcc 3.2.3, but he declined.

So I don't have access to this compiler, and so I can't test any code on it. 
I'd be
happy to accept a patch that fixes the compile error; I'd like to keep the 
latest
code in the nodereadimpl.h file (which is correct C++, so it appears to be a 
bug that
gcc fixed), but I'd very much appreciate a workaround for the older compiler.

However, unless you have another suggestion for how to access gcc 3.2.3, I'm 
not sure
what I can do about this. 

Original comment by jbe...@gmail.com on 15 Sep 2009 at 2:52

GoogleCodeExporter commented 9 years ago
Just a suggestion, but if you have a spare machine you can download an old ISO 
of Red
Hat from ftp://archive.download.redhat.com/pub/redhat/linux/ that has the older
compiler on it and test that way. Should be around version RH 7 or so IIRC...

Original comment by homechic...@gmail.com on 15 Sep 2009 at 4:44

GoogleCodeExporter commented 9 years ago
Good idea! I installed a VM and installed Red Had 9 on it, which appears to 
have gcc 
3.2.2, and I'm getting the same errors described above. Now to work...

Original comment by jbe...@gmail.com on 16 Sep 2009 at 1:44

GoogleCodeExporter commented 9 years ago
The recent changes (r264) should allow an easy fallback for early versions of 
gcc. I
tried to fix the problem while maintaining the purpose of the trick, but I 
couldn't
manage it. These early versions of gcc seem to not like complicated template
arguments (even if they *could* be computed at compile time).

Anyways, please check out this revision to confirm that the library compiles
correctly for you. This patch will eventually go in version 0.2.3 when it's 
ready,
but there are more things I'd like to add before then.

Also, the testing framework will *not* compile with an old version of gcc 
(since it
uses the trick that we need to bypass).

Original comment by jbe...@gmail.com on 16 Sep 2009 at 4:08

GoogleCodeExporter commented 9 years ago
Just a note for you - the reason why I needed GCC 3.2.3 was Oracle 10g. Its C++
access library OCCI was not able to compile with higher versions of GCC.

Recently we have moved to Oracle 11g and had to switch to GCC 3.4.6, so my 
problems
regarding this issue are already gone.

But anyways - thank you for the effort. It will hopefully be useful for someone 
else
who must still work with Oracle 10g.

Original comment by pole...@gmail.com on 1 Oct 2009 at 10:40