4

I am trying to build Boost.Log ( http://boost-log.sourceforge.net/libs/log/doc/html/index.html ). I added it to my boost sources and executed my usual boost build command.

b2 --build-dir="D:\boost\1.51.0\boost" toolset=gcc variant=release link=static threading=multi  runtime-link=static --build-type=complete

But nothing happened and I received this in the end:

D:/boost/1.51.0/src/tools/build/v2/build\generators.jam:1085: in ensure-type from module generators
error: target { simple_event_log.mc. } has no type
D:/boost/1.51.0/src/tools/build/v2/build\generators.jam:1319: in generators.construct from module generators
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1495: in construct from module object(typed-target)@491
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1298: in object(typed-target)@491.generate from module object(typed-target)@491
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:732: in generate-really from module object(main-target)@1871

D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:704: in object(main-target)@1871.generate from module object(main-target)@1871
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:258: in object(project-target)@474.generate from module object(project-target)@474
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:848: in targets.generate-from-reference from module targets D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1217: in generate-dependencies from module object(install-target-class)@96
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1269: in object(install-target-class)@96.generate from module object(install-target-class)@96
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:732: in generate-really from module object(main-target)@930 D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:704: in object(main-target)@930.generate from module object(main-target)@930
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:848: in targets.generate-from-reference from module targets D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1217: in generate-dependencies from module object(top-level-target)@103
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1269: in alias-target-class.generate from module object(top-level-target)@103
D:/boost/1.51.0/src\boostcpp.jam:391: in build-multiple from module object(top-level-target)@103
D:/boost/1.51.0/src\boostcpp.jam:376: in object(top-level-target)@103.generate from module object(top-level-target)@103
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:732: in generate-really from module object(main-target)@934 D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:704: in object(main-target)@934.generate from module object(main-target)@934
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:848: in targets.generate-from-reference from module targets D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1217: in generate-dependencies from module object(top-level-target)@104
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:1269: in alias-target-class.generate from module object(top-level-target)@104
D:/boost/1.51.0/src\boostcpp.jam:391: in build-multiple from module object(top-level-target)@104
D:/boost/1.51.0/src\boostcpp.jam:376: in object(top-level-target)@104.generate from module object(top-level-target)@104
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:732: in generate-really from module object(main-target)@935 D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:704: in object(main-target)@935.generate from module object(main-target)@935
D:/boost/1.51.0/src/tools/build/v2/build\targets.jam:258: in object(project-target)@42.generate from module object(project-target)@42
D:/boost/1.51.0/src/tools/build/v2\build-system.jam:736: in load from module build-system
D:\boost\1.51.0\src\tools\build\v2/kernel\modules.jam:283: in import from module modules
D:\boost\1.51.0\src\tools\build\v2/kernel/bootstrap.jam:142: in boost-build from module
D:\boost\1.51.0\src\boost-build.jam:17: in module scope from module                                   

Could you, please explain what does it means or how I can see more error info? How did you build Boost.Log?

Jesse Good
  • 50,901
  • 14
  • 124
  • 166
user14416
  • 2,922
  • 5
  • 40
  • 67

2 Answers2

2

The answer to the problem can be found here:

Second, at some point the library will require a Message Compiler tool (mc.exe), which is not available in MinGW, Cygwin and MSVC Express Edition. You have two options to settle the problem. In case of MinGW and Cygwin you can use the windmc.exe tool, which is the analogue of the original mc.exe. In order to do that you will have to patch Boost.Build files (in particular, the tools/build/v2/tools/mc.jam file) as described in this ticket. After that you will be able to specify the mc-compiler=windmc option to bjam to build the library.

Here is a link to the patch. Applying the patch and passing mc-compiler=windmc should solve the problem.

Note: Also, as noted on the comments in the ticket, you need to add import mc ; after import fortran ; in tools\build\v2\tools\gcc.jam.

Here is what your mc.jam file should look like after applying the patch (make sure your file looks like the following):

import common ;
import generators ;
import feature : feature get-values ;
import toolset : flags ;
import type ;
import rc ;

feature.feature mc-compiler : mc windmc : propagated ; 
feature.set-default mc-compiler : mc ; 

rule init ( )
{
}

type.register MC : mc ;


# Command line options
feature mc-input-encoding : ansi unicode : free ;
feature mc-output-encoding : unicode ansi : free ;
feature mc-set-customer-bit : no yes : free ;

flags mc.compile MCFLAGS <mc-input-encoding>ansi : -a ;
flags mc.compile MCFLAGS <mc-input-encoding>unicode : -u ;
flags mc.compile MCFLAGS <mc-output-encoding>ansi : -A ;
flags mc.compile MCFLAGS <mc-output-encoding>unicode : -U ;
flags mc.compile MCFLAGS <mc-set-customer-bit>no : ;
flags mc.compile MCFLAGS <mc-set-customer-bit>yes : -c ;

generators.register-standard mc.compile.mc : MC : H RC : <mc-compiler>mc ; 
generators.register-standard mc.compile.windmc : MC : H RC : <mc-compiler>windmc ;

actions compile.mc
{ 
    mc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)" 
}

actions compile.windmc
{ 
    windmc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)" 
} 

WARNING

boost-log\branches\bleeding-edge fails to compile for me (gcc 4.7.1). I used the one in boost-log\trunk\boost-log for a successful build (built on 2012-09-05).

Jesse Good
  • 50,901
  • 14
  • 124
  • 166
  • I have the same problem as the original poster (Boost 1.51.0 and MinGW GCC 4.7.0). Using boost-log\trunk and applying the patch unfortunately does not work. As soons as i remove the boost-log directories boost builds just fine. – user573335 Sep 23 '12 at 23:48
  • 1
    @user573335: Try adding `import mc;` in `tools\build\v2\tools\gcc.jam` right after `import fortran ;` (I forgot to add that to my answer). This is also mentioned in the link to the ticket. If you have any other problems, please be specific about what happens. – Jesse Good Sep 23 '12 at 23:51
  • Thanks for the quick solution, the `import mc;` solves the _..has no type_-error for me. Now only 4 targets have a problem building: `..boost_1_51_0/./boost/thread/win32/condition_variable.hpp:86: undefined reference to '__imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE'` (for the threading=single targets). Any idea where i should look for this? – user573335 Sep 24 '12 at 14:51
  • @user573335: I get that error when I try to link boost thread statically ([see here](http://stackoverflow.com/questions/3705563/code-blocks-mingw-boost-and-static-linking-issues/3732505#3732505)) because it is configured for dynamic linking. However, I never had an error while building boost. I build it with `link=static,shared threading=multi` set. – Jesse Good Sep 24 '12 at 20:43
0

Try:

b2 toolset=gcc --build-type=complete threading=multi architecture=x86 address-model=32 --with-log define=BOOST_LOG_USE_CHAR --stagedir=.

It was working for me with Boost 1.51 and Boost::Log rev. 721