Boost C++ Libraries: Ticket #7287: [Context] Fix compatability with MinGW https://svn.boost.org/trac10/ticket/7287 <p> Boost.Context doesn't build correctly on Windows when using MinGW-W64. Luke Elliot, provided a patch that is required. </p> <p> *EDIT* I am unable to link to the original mailing list post since Trac is flagging the link as spam and is crashing when trying to load captcha so I can verify that I am in fact human. Therefore, I am attaching the patch to this ticket. All credit goes to Luke (thanks man!). </p> <p> I would also ask that you reconsider the dependency on ml64 if not using MSVC. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7287 Trac 1.4.3 joshuadavidson@… Sun, 26 Aug 2012 04:18:02 GMT attachment set https://svn.boost.org/trac10/ticket/7287 https://svn.boost.org/trac10/ticket/7287 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">link-hack.patch</span> </li> </ul> <p> Patch provided by Luke Elliot to support linking in MinGW </p> Ticket viboes Tue, 18 Sep 2012 16:59:52 GMT component changed; owner set https://svn.boost.org/trac10/ticket/7287#comment:1 https://svn.boost.org/trac10/ticket/7287#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">olli</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">context</span> </li> </ul> Ticket Lucas Clemente Vella <lvella@…> Tue, 20 Nov 2012 01:35:07 GMT <link>https://svn.boost.org/trac10/ticket/7287#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7287#comment:2</guid> <description> <p> The patch won't apply in latest trunk, and even if it did, it would probably break other platforms, so it would not be acceptable. Since the issue is with GCC, a better approach would be to provide a specific assembly implementation for MinGW's gnu-as alongside MASM's, to be used when building with GCC. But ideally the issue should be addressed by either MinGW team or MASM team; has this issue been reported to them? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>olli</dc:creator> <pubDate>Thu, 03 Jan 2013 17:01:24 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7287#comment:3 https://svn.boost.org/trac10/ticket/7287#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> seems a bug in wingw -&gt; exporting symbols with MASM's EXPORT keyword no handled by mingw </p> Ticket Gilles Mouchard Mon, 04 Apr 2016 17:12:13 GMT <link>https://svn.boost.org/trac10/ticket/7287#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7287#comment:4</guid> <description> <p> Below a patch I apply to boost 1_60_0 to make it compile with mingw (both mingw32 and mingw-w64). It is derived from fedora patches. The patch forces compiling for NT and adds extra assembly directive for gas. The only stuff that doesn't seem to work is exception handling: a throw in a coroutine, for example, invariably results in a call to terminate(). </p> <pre class="wiki">diff -Naur boost_1_60_0/libs/context/build/Jamfile.v2 boost_1_60_0-mingw/libs/context/build/Jamfile.v2 --- boost_1_60_0/libs/context/build/Jamfile.v2 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/build/Jamfile.v2 2016-03-24 19:15:24.057184520 +0100 @@ -45,10 +45,11 @@ local rule default_binary_format ( ) { local tmp = elf ; - if [ os.name ] = "NT" { tmp = pe ; } - else if [ os.name ] = "CYGWIN" { tmp = pe ; } - else if [ os.name ] = "AIX" { tmp = xcoff ; } - else if [ os.name ] = "MACOSX" { tmp = mach-o ; } +# if [ os.name ] = "NT" { tmp = pe ; } +# else if [ os.name ] = "CYGWIN" { tmp = pe ; } +# else if [ os.name ] = "AIX" { tmp = xcoff ; } +# else if [ os.name ] = "MACOSX" { tmp = mach-o ; } + tmp = pe ; return $(tmp) ; } @@ -65,10 +66,11 @@ local rule default_abi ( ) { local tmp = sysv ; - if [ os.name ] = "NT" { tmp = ms ; } - else if [ os.name ] = "CYGWIN" { tmp = ms ; } - else if [ os.platform ] = "ARM" { tmp = aapcs ; } - else if [ os.platform ] = "MIPS" { tmp = o32 ; } +# if [ os.name ] = "NT" { tmp = ms ; } +# else if [ os.name ] = "CYGWIN" { tmp = ms ; } +# else if [ os.platform ] = "ARM" { tmp = aapcs ; } +# else if [ os.platform ] = "MIPS" { tmp = o32 ; } + tmp = ms ; return $(tmp) ; } diff -Naur boost_1_60_0/libs/context/src/asm/jump_i386_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/jump_i386_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/jump_i386_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/jump_i386_ms_pe_gas.asm 2016-03-24 19:15:09.683364218 +0100 @@ -138,3 +138,6 @@ /* indirect jump to context */ jmp *%edx + +.section .drectve +.ascii " -export:\"jump_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm 2016-03-24 19:15:16.656277044 +0100 @@ -223,3 +223,6 @@ /* indirect jump to context */ jmp *%r10 .seh_endproc + +.section .drectve +.ascii " -export:\"jump_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/make_i386_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/make_i386_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/make_i386_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/make_i386_ms_pe_gas.asm 2016-03-24 19:15:30.444104673 +0100 @@ -122,3 +122,6 @@ hlt .def __exit; .scl 2; .type 32; .endef /* standard C library function */ + +.section .drectve +.ascii " -export:\"make_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/make_x86_64_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/make_x86_64_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/make_x86_64_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/make_x86_64_ms_pe_gas.asm 2016-03-24 19:15:38.969998085 +0100 @@ -149,3 +149,6 @@ .seh_endproc .def _exit; .scl 2; .type 32; .endef /* standard C library function */ + +.section .drectve +.ascii " -export:\"make_fcontext\"" </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 04 Apr 2016 19:02:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7287#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7287#comment:5</guid> <description> <p> In fact, throw/catch within a coroutine work with mingw32 (libgcc_s_dw2-1.dll) but not mingw32-w64 (libgcc_s_sjlj-1.dll). </p> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7287#comment:4" title="Comment 4">Gilles Mouchard</a>: </p> <blockquote class="citation"> <p> Below a patch I apply to boost 1_60_0 to make it compile with mingw (both mingw32 and mingw-w64). It is derived from fedora patches. The patch forces compiling for NT and adds extra assembly directive for gas. The only stuff that doesn't seem to work is exception handling: a throw in a coroutine, for example, invariably results in a call to terminate(). </p> <pre class="wiki">diff -Naur boost_1_60_0/libs/context/build/Jamfile.v2 boost_1_60_0-mingw/libs/context/build/Jamfile.v2 --- boost_1_60_0/libs/context/build/Jamfile.v2 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/build/Jamfile.v2 2016-03-24 19:15:24.057184520 +0100 @@ -45,10 +45,11 @@ local rule default_binary_format ( ) { local tmp = elf ; - if [ os.name ] = "NT" { tmp = pe ; } - else if [ os.name ] = "CYGWIN" { tmp = pe ; } - else if [ os.name ] = "AIX" { tmp = xcoff ; } - else if [ os.name ] = "MACOSX" { tmp = mach-o ; } +# if [ os.name ] = "NT" { tmp = pe ; } +# else if [ os.name ] = "CYGWIN" { tmp = pe ; } +# else if [ os.name ] = "AIX" { tmp = xcoff ; } +# else if [ os.name ] = "MACOSX" { tmp = mach-o ; } + tmp = pe ; return $(tmp) ; } @@ -65,10 +66,11 @@ local rule default_abi ( ) { local tmp = sysv ; - if [ os.name ] = "NT" { tmp = ms ; } - else if [ os.name ] = "CYGWIN" { tmp = ms ; } - else if [ os.platform ] = "ARM" { tmp = aapcs ; } - else if [ os.platform ] = "MIPS" { tmp = o32 ; } +# if [ os.name ] = "NT" { tmp = ms ; } +# else if [ os.name ] = "CYGWIN" { tmp = ms ; } +# else if [ os.platform ] = "ARM" { tmp = aapcs ; } +# else if [ os.platform ] = "MIPS" { tmp = o32 ; } + tmp = ms ; return $(tmp) ; } diff -Naur boost_1_60_0/libs/context/src/asm/jump_i386_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/jump_i386_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/jump_i386_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/jump_i386_ms_pe_gas.asm 2016-03-24 19:15:09.683364218 +0100 @@ -138,3 +138,6 @@ /* indirect jump to context */ jmp *%edx + +.section .drectve +.ascii " -export:\"jump_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm 2016-03-24 19:15:16.656277044 +0100 @@ -223,3 +223,6 @@ /* indirect jump to context */ jmp *%r10 .seh_endproc + +.section .drectve +.ascii " -export:\"jump_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/make_i386_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/make_i386_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/make_i386_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/make_i386_ms_pe_gas.asm 2016-03-24 19:15:30.444104673 +0100 @@ -122,3 +122,6 @@ hlt .def __exit; .scl 2; .type 32; .endef /* standard C library function */ + +.section .drectve +.ascii " -export:\"make_fcontext\"" diff -Naur boost_1_60_0/libs/context/src/asm/make_x86_64_ms_pe_gas.asm boost_1_60_0-mingw/libs/context/src/asm/make_x86_64_ms_pe_gas.asm --- boost_1_60_0/libs/context/src/asm/make_x86_64_ms_pe_gas.asm 2015-10-21 15:15:01.000000000 +0200 +++ boost_1_60_0-mingw/libs/context/src/asm/make_x86_64_ms_pe_gas.asm 2016-03-24 19:15:38.969998085 +0100 @@ -149,3 +149,6 @@ .seh_endproc .def _exit; .scl 2; .type 32; .endef /* standard C library function */ + +.section .drectve +.ascii " -export:\"make_fcontext\"" </pre></blockquote> </description> <category>Ticket</category> </item> </channel> </rss>