2012-10-19 19 views
6

मेरे पास एक ओएस है और -mthread उपलब्ध नहीं है। मेरे पास -pthread है। बूस्ट_थ्रेड-pthread के साथ -mthread के बजाय संकलित कैसे करें?"-mthread" के बजाय "-pthread" के साथ boost_thread को संकलित कैसे करें?

मेरे वर्तमान संकलक निर्माण लॉग:

./b2 -j1 --with-thread link=static --prefix=./install-dir release threading=multi --builddir=./bu 
ild-dir install 

Component configuration: 

    - chrono     : not building 
    - context     : not building 
    - date_time    : not building 
    - exception    : not building 
    - filesystem    : not building 
    - graph     : not building 
    - graph_parallel   : not building 
    - iostreams    : not building 
    - locale     : not building 
    - math      : not building 
    - mpi      : not building 
    - program_options   : not building 
    - python     : not building 
    - random     : not building 
    - regex     : not building 
    - serialization   : not building 
    - signals     : not building 
    - system     : not building 
    - test      : not building 
    - thread     : building 
    - timer     : not building 
    - wave      : not building 

...patience... 
...found 19764 targets... 
...updating 16 targets... 
gcc.compile.c++ bin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi/error_code.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -DBOOST_ALL_NO_LIB=1 -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2\libs\system\build\gcc-4.2. 
1\release\link-static\threading-multi\error_code.o" "libs\system\src\error_code.cpp" 

...failed gcc.compile.c++ bin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi/error_code.o... 
...skipped <pbin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi>libboost_system.a(clean) for lack of <pbin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi>error_ 
code.o... 
...skipped <pbin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi>libboost_system.a for lack of <pbin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi>error_code.o. 
.. 
...skipped <pinstall-dir/lib>libboost_system.a for lack of <pbin.v2/libs/system/build/gcc-4.2.1/release/link-static/threading-multi>libboost_system.a... 
gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/chrono.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_All_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATE 
D -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2\libs\chrono\build\gcc-4.2.1\release\link-static\threading-multi\chrono.o" "libs\chrono\src\chrono.cpp" 

...failed gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/chrono.o... 
gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/thread_clock.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_All_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATE 
D -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2\libs\chrono\build\gcc-4.2.1\release\link-static\threading-multi\thread_clock.o" "libs\chrono\src\thread_clock.cpp" 

...failed gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/thread_clock.o... 
gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/process_cpu_clocks.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_All_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPRECATE 
D -DBOOST_SYSTEM_STATIC_LINK=1 -DNDEBUG -I"." -c -o "bin.v2\libs\chrono\build\gcc-4.2.1\release\link-static\threading-multi\process_cpu_clocks.o" "libs\chrono\src\process_cpu_clocks.cpp" 

...failed gcc.compile.c++ bin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi/process_cpu_clocks.o... 
...skipped <pbin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi>libboost_chrono.a(clean) for lack of <pbin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi>chrono 
.o... 
...skipped <pbin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi>libboost_chrono.a for lack of <pbin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi>chrono.o... 
...skipped <pinstall-dir/lib>libboost_chrono.a for lack of <pbin.v2/libs/chrono/build/gcc-4.2.1/release/link-static/threading-multi>libboost_chrono.a... 
gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/pthread/thread.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPREC 
ATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2\libs\thread\build\gcc-4.2.1\release\link-static\threading-multi\pthread\thread.o" "libs\ 
thread\src\pthread\thread.cpp" 

...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/pthread/thread.o... 
gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/pthread/once.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPREC 
ATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2\libs\thread\build\gcc-4.2.1\release\link-static\threading-multi\pthread\once.o" "libs\th 
read\src\pthread\once.cpp" 

...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/pthread/once.o... 
gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/future.o 
cc1plus: error: unrecognized command line option "-mthreads" 

    "g++" -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pedantic -mthreads -Wextra -Wno-long-long -pedantic -DBOOST_ALL_NO_LIB=1 -DBOOST_CHRONO_STATIC_LINK=1 -DBOOST_SYSTEM_NO_DEPREC 
