Boost compilation problem

I'm using the Boost 1.32.0 library, patched and built as instructed, with the

August Studio Express compiler. In that environment, I'm having problems

building some code that uses the multi_index package. It compiles just fine

using g++, but fails under Studio Express. I've cut it down to a small test

program that still triggers the bug. Could someone at Sun track down

the problem? The error messages are huge strings of gobbledegook,

too long to repeat here.

% cat job_status_db_access.cc

#include <string>

#include <boost/multi_index_container.hpp>

#include <boost/multi_index/ordered_index.hpp>

#include <boost/multi_index/key_extractors.hpp>

using namespace ::boost;

using namespace ::boost::multi_index;

struct Job_Node

{

std::string JobID;

std::string NodeName;

Job_Node (std::string jobid, std::string nodename) :

JobID (jobid), NodeName (nodename) { }

};

typedef multi_index_container <

Job_Node,

indexed_by <

ordered_unique <

composite_key <

Job_Node,

member<Job_Node, std::string, &Job_Node::JobID>,

member<Job_Node, std::string, &Job_Node::NodeName>

>

>

>

> Job_Node_set;

Job_Node_set Pending_Job_Node_set;

int read_full_job_nodes_table ()

{

charJobID_buffer[1];

charNodeName_buffer [1];

Job_Node *job_node = new Job_Node (JobID_buffer, NodeName_buffer);

Pending_Job_Node_set.insert (*job_node);

return (0);

}

% make

CC -O -xlang=c99 -mt -library=stlport4 \

-features=tmplife -features=tmplrefstatic \

-errtags=yes -D_POSIX_THREAD_SEMANTICS -D__EXTENSIONS__ \

-I/build/thirdparty/include \

-c -o job_status_db_access.o job_status_db_access.cc

(/build/thirdparty/include/boost/... is where I've installed the Boost stuff.)

[2002 byte] By [herteg] at [2007-11-26 10:37:19]
# 1

Sun C++ still has a bug related to template friend declaration. For example, code below cannot be compiled. The bug number is 6421933. It looks like the reason of this error.

[code]

% cat test.cc

class S

{

template <typename T>

void foo(T);

static int v;

};

int S::v = 0;

template <typename T>

void foo(T p)

{

S::v = p;

}

int main()

{

foo(1);

}

% CC -c test.cc

"test.cc", line 14: Error: S::v is not accessible from foo<int>(int).

"test.cc", line 19:Where: While instantiating "foo<int>(int)".

"test.cc", line 19:Where: Instantiated from non-template code.

1 Error(s) detected.

[/code]

Atanasyan at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2
Okay, I can see this will take a while to resolve. In the meantime, I'll have to switchto trying the GCC for SPARC systems compiler, since I need SPARC+Boost+DRDTsupport.
herteg at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3
Hello,You might check the following: http://lists.boost.org/boost-users/2006/09/22407.phpI've got the hunch it might be related to your problem.HTH,Joaqu韓 M L髉ez Mu駉zTelef髇ica, Investigaci髇 y Desarrollo
joaquinmlopez at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

Indeed, the fix described there makes the compiler error messages go away.

I haven't tried running the resultant program to see if it works at that level,

as this code is still in development. Hopefully Sun will notice this posting

and fold the fix into their Boost patch files. Sun, please let us know when

you do so, so we can know it's time to download fresh copies of the patches.

Thanks a bunch for your advice!

Now, as for patching the official Boost source code, it involves adding a

condition to a #if:

... ||\

BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x580))

I presume the "0x580" is supposed to represent the CC compiler version.

Sun doesn't claim to support the Boost library in Sun Studio 11 (compiler

version 5.8), so I'm mostly using the Studio Express compiler, which

advertises itself as version 5.9. However, the exact value plugged into

your macro has no effect whatsoever -- 0x580, 0x590, and 0x0 all work

exactly the same for both 5.8 and 5.9 compilers. I don't know if you

intended the macro to mean the condition should only apply to the

specifically-noted release, but that's not what it's doing.

Also, for what it's worth, there's no way to know whether Sun will fix the

underlying compiler problem before the 5.9 compiler stops being beta,

so I don't know how that should figure into the setting of this parameter.

herteg at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

> Hopefully Sun will notice this posting and fold the fix into their Boost patch files. Sun,

> please let us know when you do so, so we can know it's time to download fresh

> copies of the patches.

Do you mean this fix http://lists.boost.org/boost-users/2006/09/22407.php?

If so - I have not put this fix into my patch yet. When I update my patch I always drop a note on the blog.

> Now, as for patching the official Boost source code, it involves adding a

> condition to a #if:

>

>... ||\

> BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x580))

>

> However, the exact value plugged into

> your macro has no effect whatsoever -- 0x580, 0x590,

> and 0x0 all work exactly the same for both 5.8 and 5.9 compilers. I

> don't know if you intended the macro to mean the condition should only

> apply to the specifically-noted release, but that's not what it's doing.

Please read documentation on BOOST_WORKAROUND and BOOST_TESTED_AT somewhere on the Boost site.

Atanasyan at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

And one more note. I have to say that again - Sun does not support Boost library. We just use this library to find bugs in our compiler and fix them. Please ask Boost developers to make fixes or workarounds in the Boost source code. Actually there are a lot of workarounds for g++ and visual c++ in the Boost sources. They have been made by Boost team not by g++ team or Microsoft.

Atanasyan at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7
> Do you mean this fix http://lists.boost.org/boost-users/2006/09/22407.php?Yes.
herteg at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

I've got a question: why are you maintaining these patches instead

of trying to get them into the Boost CVS? There's currently a regression

engine running Sun Studio 11 (does it have the correct compiler

patch level?)

http://tinyurl.com/gmgpg

which is usually a prerequisite for accepting patches in, but

other than that I don't see why this valuable effort has to be kept

separate from the mainstream Boost version.

Best,

Joaqu韓 M L髉ez Mu駉z

Telef髇ica, Investigaci髇 y Desarrollo

joaquinmlopez at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 9
Boost team knows about this patch and actually the most part of fixes has been included in the Boost source code. I hope upcoming 1.34 will be good enough for Sun C++.
Atanasyan at 2007-7-7 2:48:18 > top of Java-index,Development Tools,Solaris and Linux Development Tools...