Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#4839 closed Bugs (worksforme)

boost_thread will not build with MinGW-w64 and bjam on Windows 7

Reported by: fatman@… Owned by: Anthony Williams
Milestone: Component: thread
Version: Boost Development Trunk Severity: Showstopper
Keywords: 64 interlocked Cc: viboes, sebastian.held@…, jim@…

Description

OS:
Windows 7 Ultimate (64-bit)

Compiler:
MinGW-w64

> g++ --version[[BR]]
g++ (GCC) 4.5.2 20101015 (prerelease)

Command line:

bjam.exe toolset=gcc stage --build-type=complete --with-thread >thread.log.txt

(I have used bootstrap.bat to build a native version of bjam.exe.)

Output: please see attached thread.log.txt.

To summarise, boost_thread seems to be the only binary Boost library which won't build in my MinGW-w64 build environment. Running without --with-thread results in 250-odd libboost*.a files in my stage/lib directory (as expected) but without boost_thread.

Please see also bug 4804. This is similar but not quite the same bug. His bug occurred while /linking against/ boost_thread; mine occurs while /building/ boost_thread.

Thanks for reading.

Attachments (3)

thread.log.txt (22.2 KB ) - added by fatman@… 12 years ago.
Output from bjam with stage and --with-thread on MinGW-w64
thread.log.d2.txt (22.5 KB ) - added by fatman@… 12 years ago.
Same command line but with -d2 at the end, before the redirect
thread.log.2.txt (19.5 KB ) - added by fatman@… 12 years ago.
New output from altered environment

Download all attachments as: .zip

Change History (29)

by fatman@…, 12 years ago

Attachment: thread.log.txt added

Output from bjam with stage and --with-thread on MinGW-w64

comment:1 by fatman@…, 12 years ago

Line 45 of the output:

./boost/thread/win32/interlocked_read.hpp:71:13: error: cast from 'void*' to 'long int' loses precision

suggests we're casting a pointer to a 32-bit integer. We can get away with that in 32 bits, but on a 64-bit system? No kidding it loses precision, we've just thrown away half the pointer. I'm guessing that's not the intended effect?

comment:2 by viboes, 12 years ago

Hi,

it will be useful if you can provide the result of bjam -d2, so we can see the compiler command line. Also useful could be the output of the preprocessing (replace -c in the command line by -E).

Best, Vicente

comment:3 by viboes, 12 years ago

Cc: viboes added

comment:4 by fatman@…, 12 years ago

Thanks Vicente. I'll attach the outputs as soon as they're ready.

by fatman@…, 12 years ago

Attachment: thread.log.d2.txt added

Same command line but with -d2 at the end, before the redirect

comment:5 by fatman@…, 12 years ago

Ok, I've run the same command with -d2 at the end:

bjam.exe toolset=gcc stage --build-type=complete --with-thread -d2 >thread.log.d2.txt

When I add -E to the command line, I get "Invalid option: -E". Are you thinking about a different command?

in reply to:  5 comment:6 by viboes, 12 years ago

Replying to fatman@…:

Ok, I've run the same command with -d2 at the end:

bjam.exe toolset=gcc stage --build-type=complete --with-thread -d2 >thread.log.d2.txt

When I add -E to the command line, I get "Invalid option: -E". Are you thinking about a different command?

Could you try

    "g++"  -ftemplate-depth-128 -O0 -fno-inline -Wall -g -mthreads -Wno-long-long -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1  -I"." -E -o "bin.v2\libs\thread\build\gcc-mingw-4.5.2\debug\threading-multi\win32\thread.o" "libs\thread\src\win32\thread.cpp"

and check where the first error occurs?

comment:7 by Sebastian Held <sebastian.held@…>, 12 years ago

Cc: sebastian.held@… added

comment:8 by fatman@…, 12 years ago

Apologies for the delay in replying. I have been away.

I will try your suggestion as soon as I get home from work.

comment:9 by fatman@…, 12 years ago

My build environment has changed slightly. Now:

> g++ --version
g++ (GCC) 4.4.5 20101001 (release) [svn/rev.164871 - mingw-w64/oz]

and I'm using Boost 1.40, and I've generated some new output with the command:

bjam.exe toolset=gcc stage --build-type=complete --with-thread >thread.log.txt

which I will attach.

Vicente, I've altered your command slightly to reflect the change of compiler version.

g++ -ftemplate-depth-128 -O0 -fno-inline -Wall -g -mthreads -Wno-long-long DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1 -I"." -E -o "bin.v2\libs\thread\build\gcc-mingw-4.4.5\debug\threading-multi\win32\thread.o" "libs\thread\src\win32\thread.cpp"

It returns with no output. boost_thread still won't build, though.

by fatman@…, 12 years ago

Attachment: thread.log.2.txt added

New output from altered environment

