Opened 13 years ago

Closed 10 years ago

Last modified 5 years ago

#3393 closed Bugs (invalid)

Thread compilation skipped when cross compiled from ubuntu to windows

Reported by: epsilon777 <jeanpaul.vallee1@…> Owned by: viboes
Milestone: Component: thread
Version: Boost 1.40.0 Severity: Problem
Keywords: cross compile thread skipp Cc: viboes

Description

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 #49-Ubuntu SMP Tue Aug 18 18:40:08 UTC 2009 i686 GNU/Linux, and i want to compile for a windows plateform)

########################################################

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 <toolset> ] { using gcc : : i586-mingw32msvc-g++ ; } project : default-build <toolset>gcc <target-os>windows <variant>release <cxxflags>-I/usr/src/svn-checkouts/wesnoth-mingw32/win-deps/include <linkflags>-L/usr/src/svn-checkouts/wesnoth-mingw32/win-deps/lib ;

# 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$

########################################################

But as you can see, that part of compilation is skipped:

########################################################

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 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 Skipping build of: libs/thread/build/boost_thread <build>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...

########################################################

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."

so that compilation has been successfull:

########################################################

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,

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:

./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::<anonymous union>’ libs/thread/src/win32/thread.cpp: In function ‘LARGE_INTEGER boost::this_thread::<unnamed>::get_due_time(const boost::detail::timeout&)’: libs/thread/src/win32/thread.cpp:329: warning: missing braces around initializer for ‘_LARGE_INTEGER::<anonymous struct>’ 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...

Attachments (1)

threadapi2.diff (1.1 KB ) - added by viboes 10 years ago.
Please could someone check this patch?

Download all attachments as: .zip

Change History (12)

comment:1 by anonymous, 12 years ago

Milestone: Boost.Jam 4.0.0To Be Determined

comment:2 by viboes, 12 years ago

Cc: viboes added

comment:3 by viboes, 11 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

comment:4 by viboes, 11 years ago

Do someone know how to make threadapi dependent on target-os and not on os?

I have tried

local rule default_threadapi ( )
{
    local api = pthread ;
    #if [ os.name ] = "NT" { api = win32 ; }
    if [ target-os ] = windows { api = win32 ; }
    return $(api) ;
}

But this doesn't works.

comment:5 by viboes, 10 years ago

Does it works if you set threadapi=posix on the command line?

comment:6 by viboes, 10 years ago

See Ticket #7706

by viboes, 10 years ago

Attachment: threadapi2.diff added

Please could someone check this patch?

comment:7 by viboes, 10 years ago

Milestone: To Be Determined
Resolution: invalid
Status: assignedclosed

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.

in reply to:  7 ; comment:8 by tvaneerd@…, 10 years ago

Replying to viboes:

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.

Maybe target-os should be used to determine a default threadapi if one is not set?

in reply to:  8 comment:9 by viboes, 10 years ago

Replying to tvaneerd@…:

Replying to viboes:

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.

Maybe target-os should be used to determine a default threadapi if one is not set?

We have tried a lot of things (See Ticket #7706), 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.

Note that currently the user is able to choose its threadapi for the same target-os.

Note: See TracTickets for help on using tickets.