tags:

views:

655

answers:

2

I'm trying to migrate a project which uses Boost (particularly boost::thread and boost::asio) to VxWorks.

I can't get boost to compile using the vxworks gnu compiler. I figured that this wasn't going to be an issue as I'd seen patches on the boost trac that purport to make this possible, and since the vxworks compiler is part of the gnu tool chain I should be able to follow the directions in the boost docs for cross compilation.

I'm building on windows for a ppc vxworks.

I changed the user-config.jam file as specified in the boost docs, and used the target-os=linux option to bjam, but bjam appears to hang before it can compile. Closer inspection of the commands issued by bjam (by invoking it using the -n option) reveal that it's trying to compile with boost::thread's win32 files. This can't be right, as vxworks uses pthreads.

My bjam command: .\bjam --with-thread toolset=gcc-ppc target-os=linux gcc-ppc is set in user-config to point to the g++ppc vxworks cross compiler.

What am I doing wrong? I believe I have followed the docs to the letter.

A: 

Try also adding

threadapi=pthread

The documentation you mention is for Boost.Build -- which is standalone build tool -- and the above flag is something specific to Boost.Thread library. What do you mean by "hang"? Because Boost libraries are huge, it sometimes take a lot of time to scan dependencies prior to build. If it actually hangs, can you catch bjam in a debugger and produce a backtrace? Also, log of any output will help.

Vladimir Prus
+1  A: 

If it's #including win32 headers instead of the pthread ones, there could be a discrepancy between the set of macros your compiler is defining and the macros the boost headers are checking for. I had a problem like that with the smart pointer headers, which in an older version of boost would check for __ppc but my compiler defined __ppc__ (or vice versa, can't remember).

touch empty.cpp
ccppc -dD -E empty.cpp

That will show you what macros are predefined by your compiler.

I never tried to compile boost for VxWorks, since I only needed a few of the headers.

Dan