Search code examples
androidc++windowsboostcygwin

boost compile for Android fails under windows


I'm trying to compile some Boost libraries for Android, under Windows, using Cygwin and/or cmd.

I followed the instructions shown here: http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html

After I set the necessary environment variables:

//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

And now I'm launching b2 with these parameters:

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

And I'm getting these errors:

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

I'm not even sure what path he's not finding. I think it's looking for "\usr\i686-pc-cygwin\bin\ar.exe" because the other paths seem correct and existing; but I think it's looking for "\" as if it is the root of a linux system, instead of in the subdirectory of cygwin.

How can I correct?


Solution

  • ....as always, posting to StackOverflow for me is cathartic. After smashing my head to the wall for hours, I post the problem here and then I find the solution in 5 minutes.

    I'll leave the solution here in case it could be useful to someone else in the future.

    My guess was right. He was looking for \usr\i686-pc-cygwin\bin\ar.exe in the wrong place. So I literally copied the folder from cygwin root C:\cygwin\usr\i686-pc-cygwin\ in the root, C:\usr\i686-pc-cygwin. It worked.

    Probably a b2 bug, I will try to signal that.