Re: [AMBER-Developers] problem compiling mtkpp on MacOSX

From: Scott Brozell <sbrozell.rci.rutgers.edu>
Date: Sat, 22 Jan 2011 03:18:12 -0500

Hi,

On Sat, Jan 15, 2011 at 05:36:34PM -0500, case wrote:
> I have MacOSX 10.5.8, using gcc/g++ 4.4.0. Installtion of mtkpp fails, with
> one of those 500-line error messages c++ can generate. I've attached the
> mtkpp configure log and the error log.
>
> The problem is in Log/error.cpp, where error.h includes <string>. My compiler
> doesn't have trouble with gleap or cpptraj, which also have include. I guess
> at some point I should learn how to track down these problems, but right now I
> have to punt. The error appears to arise at line 80 of error.h, but (even if
> that is true) I don't know what to do next.

Here's one recipe for reading a g++ compiler error message
(which can be summarized as: read it mostly like you would read a
gcc compiler error message):
fast forward past the make and other (here libtool) messages
to get to the compiler invocation;
read from gnu's "In file" stuff to the start of gnu's "In function" stuff;
read from gnu's "In function" stuff to the start of gnu's "error:",
for a first pass just ignore all gnu's "instantiated from here" stuff;
slowly, carefully and thoroughly read the message after the first "error:";
use the "In file" and "In function" stuff to open and read the source code;
at this step you might really have to understand C++ to see the problem.

But here you probably don't have to know C++:
error: invalid use of incomplete type 'struct std::basic_ostream
As in C this is gnu's way of indicating that some type is undeclared,
undefined, or otherwise broken. Notice that there is no header include
in error.h that would seem to declare ostream.

A best practice is to include <iosfwd> to get C++'s io declarations,
but ostream is not just referenced in error.h, it is used since there
is an inline function definition. So instead include <iostream>.

This already builds for me on linux with oldish gnu 4.2, so i have not
tested or committed this.

scott

> I suspect that we may need a "-nomtkpp" flag for some machines, analogous to
> -nosleap or even -nopython.
>

> (cd mtkpp && make install )
...
> Making install in Log
> /bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I./.. -I/home/case/amber11/AmberTools/src/boost-1.38.0 -DNDEBUG -DUSE_TINYXML -DTIXML_USE_STL -DC99_OK -Wall -O2 -fno-common -MT error.lo -MD -MP -MF .deps/error.Tpo -c -o error.lo error.cpp
> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I./.. -I/home/case/amber11/AmberTools/src/boost-1.38.0 -DNDEBUG -DUSE_TINYXML -DTIXML_USE_STL -DC99_OK -Wall -O2 -fno-common -MT error.lo -MD -MP -MF .deps/error.Tpo -c error.cpp -o error.o
> In file included from /usr/local/lib/gcc/i386-apple-darwin9.5.0/4.4.0/../../../../include/c++/4.4.0/string:51,
> from error.h:36,
> from error.cpp:33:
> /usr/local/lib/gcc/i386-apple-darwin9.5.0/4.4.0/../../../../include/c++/4.4.0/bits/ostream_insert.h: In function 'std::basic_ostream<_CharT, _Traits>& std::__ostream_insert(std::basic_ostream<_CharT, _Traits>&, const _CharT*, std::streamsize) [with _CharT = char, _Traits = std::char_traits<char>]':
> /usr/local/lib/gcc/i386-apple-darwin9.5.0/4.4.0/../../../../include/c++/4.4.0/bits/basic_string.h:2512: instantiated from 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
> error.h:80: instantiated from here
> /usr/local/lib/gcc/i386-apple-darwin9.5.0/4.4.0/../../../../include/c++/4.4.0/bits/ostream_insert.h:83: error: invalid use of incomplete type 'struct std::basic_ostream<char, std::char_traits<char> >'
> /usr/local/lib/gcc/i386-apple-darwin9.5.0/4.4.0/../../../../include/c++/4.4.0/iosfwd:61: error: declaration of 'struct std::basic_ostream<char, std::char_traits<char> >'

_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Sat Jan 22 2011 - 00:30:04 PST
Custom Search