Boost C++ Libraries: Ticket #3393: Thread compilation skipped when cross compiled from ubuntu to windows https://svn.boost.org/trac10/ticket/3393 <p> Hie, I did trie to cross compile boost libs with that conf (i am on ubuntu uname -a: Linux nephertari 2.6.28-15-generic <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/49" title="#49: Tasks: ARGV rule (closed: Fixed)">#49</a>-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux, and i want to compile for a windows plateform) </p> <p> ######################################################## </p> <p> jp@nephertari:/opt/boost_1_40_0$ cat /home/jp/user-config.jam import option ; import feature ; # Compiler configuration. This definition will be used unless # you already have defined some toolsets in your user-config.jam # file. if ! gcc in [ feature.values &lt;toolset&gt; ] { using gcc : : i586-mingw32msvc-g++ ; } project : default-build &lt;toolset&gt;gcc &lt;target-os&gt;windows &lt;variant&gt;release &lt;cxxflags&gt;-I/usr/src/svn-checkouts/wesnoth-mingw32/win-deps/include &lt;linkflags&gt;-L/usr/src/svn-checkouts/wesnoth-mingw32/win-deps/lib ; </p> <p> # Options specified on the command line completely # override this variable. libraries = ; # These settings are equivivalent to corresponding command-line # options. option.set prefix : /usr/src/svn-checkouts/wesnoth-mingw32/win-deps/ ; option.set layout : system ; jp@nephertari:/opt/boost_1_40_0$ </p> <p> ######################################################## </p> <p> But as you can see, that part of compilation is skipped: </p> <p> ######################################################## </p> <p> jp@nephertari:/opt/boost_1_40_0$ bjam link=static runtime-link=static threading=multi install --prefix=WIN32_ --with-thread --with-signals --with-iostreams target-os=windows -sNO_BZIP2=1 -sNO_ZLIB=1 <strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong> Trying to build Boost.Thread with pthread support. If you need pthread you should specify the paths. You can specify them in site-config.jam, user-config.jam or in the environment. For example: PTW32_INCLUDE=C:\Program Files\ptw32\Pre-built2\include PTW32_LIB=C:\Program Files\ptw32\Pre-built2\lib <strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong><strong></strong> Skipping build of: libs/thread/build/boost_thread &lt;build&gt;no in common properties ...patience... ...found 15024 targets... ...updating 3 targets... gcc.archive bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threading-multi/libboost_iostreams.lib common.copy WIN32_/lib/libboost_iostreams.lib ...updated 3 targets... </p> <p> ######################################################## </p> <p> on irc someone told me this: "Well, I looked at libs/thread/build/Jamfile.v2 and it checks for 'if [ os.name ] = "NT" { api = win32 ; }'. That will cause an epic fail if you are cross-compiling." and told me to use option " try adding threadapi=win32. The api detection of Boost.Thread does not honour "target-os=windows". And please file a bug report." </p> <p> so that compilation has been successfull: </p> <p> ######################################################## </p> <p> jp@nephertari:/opt/boost_1_40_0$ bjam link=static runtime-link=static threading=multi install --prefix=WIN32_ --with-thread --with-signals --with-iostreams target-os=windows -sNO_BZIP2=1 -sNO_ZLIB=1 threadapi=win32 ...patience... ...found 15213 targets... ...updating 32 targets... common.mkdir bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32 common.mkdir bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/file_descriptor.o gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/mapped_file.o gcc.archive bin.v2/libs/iostreams/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/libboost_iostreams.lib common.copy WIN32_/lib/libboost_iostreams.lib common.mkdir bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32 common.mkdir bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi gcc.compile.c++ bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/trackable.o gcc.compile.c++ bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/connection.o gcc.compile.c++ bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/named_slot_map.o gcc.compile.c++ bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/signal_base.o gcc.compile.c++ bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/slot.o gcc.archive bin.v2/libs/signals/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/libboost_signals.lib common.copy WIN32_/lib/libboost_signals.lib common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1 common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32 common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi common.mkdir bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/win32 gcc.compile.c++ bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/win32/thread.o In file included from ./boost/thread/win32/mutex.hpp:8, </p> <blockquote> <p> from ./boost/thread/mutex.hpp:14, from ./boost/thread/detail/thread.hpp:11, from ./boost/thread/thread.hpp:22, from libs/thread/src/win32/thread.cpp:10: </p> </blockquote> <p> ./boost/thread/win32/basic_timed_mutex.hpp: In member function ‘void boost::detail::basic_timed_mutex::destroy()’: ./boost/thread/win32/basic_timed_mutex.hpp:46: warning: dereferencing type-punned pointer will break strict-aliasing rules ./boost/thread/win32/basic_timed_mutex.hpp: In member function ‘void* boost::detail::basic_timed_mutex::get_event()’: ./boost/thread/win32/basic_timed_mutex.hpp:152: warning: dereferencing type-punned pointer will break strict-aliasing rules libs/thread/src/win32/thread.cpp: In static member function ‘static unsigned int boost::thread::hardware_concurrency()’: libs/thread/src/win32/thread.cpp:306: warning: missing braces around initializer for ‘_SYSTEM_INFO::&lt;anonymous union&gt;’ libs/thread/src/win32/thread.cpp: In function ‘LARGE_INTEGER boost::this_thread::&lt;unnamed&gt;::get_due_time(const boost::detail::timeout&amp;)’: libs/thread/src/win32/thread.cpp:329: warning: missing braces around initializer for ‘_LARGE_INTEGER::&lt;anonymous struct&gt;’ libs/thread/src/win32/thread.cpp:351: warning: dereferencing type-punned pointer will break strict-aliasing rules gcc.compile.c++ bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/win32/exceptions.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/win32/tss_dll.o gcc.compile.c++ bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/win32/tss_pe.o gcc.archive bin.v2/libs/thread/build/gcc-mingw-4.2.1/release/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/libboost_thread_win32.lib common.copy WIN32_/lib/libboost_thread_win32.lib ...updated 32 targets... </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3393 Trac 1.4.3 anonymous Sat, 22 May 2010 13:18:16 GMT milestone changed https://svn.boost.org/trac10/ticket/3393#comment:1 https://svn.boost.org/trac10/ticket/3393#comment:1 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost.Jam 4.0.0</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> Ticket viboes Wed, 09 Jun 2010 20:33:55 GMT cc set https://svn.boost.org/trac10/ticket/3393#comment:2 https://svn.boost.org/trac10/ticket/3393#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> </ul> Ticket viboes Sun, 11 Dec 2011 09:11:50 GMT owner, status changed https://svn.boost.org/trac10/ticket/3393#comment:3 https://svn.boost.org/trac10/ticket/3393#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Anthony Williams</span> to <span class="trac-author">viboes</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Sun, 11 Dec 2011 14:04:48 GMT <link>https://svn.boost.org/trac10/ticket/3393#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:4</guid> <description> <p> Do someone know how to make threadapi dependent on target-os and not on os? </p> <p> I have tried </p> <pre class="wiki">local rule default_threadapi ( ) { local api = pthread ; #if [ os.name ] = "NT" { api = win32 ; } if [ target-os ] = windows { api = win32 ; } return $(api) ; } </pre><p> But this doesn't works. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 12 Aug 2012 19:54:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3393#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:5</guid> <description> <p> Does it works if you set threadapi=posix on the command line? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sat, 08 Dec 2012 13:51:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3393#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:6</guid> <description> <p> See Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7706" title="#7706: Bugs: cross compiling of threads library - JamFile.v2 (closed: duplicate)">#7706</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 10 Dec 2012 23:00:14 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/3393 https://svn.boost.org/trac10/ticket/3393 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">threadapi2.diff</span> </li> </ul> <p> Please could someone check this patch? </p> Ticket viboes Mon, 17 Dec 2012 17:35:22 GMT status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/3393#comment:7 https://svn.boost.org/trac10/ticket/3393#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> If I'm not wrong the way to cross compile Boost.Thread is using threadapi feature. Please reopen it if it doesn't work with threadapi=posix. </p> Ticket tvaneerd@… Wed, 19 Dec 2012 15:58:54 GMT <link>https://svn.boost.org/trac10/ticket/3393#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:8</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3393#comment:7" title="Comment 7">viboes</a>: </p> <blockquote class="citation"> <p> If I'm not wrong the way to cross compile Boost.Thread is using threadapi feature. Please reopen it if it doesn't work with threadapi=posix. </p> </blockquote> <p> Maybe target-os should be used to determine a default threadapi if one is not set? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 20 Dec 2012 07:37:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3393#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:9</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3393#comment:8" title="Comment 8">tvaneerd@…</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/3393#comment:7" title="Comment 7">viboes</a>: </p> <blockquote class="citation"> <p> If I'm not wrong the way to cross compile Boost.Thread is using threadapi feature. Please reopen it if it doesn't work with threadapi=posix. </p> </blockquote> <p> Maybe target-os should be used to determine a default threadapi if one is not set? </p> </blockquote> <p> We have tried a lot of things (See Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7706" title="#7706: Bugs: cross compiling of threads library - JamFile.v2 (closed: duplicate)">#7706</a>), and currently we are unable to make dependent the default threadapi of target-os. Of course if someone knows how to do this a patch is welcome. </p> <p> Note that currently the user is able to choose its threadapi for the same target-os. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 22 Sep 2017 17:23:17 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3393#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:10</guid> <description> <p> Hi again, would the following work </p> <p> <a class="ext-link" href="https://github.com/boostorg/thread/pull/160/commits/2fb41edf1adea22c61d78f42f4ec6b7f6c87e025"><span class="icon">​</span>https://github.com/boostorg/thread/pull/160/commits/2fb41edf1adea22c61d78f42f4ec6b7f6c87e025</a> </p> <p> ? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 22 Sep 2017 17:23:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3393#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3393#comment:11</guid> <description> <p> Hi again, would the following work </p> <p> <a class="ext-link" href="https://github.com/boostorg/thread/pull/160/commits/2fb41edf1adea22c61d78f42f4ec6b7f6c87e025"><span class="icon">​</span>https://github.com/boostorg/thread/pull/160/commits/2fb41edf1adea22c61d78f42f4ec6b7f6c87e025</a> </p> <p> ? </p> </description> <category>Ticket</category> </item> </channel> </rss>