在Windows下,针对Android的boost编译失败

时间:2016-07-17 10:42:39

标签: android c++ windows boost cygwin

我正在尝试使用Cygwin和/或cmd在Windows下为Android编译一些Boost库。

我按照此处显示的说明操作:http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html

设置必要的环境变量之后:

//At first I tried with cmd
set NDK_ROOT=C:\android-ndk-r12b
set TOOLCHAIN_PATH=C:\android-ndk-r12b\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64
set PATH=%PATH%;C:\boost_build\bin;%TOOLCHAIN_PATH%\bin
set NO_BZIP2=1

//I also tried with cygwin
TOOLCHAIN_PATH=/cygdrive/c/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/
NDK_ROOT=/cygdrive/c/android-ndk-r12b/
PATH=$PATH:/cygdrive/c/boost_build/bin:/cygdrive/c/android-ndk-r12b/:$TOOLCHAIN_PATH/bin
NO_BZIP2=1

现在我用这些参数启动b2:

b2 --build-dir=C:\boost_builded toolset=gcc link=static threading=multi --with-system --with-date_time --with-random stage

我收到了这些错误:

//The errors are the same both in cmd and in cygwin
...patience...
...found 1014 targets...
...updating 18 targets...
gcc.archive C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_date_time-gcc54-mt-d-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_date_time-gcc54-mt-d-1_61.a" "C:\boost_builded\boost\b
in.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\gregorian\greg_month.o" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\gregorian
\greg_weekday.o" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\gregorian\date_generators.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_date_time-gcc54-mt-d-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_date_time-gcc54-mt-d-1_61.a...
...skipped <pstage\lib>libboost_date_time-gcc54-mt-d-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\debug\link-static\threading-multi>libboost_date_time-gcc54-mt-d-1
_61.a...
gcc.archive C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_system-gcc54-mt-d-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_system-gcc54-mt-d-1_61.a" "C:\boost_builded\boost\bin.v2\
libs\system\build\gcc-5.4.0\debug\link-static\threading-multi\error_code.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_system-gcc54-mt-d-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_system-gcc54-mt-d-1_61.a...
...skipped <pstage\lib>libboost_system-gcc54-mt-d-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\debug\link-static\threading-multi>libboost_system-gcc54-mt-d-1_61.a...
gcc.archive C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_random-gcc54-mt-d-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_random-gcc54-mt-d-1_61.a" "C:\boost_builded\boost\bin.v2\
libs\random\build\gcc-5.4.0\debug\link-static\threading-multi\random_device.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_random-gcc54-mt-d-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\debug\link-static\threading-multi\libboost_random-gcc54-mt-d-1_61.a...
...skipped <pstage\lib>libboost_random-gcc54-mt-d-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\debug\link-static\threading-multi>libboost_random-gcc54-mt-d-1_61.a...
gcc.archive C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\libboost_date_time-gcc54-mt-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\libboost_date_time-gcc54-mt-1_61.a" "C:\boost_builded\boost\b
in.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\gregorian\greg_month.o" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\grego
rian\greg_weekday.o" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\gregorian\date_generators.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\libboost_date_time-gcc54-mt-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi\libboost_date_time-gcc54-mt-1_61.a...
...skipped <pstage\lib>libboost_date_time-gcc54-mt-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\date_time\build\gcc-5.4.0\release\link-static\threading-multi>libboost_date_time-gcc54-mt-1_6
1.a...
gcc.archive C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\release\link-static\threading-multi\libboost_system-gcc54-mt-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\release\link-static\threading-multi\libboost_system-gcc54-mt-1_61.a" "C:\boost_builded\boost\bin.v2\
libs\system\build\gcc-5.4.0\release\link-static\threading-multi\error_code.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\release\link-static\threading-multi\libboost_system-gcc54-mt-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\release\link-static\threading-multi\libboost_system-gcc54-mt-1_61.a...
...skipped <pstage\lib>libboost_system-gcc54-mt-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\system\build\gcc-5.4.0\release\link-static\threading-multi>libboost_system-gcc54-mt-1_61.a...
gcc.archive C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\release\link-static\threading-multi\libboost_random-gcc54-mt-1_61.a
The system cannot find the path specified.
The system cannot find the path specified.

    "\usr\i686-pc-cygwin\bin\ar.exe"  rc "C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\release\link-static\threading-multi\libboost_random-gcc54-mt-1_61.a" "C:\boost_builded\boost\bin.v2\
libs\random\build\gcc-5.4.0\release\link-static\threading-multi\random_device.o"
    "\usr\i686-pc-cygwin\bin\ranlib.exe" "C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\release\link-static\threading-multi\libboost_random-gcc54-mt-1_61.a"

...failed gcc.archive C:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\release\link-static\threading-multi\libboost_random-gcc54-mt-1_61.a...
...skipped <pstage\lib>libboost_random-gcc54-mt-1_61.a for lack of <pC:\boost_builded\boost\bin.v2\libs\random\build\gcc-5.4.0\release\link-static\threading-multi>libboost_random-gcc54-mt-1_61.a...
...failed updating 6 targets...
...skipped 6 targets...
...updated 6 targets...

我甚至不确定他找不到什么样的路。我认为它正在寻找“\ usr \ i686-pc-cygwin \ bin \ ar.exe”,因为其他路径似乎正确且存在;但我认为它正在寻找“\”,好像它是linux系统的根,而不是在cygwin的子目录中。

我该如何纠正?

1 个答案:

答案 0 :(得分:0)

....一如既往,为我发布StackOverflow是一种宣泄。把我的头撞到墙上几个小时后,我在这里发布了问题,然后我在5分钟内找到了解决方案。

我会在这里留下解决方案,以防将来对其他人有用。

我的猜测是正确的。他在错误的地方寻找\usr\i686-pc-cygwin\bin\ar.exe。所以我真的从根C:\cygwin\usr\i686-pc-cygwin\复制了来自cygwin root C:\usr\i686-pc-cygwin的文件夹。它奏效了。

可能是一个b2错误,我会尝试发出信号。