ATED -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_BUILD_LIB=1 -DBOOST_THREAD_POSIX -DNDEBUG -I"." -c -o "bin.v2\libs\thread\build\gcc-4.2.1\release\link-static\threading-multi\future.o" "libs\thread\s 
rc\future.cpp" 

...failed gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi/future.o... 
...skipped <pbin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi>libboost_thread.a(clean) for lack of <pbin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi>pthrea 
d/thread.o... 
...skipped <pbin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi>libboost_thread.a for lack of <pbin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi>pthread/threa 
d.o... 
...skipped <pinstall-dir/lib>libboost_thread.a for lack of <pbin.v2/libs/thread/build/gcc-4.2.1/release/link-static/threading-multi>libboost_thread.a... 
...failed updating 7 targets... 
...skipped 9 targets... 

यह किसी तरह पैच boost_thread boost_thread thint कि यह -pthread साथ संकलित किया जाएगा बनाने के लिए तो मेरे संकलक के साथ अपने मंच पर संकलित करने के लिए संभव है?

प्लेटफार्म - वर्ष, hevily संशोधित cigwin, जीसीसी-4.2.1

+0

[यह] अपने आदेश का पुनर्प्रसारण से शुरू होगा (http://antonym.org/2009/05/threading-with-boost---part-i- create-threads.html) उपयोगी हो सकता है .... – Recker

+1

आप प्लेटफ़ॉर्म, टूल का उपयोग कर रहे हैं (संस्करण सहित) के बारे में विनिर्देशों का उल्लेख करना चाहेंगे, और बूस्ट का संस्करण आप हो इमारत। एफडब्ल्यूआईडब्ल्यू, '-mthreads' का उल्लेख 'टूल्स/बिल्ड/वी 2/टूल्स/जीसीसी.जेम' में दो स्थानों में किया गया है, लेकिन चूंकि मुझे 'जाम' (या 'बी 2' या जो भी बूस्ट बिल्ड टूल कहा जाता है) के बारे में कुछ भी नहीं पता है। चरण-दर-चरण व्यंजनों का उपयोग करके इसे कैसे उजागर करना है, मुझे नहीं पता कि आप उस जानकारी के साथ क्या कर सकते हैं। या अगर यह भी उपयोगी है। –

उत्तर

2

आप/पैच उपकरण की कोशिश कर सकते निर्माण/v2/उपकरण/gcc.jam

1017 rule setup-threading (targets * : sources * : properties *) 
1018 { 
1019  local threading = [ feature.get-values threading : $(properties) ] ; 
1020  if $(threading) = multi 
1021  { 
1022   local target = [ feature.get-values target-os : $(properties) ] ; 
1023   local option ; 
1024   local libs ; 
1025 
1026   switch $(target) 
1027   { 
1028    case windows : option = -mthreads ; 
1029    case cygwin : option = -mthreads ; 
1030    case solaris : option = -pthreads ; libs = rt ; 
1031    case beos : # No threading options. 
1032    case *bsd : option = -pthread ; # There is no -lrt on BSD. 
1033    case sgi  : # gcc on IRIX does not support multi-threading. 
1034    case darwin : # No threading options. 
1035    case *  : option = -pthread ; libs = rt ; 
1036   } 
1037 

आप अधिक जानकारी देते हैं, मैं आपकी मदद करने की कोशिश कर सकता था।

0

आप cxxflags तर्कों का उपयोग संकलक के झंडे पारित कर सकते हैं, http://www.boost.org/build/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compiler.gcc कुछ है कि यहाँ मदद कर सकता है कर रहे हैं: cxxflags = -DPTHREADS cxxflags = -DBOOST_THREAD_POSIX cxxflags = -pthread cxxflags = -DTHREAD
आप के लिए प्रयोग करने के लिए हो सकता है वास्तव में परिणाम आप चाहते हैं, लेकिन मैं के रूप में

./b2 -j1 --with-thread link=static cxxflags=-DPTHREADS cxxflags=-DBOOST_THREAD_POSIX cxxflags=-pthread cxxflags=-DTHREAD --prefix=./install-dir release threading=multi --builddir=./build-dir install