问题
At first I tried to build Boost having both MinGW and Microsoft Visual C++ installed, with these commands:
bootstrap.bat mingw
.\b2
During the build process, I got plenty of log lines indicating that the build was being done for Visual C++ (msvc). So I stopped it, I completely uninstalled Visual C++ (using the Windows utility), I removed the Boost directory, I recreated it from the bz2 file, I checked that g++.exe
was in the PATH, and I re-entered the previous two commands to reinstall Boost from scratch.
I keep getting an msvc build... Is there anything else I can do?
Windows console
From the logs, it seems that no configuration is selected:
> .\b2
Building the Boost C++ Libraries.
Performing configuration checks
- 32-bit : no (cached)
- 64-bit : no (cached)
- arm : no (cached)
- mips1 : no (cached)
- power : no (cached)
- sparc : no (cached)
- x86 : no (cached)
- has_icu builds : no (cached)
MinGW console
$ ./bootstrap.sh
###
### Using 'gcc' toolset.
###
rm -rf bootstrap
mkdir bootstrap
gcc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c pathunix.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
builtins.c:34:23: fatal error: sys/wait.h: No such file or directory
compilation terminated.
execunix.c:20:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
fileunix.c:96:17: fatal error: ar.h: No such file or directory
compilation terminated.
These files are effectively missing. Shouldn't they be part of MinGW?
回答1:
Build boost with mingw
open windows cmd
cd
to your boost_1_53_0
folder.
To get a clean path environment
type (change to your mingw path)
set PATH=C:\mingw\bin
to test : type
path
output : PATH=C:\mingw\bin
type
bootstrap mingw
After bootstrap has finished,
then change following command to fit your needs.
type
.\b2 --build-dir=C:\boost-mingw toolset=gcc variant=debug link=shared runtime-link=shared
There are other ways to build boost. But above steps should be enough.
来源:https://stackoverflow.com/questions/17883274/cannot-build-boost-with-mingw-it-looks-for-visual-c