comment:10 by Jim Bell <jim@…>, 12 years ago

As a point of reference, boost.thread builds for my MinGW-64 boost regression test. See the trunk regression matrix, column "Win7-x64 jc-bell.com" (current as of 2011-04-01).

Also see patches here: http://lists.boost.org/boost-users/2010/12/65214.php

comment:11 by Jim Bell <jim@…>, 12 years ago

Cc: jim@… added

comment:12 by fatman@…, 12 years ago

Thanks Jim, most interesting, although I find the huge tables of test results a bit overwhelming. Some bedtime reading there for sure.

In reference to your comment in the patches thread that bootstrap.bat needs hacking to work with gcc, I found I was able to build a native bjam.exe by running tools/jam/build.bat (path?) myself, and IIRC I just had to set the toolchain to gcc in build.bat. Hope that's of use to you.

comment:13 by Jim Bell <jim@…>, 12 years ago

Milestone: To Be DeterminedBoost 1.46.0
Version: Boost 1.44.0Boost Development Trunk

I'm updating the milestone & version on this so that it gets picked up for the 1.46 release. Sadly, though it's marked "showstopper," being marked "Milestone: TBD" and/or "Version: 1.44", it gets missed by the release managers. (Follow the thread back from <http://lists.boost.org/Archives/boost/2010/10/172431.php>.)

comment:14 by fatman@…, 12 years ago

Ah. Hm. I marked the bug as "showstopper" because I am unable to use boost_thread if it won't compile. Was that wrong?

comment:15 by fatman@…, 12 years ago

Severity: ShowstopperProblem

This is a useful page. -> https://svn.boost.org/trac/boost/wiki/TicketWorkflow

Now I can see I set the bug severity way too high. I'll reset it to "problem" since I have no idea if it's a regression or not.

comment:16 by Jim Bell <jim@…>, 12 years ago

My regression test promotes it to regression, IMO, once my regression gets running on a regular schedule.

And I don't think showstopper is way too high myself. I think 1.46 is going to ship without it, but if I can get my regression-testing act together on this, I say we promote it to showstopper then.

This is an important platform and compiler.

comment:17 by fatman@…, 12 years ago

Severity: ProblemShowstopper

Good points. Back to "showstopper" then.

comment:18 by mikko.vainio@…, 11 years ago

I'm seeing this bug in the release branch but not in trunk r72431. Will the changes in trunk be merged to release for 1.47.0?

comment:19 by fatman@…, 11 years ago

Hmm. Well, I hope they fix this some day - guess I'll have to abandon Boost for now. :(

comment:20 by fatman@…, 11 years ago

I had a last-ditch poke around in Boost's internals and it looks like I found a workaround. :D

Thanks to the OP on bug 4804 for the clue.

Applying this patch to boost/detail/interlocked.hpp allows Boost.Thread to build (hopefully not breaking something else):

9a10,11
> #define BOOST_USE_WINDOWS_H 1
>

Obviously this is not a proper fix; I'm guessing it breaks Boost.Thread on other platforms than Windows. It can be applied to Windows x64 build environments individually.

Glad I don't have to ditch Boost after all. :)

in reply to:  20 comment:21 by viboes, 11 years ago

Replying to fatman@…:

I had a last-ditch poke around in Boost's internals and it looks like I found a workaround. :D

Thanks to the OP on bug 4804 for the clue.

Applying this patch to boost/detail/interlocked.hpp allows Boost.Thread to build (hopefully not breaking something else):

9a10,11
> #define BOOST_USE_WINDOWS_H 1
>

Obviously this is not a proper fix; I'm guessing it breaks Boost.Thread on other platforms than Windows. It can be applied to Windows x64 build environments individually.

Glad I don't have to ditch Boost after all. :)

I don't know if that helps you, you can define BOOST_USE_WINDOWS_H directly on the command line.

comment:22 by viboes, 11 years ago

Keywords: 64 interlocked added

comment:23 by jim@…, 11 years ago

Note that I've been running the boost regression tests on MinGW-w64, Windows 7 x64 for the last couple months, and thread builds fine (passes its regressions), for gcc 4.7, 4.6, 4.5 and 4.4 (besides the tss issue). See http://www.boost.org/development/tests/release/developer/thread.html. So I'm pretty sure these issues are cleared up. Anyone disagree?

comment:24 by viboes, 11 years ago

Milestone: Boost 1.46.0
Resolution: worksforme
Status: newclosed

Closed as no one disagree :)

comment:25 by kalast@…, 11 years ago

Hi, using this https://sourceforge.net/projects/mingwbuilds/files/windows-host/4.7.0/ build results in the same errors for thread unfortunately. Will test latest release to see if it's fixed.

comment:26 by kalast@…, 11 years ago

Hello again, looks like 1.49 works correctly, sorry for the noise.

Note: See TracTickets for help on using tickets.