NaCl multithreading support

795 views
Skip to first unread message

Uttam Gandhi

unread,
Nov 23, 2011, 6:26:44 AM11/23/11
to Native-Client-Discuss
Need Help to use boost::thread with nacl

Code fails to compile, while trying to use boost::thread with nacl
examples. The error suggests that the threading support is not on by
default for NACL.
I also had a look at pi_generator using pthreads, but found nothing
special.

So, I think, either some flag needs to be turned on or some compiler
options needs to be provided, but not sure which and how.

Following is code snippet::
   ...
   15    #include <boost/thread/thread.hpp>
   ...
   51        thread* thr=new boost::thread((&method),NULL);
   ...

Following is log snippet::

scons: Building targets ...
/Developer/nacl_sdk/pepper_15/toolchain/mac_x86_newlib/bin/i686-nacl-g+
+ -o hello_world/dbg_x86_32/helper_functions.o -c -std=gnu++98 -Wno-
long-long -Wall -Wswitch-enum -pthread -pedantic -I/Users/yogeshd/src/
officebase_qocpp/common/jdkcpp/src -I/Users/yogeshd/src/boost_1_47_0 -
O0 -g -m32 -D_GNU_SOURCE=1 -D__STDC_FORMAT_MACROS=1 -D_BSD_SOURCE=1 -
D_POSIX_C_SOURCE=199506 -D_XOPEN_SOURCE=600 -I/Developer/nacl_sdk/
pepper_15 hello_world/helper_functions.cc
In file included from /Users/yogeshd/src/boost_1_47_0/boost/thread/
detail/platform.hpp:17,
                from /Users/yogeshd/src/boost_1_47_0/boost/thread/
thread.hpp:12,
                from hello_world/helper_functions.cc:15:
/Users/yogeshd/src/boost_1_47_0/boost/config/requires_threads.hpp:
47:5: error: #error "Compiler threading support is not turned on.
Please set the correct command line options for threading: -pthread
(Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
In file included from /Users/yogeshd/src/boost_1_47_0/boost/thread/
thread.hpp:12,
                from hello_world/helper_functions.cc:15:

Evgeniy Stepanov

unread,
Nov 23, 2011, 9:16:10 AM11/23/11
to native-cli...@googlegroups.com
Try boost from http://code.google.com/p/naclports/, it is known to work.


--
You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To post to this group, send email to native-cli...@googlegroups.com.
To unsubscribe from this group, send email to native-client-di...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/native-client-discuss?hl=en.


Uttam Gandhi

unread,
Nov 25, 2011, 6:02:47 AM11/25/11
to Native-Client-Discuss
I have the ported libs, the script provided in ports does not build
all libs.
Hence I tried to build using ./b2 toolset=gcc, this builds all libs
However, gives error for multithreading

./boost/config/requires_threads.hpp:47:5: error: #error "Compiler


threading support is not turned on. Please set the correct command
line options for threading: -pthread (Linux), -pthreads (Solaris) or -
mthreads (Mingw32)"

I am not sure where to set this option


On Nov 23, 7:16 pm, Evgeniy Stepanov <euge...@google.com> wrote:
> Try boost fromhttp://code.google.com/p/naclports/, it is known to work.

Evgeniy Stepanov

unread,
Nov 25, 2011, 6:12:30 AM11/25/11
to native-cli...@googlegroups.com
You are using newlib, then. There is a lot of feature detection C++ code in boost that does not really know about newlib. Good luck with that.

Uttam Gandhi

unread,
Nov 25, 2011, 8:06:35 AM11/25/11
to Native-Client-Discuss
I did not get what is newlib, is there other version of naclports than
what I am using ?
or, are you referring to SDK version (I am using pepper_15)

On Nov 25, 4:12 pm, Evgeniy Stepanov <euge...@google.com> wrote:
> You are using newlib, then. There is a lot of feature detection C++ code in
> boost that does not really know about newlib. Good luck with that.
>

Egor Pasko

unread,
Nov 25, 2011, 8:38:37 AM11/25/11
to native-cli...@googlegroups.com
On Fri, Nov 25, 2011 at 5:06 PM, Uttam Gandhi <uttam....@gmail.com> wrote:
> I did not get what is newlib, is there other version of naclports than
> what I am using ?

You can easily find what newlib is by using your favorite search engine.

> or, are you referring to SDK version (I am using pepper_15)

There are 2 toolchains, in your case: "mac_x86" and "mac_x86_newlib".
Your pasted error message suggests that you are using the latter,
while boost in naclports only has support for the former.

--
Egor Pasko

Uttam Gandhi

unread,
Nov 25, 2011, 9:31:35 AM11/25/11
to Native-Client-Discuss
Thanks Egor, It worked

On Nov 25, 6:38 pm, Egor Pasko <pa...@google.com> wrote:

Victor Khimenko

unread,
Nov 25, 2011, 9:39:06 AM11/25/11
to native-cli...@googlegroups.com
Note that GLibC requires significantly more complex manifest file:


In general GLibC is more compatible wiht third-party packages then newlib, but right now harder to work with because you need to specify list of all shared libraries used by your program manually.

Reply all
Reply to author
Forward
0 new messages