David Abrahams wrote:
gcc-C++-action ../../../libs/graph/build/bin/liblibbgl-viz.a/gcc/debug/runtime-link-dynamic/graphviz_graph_parser.o graphviz_parser.y:44:2: #error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1
Needless to say, neither "-sBUILD=<define>GRAPHVIZ_GRAPH=GraphvizGraph <define>GRAPHVIZ_DIRECTED=GraphvizDirected" nor "-sBUILD=<define>GRAPHVIZ_DIRECTED=GraphvizDirected" (in case I got the syntax wrong ;-)
have any effect.
Why is that needless to say? Both of those seem to have the intended effect. What do you see on the generated command-lines?
My apologies. I meant only that I was ignorant of the syntax. The relevant snippet of source code in graphviz_parser.y is #ifndef GRAPHVIZ_DIRECTED #error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 #endif #if GRAPHVIZ_DIRECTED == 0 #define GRAPHVIZ_GRAPH boost::GraphvizGraph #define yyrestart bgl_undir_restart #else #define GRAPHVIZ_GRAPH boost::GraphvizDigraph #define yyrestart bgl_dir_restart #endif So, passing 'GRAPHVIZ_GRAPH=GraphvizGraph' to the compiler is actually the wrong thing to do. We should pass it 'GRAPHVIZ_DIRECTED=0' or 'GRAPHVIZ_DIRECTED=1' as appropriate. Hence invoking bjam with a fixed value for GRAPHVIZ_DIRECTED is also wrong. Instead the Jamfile requires rules to create graphviz_graph_parser.o and graphviz_digraph_parser.o from graphviz_parser.y. Nonetheless, proceeding with your suggested stategy in order to demonstrate what is actually happening and to answer your question about what is seen on the generated command-lines: $ bjam -sTOOLS=gcc "-sBUILD=<define>GRAPHVIZ_DIRECTED=0" [snip] gcc-C++-action ../../../libs/graph/build/bin/liblibbgl-viz.a/gcc/debug/runtime-link-dynamic/graphviz_graph_parser.o graphviz_parser.y:44:2: #error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 graphviz_parser.y: In function `void boost::read_graphviz(const std::string&, boost::GraphvizGraph&)': graphviz_parser.y:500: warning: unused variable `void*in' graphviz_parser.y: In function `void boost::read_graphviz(FILE*, boost::GraphvizGraph&)': graphviz_parser.y:505: warning: unused variable `void*in' /home/aleem/boost/boost-1.30.1/boost/tuple/detail/tuple_basic.hpp: At top level: graphviz_parser.y:89: warning: `const std::string& graphviz::get_graph_name(const graphviz::Subgraph&)' defined but not used g++ -c -Wall -ftemplate-depth-100 -g -O0 -fno-inline -I"../../../libs/graph/build" -I "/home/aleem/boost/boost-1.30.1" -o "../../../libs/graph/build/bin/liblibbgl-viz.a/gcc/debug/runtime-link-dynamic/graphviz_graph_parser.o" "../../../libs/graph/build/../src/graphviz_graph_parser.cpp" ...failed gcc-C++-action ../../../libs/graph/build/bin/liblibbgl-viz.a/gcc/debug/runtime-link-dynamic/graphviz_graph_parser.o... As you can see, GRAPHVIZ_DIRECTED=0 is not passed to g++.
I don't know how familiar you are with the code here, but the Makefile way would be to define specialised targets (my terminology is probably incorrect), in transparent terms something like:
graphviz_graph_parser.o: graphviz_parser.C g++ -DGRAPHVIZ_DIRECTED=0 -o graphviz_graph_parser.o graphviz_parser.C
graphviz_digraph_parser.o: graphviz_parser.C g++ -DGRAPHVIZ_DIRECTED=1 -o graphviz_digraph_parser.o graphviz_parser.C
ie, two object files from one source file. The complication here, of course, is that the source code is in graphviz_parser.y.
That's not complicated, IMO.
Does this enable you to 'cure' the problem or is it fundamental?
I'm sorry, I don't know how to "cure" the problem right now, because I'm not sure what results would be produced by a complete cure. Do you expect to end up with both of these .o files in in the same library?
Yes.
There is a file 'libs/graph/build/Jamfile.v2' containing
obj graphviz_graph_lex : graphviz_lex.l
: