nme haxe, unable to build on android platform with flashdevelop - android

I'm just getting to know nme haxe developing, I'm currently using flashdevelop. I have a problem when building a sample app (piratepig) under android platform. Lots of "no such file or directory". Everything seems fine when I choose windows, Html5, or flash platforms.
Here's the output:
Running process: C:\Program Files (x86)\FlashDevelop\Tools\fdbuild\fdbuild.exe "C:\Users\Valentin\Desktop\PiratePig\Pirate Pig.hxproj" -ipc 2a666e48-3f38-4abd-b63a-25219cb72cf4 -version "2.10" -compiler "C:\Motion-Twin\Haxe" -library "C:\Program Files (x86)\FlashDevelop\Library" -target "android"
Building Pirate Pig
haxelib run nme build C:\Users\Valentin\Desktop\PiratePig\project.nmml android -debug
haxelib run hxcpp Build.xml haxe -Ddebug -Dactuate -Dandroid -Dcpp -Ddebug -Dhaxe_208 -Dhaxe_209 -Dhaxe_210 -Dmobile -Dnme -Dnme_install_tool -Dsys -Dtrue
Creating hxcpp.h.gch...
arm-linux-androideabi-g++ -Iinclude --sysroot=C:\Development\Android NDK/platforms/android-5/arch-arm -IC:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/include -IC:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -Dhaxe_210 -IC:\Motion-Twin\Haxe\lib\hxcpp\2,10//include -Iinclude -fpic -fvisibility=hidden -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -D_LINUX_STDDEF_H -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer -fexceptions -fno-strict-aliasing -finline-limit=10000 -DANDROID -Wa,--noexecstack -O0 -DNDEBUG -c -frtti -o hxcpp.h.gch C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h:13:20: error: typeinfo: No such file or directory
In file included from C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h:170:
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/Array.h:195:21: error: algorithm: No such file or directory
In file included from C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h:162:
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hx/Object.h: In member function 'void hx::ObjectPtr<O>::CastPtr(hx::Object*)':
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hx/Object.h:143: error: must #include <typeinfo> before using typeid
In file included from C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h:170:
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/Array.h: In member function 'void Array_obj<ELEM_>::sort(Dynamic)':
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/Array.h:388: error: 'sort' is not a member of 'std'
In file included from C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/hxcpp.h:171:
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/Class.h: In function 'bool hx::TCanCast(hx::Object*)':
C:\Motion-Twin\Haxe\lib\hxcpp\2,10//include/Class.h:139: error: must #include <typeinfo> before using typeid
Called from ? line 1
Called from BuildTool.hx line 1265
Called from BuildTool.hx line 554
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 739
Called from BuildTool.hx line 153
Uncaught exception - Error creating pch: 1 - build cancelled
Error : Build failed
Build halted with errors (haxelib.exe).
Done(1)
Does anyone have a clue, what could be wrong? I tried running a simple helloworld app in eclipse (so that i can be sure that its related to haxe, and nme), but the helloword app works perfectly.

did you use NME 3.5.3 or higher?
then you need to switch to hxcpp 2.10.3 . it will solve the problem. try to update the hxcpp through haxelib with this command
haxelib upgrade

The problem was solved a long time ago, through some hit on google. I cant find it now, but it was something about the NDK directory, i had to move or copy some files in the structure.
It might have been something like this
As far as I remember it was something similar to this (answer posted by Andy on openfl):
Copy the files from
${ANDROID_NDK_ROOT}\sources\cxx-stl\gnu-libstdc++\4.4.3\ to
${ANDROID_NDK_ROOT}\sources\cxx-stl\gnu-libstdc++\
Here's the link to his answer, and some similar questions above:
http://www.openfl.org/developer/forums/installing-openfl/beginner-questions-android-build-failed/

Related

android studio 3.2 initial build error (testCCompiler.c file not found, windows 10)

today I installed android studio 3.2.1 on my windows 10 PC at home.
(I have installed a previous version 3 months ago but I unstalled it before installing new one, because it had similar problem I remember)
When I install the program, it is supposed to build itself but it fails with below messages.
Run Build Command:"C:/Users/Chan
Kim/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_4535f"
[1/2] Building C object CMakeFiles/cmTC_4535f.dir/testCCompiler.c.o
FAILED:
C:\Users\CHANKI~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe
--target=armv7-none-linux-androideabi24 --gcc-toolchain="C:/Users/Chan
Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"
--sysroot="C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot"
-isystem C:/Users/Chan
Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -fPIE
-o CMakeFiles/cmTC_4535f.dir/testCCompiler.c.o -c
C:\ANDPRG\app\.externalNativeBuild\cmake\release\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c
error: no such file or directory:
'Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
-- Configuring incomplete, errors occurred!
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log".
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeError.log".
Build command failed.
Error while executing process C:\Users\Chan Kim\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\ANDPRG\app -BC:\ANDPRG\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-24 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\ANDPRG\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Chan Kim\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=C:\Users\Chan Kim\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Chan Kim\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
-- Check for working C compiler: C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken
It fails with the following output:
Change Dir: C:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeTmp
Run Build Command:"C:/Users/Chan
Kim/AppData/Local/Android/Sdk/cmake/3.6.4111459/bin/ninja.exe" "cmTC_23398"
[1/2] Building C object CMakeFiles/cmTC_23398.dir/testCCompiler.c.o
FAILED:
C:\Users\CHANKI~1\AppData\Local\Android\Sdk\NDK-BU~1\TOOLCH~1\llvm\prebuilt\WINDOW~1\bin\clang.exe
--target=armv7-none-linux-androideabi24 --gcc-toolchain="C:/Users/Chan
Kim/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64"
--sysroot="C:/Users/Chan Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot"
-isystem C:/Users/Chan
Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
-mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -fPIE
-o CMakeFiles/cmTC_23398.dir/testCCompiler.c.o -c
C:\ANDPRG\app\.externalNativeBuild\cmake\debug\armeabi-v7a\CMakeFiles\CMakeTmp\testCCompiler.c
error: no such file or directory:
'Kim/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi'
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt
-- Configuring incomplete, errors occurred!
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
See also "C:/ANDPRG/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeError.log".
I saw similar question on SO but it's not exactly same to my situtation and I tried the suggestions(Refresh linked C++ project) and it didn't work. and some advices are for linux. The first error message is 'can't find cCompilerProgram.c' for cmake.(When I look into the folder, the file is not actuall there) How can I solve this? By the way, my login name on windows 10 is 'Chan Kim' with space in the middle. Can it have any problem? I guess the testCCompiler.c file is what the build process make during the build.
Any suggestion will be deeply appreciated.
the error actually reads:
-- Check for working C compiler: .../prebuilt/windows-x86_64/bin/clang.exe -- broken
this seems related.
My problem was that my login name in windows10 was 'Chan Kim' and the error log shows it cannot parse down the folder name containing 'Chan Kim' and it cannot process space in the folder name. So I created a new account 'ckim' and did the same (it downloads huge amount of data under C:\Users\ckim this time) and everything works fine.
So DON'T USE USERNAME WITH SPACE whne using android studio. (I don't know why the book and android studio doesn't warn about this situtation. I read in the book, if my login name contains Korean characters, it won't work. but it turns out login name with space doesn't work either).
Hope this be useful for someone.
ADD : I tried configuring the SDK again using Users\ChanKim\AppData folder and it works too. (originally it was using Users\Chan Kim\AppData)

How to build boost for android as shared library with c++11 support

I am trying to build boost_1.60.0 (as shared library) for android with c++11 support. I am using the latest ndk (currently android-ndk-r10e). The build host is Windows-10.
This is for a non-opensource project. So as far as I understand I cannot use gnustl_shared, and I need to use c++_shared as the android c++ runtime.
my project-config.jam looks like this:
androidNDKRoot = c:/android-ndk-r10e ;
using gcc : android :
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ :
<root>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/
<compileflags>-MMD
<compileflags>-MP
<compileflags>-MF
<compileflags>-fpic
<compileflags>-ffunction-sections
<compileflags>-funwind-tables
<compileflags>-fstack-protector
<compileflags>-no-canonical-prefixes
<compileflags>-march=armv5te
<compileflags>-mtune=xscale
<compileflags>-msoft-float
<compileflags>-fno-rtti
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-g
<compileflags>-DNDEBUG
<compileflags>-fomit-frame-pointer
<compileflags>-fno-strict-aliasing
<compileflags>-finline-limit=64
<compileflags>-IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include
<compileflags>-IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/include
<compileflags>-IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/../../android/support/include
<compileflags>-IC:/android-ndk-r10e/platforms/android-9/arch-arm/usr/include
<compileflags>-Wa,--noexecstack
<compileflags>-Wformat
<compileflags>-Werror=format-security
<compileflags>-DUNIX
<compileflags>-DANDROID
<compileflags>-Wl,--no-undefined
<cxxflags>-fexceptions
<linkflags>-lc++_shared
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar
<ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ranlib
;
the build command is:
b2 --toolset=gcc-android cxxflags="-std=c++11 " --prefix=..\boost_android_arm --builddir=./boost_android_arm/builddir target-os=linux --with-filesystem define=BOOST_FILESYSTEM_VERSION=3 link=shared runtime-link=shared threading=multi
In order to determine the parameters in the project-config.jam I've build a sample shared library using the ndk-build, get its debug messages, and extracted the compile and link commands it uses.
compile:
C:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe,C:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/someLib/./Unity1.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Ijni/../../library/../../../../ -Ijni/../../library/../../../../src/ -IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include -IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/include -IC:/android-ndk-r10e/sources/cxx-stl/llvm-libc++/../../android/support/include -Ijni/../../library -DANDROID -DHAVE_CONFIG_H -DSESTEK_ANDROID_XERCES_HACK -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fno-strict-aliasing -frtti -fexceptions -DUNIX -DANDROID -IC:/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -c jni/../../library/./Unity1.cpp -o ./obj/local/armeabi/objs/someLib/./Unity1.o,...)
link:
C:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.8\prebuilt\windows-x86_64\bin\arm-linux-androideabi-g++.exe,C:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libsomeLib.so -shared --sysroot=C:/android-ndk-r10e/platforms/android-9/arch-arm ./obj/local/armeabi/objs/someLib/./Unity1.o -lgcc ./obj/local/armeabi/libc++_shared.so -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -mthumb -lc -lm -o ./obj/local/armeabi/libsomeLib.so,...)
For brevity I've only build filesystem for this trial but in the end I plan to build at least thread, filesystem, date_time, asio and log libraries.
Finally the error I get is as follows.
...patience...
...found 660 targets...
...updating 13 targets...
gcc.compile.c++ bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\error_code.o
gcc.link.dll bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\libboost_system-gcc-mt-1_60.so.1.60.0
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot open crtbegin_so.o: No such file or directory
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lrt
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot open crtend_so.o: No such file or directory
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lc++_shared
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lstdc++
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lm
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -ldl
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lc
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\error_code.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\error_code.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\error_code.o: requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC
./boost/system/detail/error_code.ipp:458: error: undefined reference to '__dso_handle'
./boost/system/detail/error_code.ipp:464: error: undefined reference to '__dso_handle'
./boost/system/detail/error_code.ipp:158: error: undefined reference to '__dso_handle'
collect2.exe: error: ld returned 1 exit status
"c:/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++" -o "bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\libboost_system-gcc-mt-1_60.so.1.60.0" -shared -Wl,--start-group "bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\error_code.o" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -lc++_shared -pthread
...failed gcc.link.dll bin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi\libboost_system-gcc-mt-1_60.so.1.60.0...
...skipped <pstage\lib>libboost_system-gcc-mt-1_60.so.1.60.0 for lack of <pbin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi>libboost_system-gcc-mt-1_60.so.1.60.0...
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\codecvt_error_category.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\operations.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\path.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\path_traits.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\portability.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\unique_path.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\utf8_codecvt_facet.o
gcc.compile.c++ bin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi\windows_file_codecvt.o
...skipped <pbin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi>libboost_filesystem-gcc-mt-1_60.so.1.60.0 for lack of <pbin.v2\libs\system\build\gcc-android\release\target-os-linux\threading-multi>libboost_system-gcc-mt-1_60.so.1.60.0...
...skipped <pstage\lib>libboost_filesystem-gcc-mt-1_60.so.1.60.0 for lack of <pbin.v2\libs\filesystem\build\gcc-android\release\target-os-linux\threading-multi>libboost_filesystem-gcc-mt-1_60.so.1.60.0...
...failed updating 1 target...
...skipped 3 targets...
...updated 9 targets...
The error tells that it needs the directory to find the necessary libraries, but the problem is that under android ndk there are several files with names rt and crtbegin_so.o and such. I guess I need to make the compiler determine the correct directory itself.
With all being said what I need actually is to build boost shared libraries for android with c++11 support. So I may accept your help either by pointing me in the right direction using the above build parameters or providing me a working sample so I can work out the details myself.
Oh also one more thing: if I use link=static instead of link=shared in the build command the build succeeds. But I have not tried the produced static libraries.
Building Boost on Linux using the NDK
I know you're asking about Windows, but I wanted to do this on macOS and it failed with nearly the exact error. I finally broke down and did it on my linode server it worked without a problem. This says to me that they aren't really doing a good job of testing other platforms. Compiling static only on macOS works as you also discovered on Windows.
Point of reference
NDK R13
Boost 1.62.0
Tested with clang++; g++ also works
If you're wondering why I'm using clang, the Release Notes have the following message:
GCC is no longer supported. It will not be removed from the NDK just
yet, but is no longer receiving backports. It cannot be removed until
after libc++ has become stable enough to be the default, as some parts
of gnustl are still incompatible with Clang. It will likely be removed
after that point.
user-config.jam
I placed this file in my home directory. Yuck.
androidNDKRoot = /path/to/ndk-R13-standalone ;
using clang : android
:
$(androidNDKRoot)/bin/arm-linux-androideabi-clang++
:
;
Modifying libtool.m4 in boost to avoid versioning of the libraries
libtool.m4 under tools/build/src/engine/boehm_gc/libtool.m4 in the boost source has no reference to android and you'll need to change version_type=linux in the section linux*) to version_type=none. This will cause symbolic links to appear without the version number appended to the end linked to the versioned shared libraries in the output.
Building
Target OS MUST be android to avoid the -lrt flag being passed which will cause shared linking to fail.
./b2 \
-d+2 \
-j 4 \
--reconfigure \
target-os=android \
toolset=clang-android \
include=${ANDROID_NDK_STANDALONE}/include/c++/4.9.x \
link=static,shared \
variant=debug,release \
threading=multi \
--layout=versioned \
--prefix=${BOOST_INSTALL_DIR} \
install
A relevant information is here (Boost for Android), where they have been able to successfully build the shared libraries, but it seems that the resulting files have a version suffix which android can't handle. Also one can't just rename the binary because the file name is hardcoded in it. One way out, as per the last post, is to set the variable version_type to none (version_type=none) in the linux section of file. In your case, the build setup could be a little different, but it may be worthwhile to take a look at the changes they made at that discussion.
user-config.jam
If you want to find boost from cmake(find_package) you must use the version of compiler, and not android like the top answer, in your user-config.jam like below according to boost doc.
androidNDKRoot = /path/to/ndk-R13-standalone ;
using clang : 8.0.1
:
$(androidNDKRoot)/bin/arm-linux-androideabi-clang++
:
;
My answer for me in future. How to build latest Boost(1.79.0) with latest NDK(24.0) on Windows PC for Android.
Go to your downloaded boost_1_79_0 unpacked directory and build b2 tool:
.\bootstrap.bat
Check b2 tools is ready:
b2 --version
B2 4.8-git <-- possible output
create file user-config.jam in %HOME% directory with content like that(example):
using clang : arm64 : c\:/Users/l_chayka/Downloads/android-ndk-r24/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android21-clang++.cmd : <cxxflags>-std=c++20 ;
using clang : arm : c\:/Users/l_chayka/Downloads/android-ndk-r24/toolchains/llvm/prebuilt/windows-x86_64/bin/armv7a-linux-androideabi21-clang++.cmd : <cxxflags>-std=c++20 ;
using clang : x86 : c\:/Users/l_chayka/Downloads/android-ndk-r24/toolchains/llvm/prebuilt/windows-x86_64/bin/i686-linux-android21-clang++.cmd : <cxxflags>-std=c++20 ;
using clang : x86_64 : c\:/Users/l_chayka/Downloads/android-ndk-r24/toolchains/llvm/prebuilt/windows-x86_64/bin/x86_64-linux-android21-clang++.cmd : <cxxflags>-std=c++20 ;
Go to boost root and try to build for every Android architecture (arm, arm64, x86, x86_64) example:
c:\Users\l_chayka\Downloads\boost_1_79_0>b2.exe toolset=clang-x86_64 target-os=android link=static variant=debug threading=multi --layout=versioned --prefix=c:/boost-x64_86/ install
c:\Users\l_chayka\Downloads\boost_1_79_0>b2.exe toolset=clang-x86 target-os=android link=static variant=debug threading=multi --layout=versioned --prefix=c:/boost-x86/ install
c:\Users\l_chayka\Downloads\boost_1_79_0>b2.exe toolset=clang-arm target-os=android link=static variant=debug threading=multi --layout=versioned --prefix=c:/boost-arm/ install
c:\Users\l_chayka\Downloads\boost_1_79_0>b2.exe toolset=clang-arm64 target-os=android link=static variant=debug threading=multi --layout=versioned --prefix=c:/boost-arm64/ install
Now check you instalation prefix path.

newlib.h: No such file or directory in ffmpeg

I am getting this error
/AppData/Local/Temp/ffconf.dkWUWsGo.c:1:20: fatal error: newlib.h: No such file or directory
#include <newlib.h>
while compiling for ffmpeg.
check_cpp_condition newlib.h defined _NEWLIB_VERSION check_cpp BEGIN
/tmp/ffconf.dkWUWsGo.c
1 #include
2 #if !(defined _NEWLIB_VERSION)
3 #error "unsatisfied condition: defined _NEWLIB_VERSION"
4 #endif END /tmp/ffconf.dkWUWsGo.c D:/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gcc
--sysroot=D:/android-ndk-r10b/platforms/android-8/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a -march=armv7-a -std=c99 -E -o /tmp/ffconf.BMIcTDua.o /tmp/ffconf.dkWUWsGo.c C:/Users/vmewada/AppData/Local/Temp/ffconf.dkWUWsGo.c:1:20: fatal
error: newlib.h: No such file or directory #include
^ compilation terminated.
From the path you provided, I guess the file is not present there anymore, because the Temp folder is used for temporary files. Probably you opened an archive (.zip, .rar, .tar, .jar), and after you closed it, the temporary files were deleted. Extract the files to a permanent directory from where you can use them.
As far as I understand from the error log you are trying to cross compile FFmpeg for Android, but I am not sure if Android NDK has a prebuilt newlib version shipped with it. You could check the corresponding platform directory in NDK if it has the include or library, but my assumption is that you will have to build newlib for ARM before you can do this. Btw - last time I compiled FFmpeg for Android I didn't have the issues you got - are you using a correct target? Maybe the newlib is imported because of a wrong architecture.

/usr/include/machine/types.h:37:10: fatal error: 'arm/types.h' file not found

I have spent half a day killing the error. I'm really bored and teared.
The project is converting iPhone App to Android apk by Stella SDK.
The IDE is xCode 4.6.
CompileC build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.o main.m normal x86_64 objective-c com.yeecco.compilers.android.clang.1.0
cd /Users/anna/samples/GLSprite
setenv LANG en_US.US-ASCII
/opt/StellaSDK/bin/android-clang -x objective-c -arch x86_64 -fmessage-length=0 -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wformat -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-enum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mmacosx-version-min=10.8 -g -Wno-sign-conversion -I/Users/anna/samples/GLSprite/build-arm-google-android/Debug/include -I/opt/StellaSDK/arm-google-android/usr/include -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/cocos2d.framework/Headers -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaMedia.framework/Headers -I/opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaStore.framework/Headers -I/Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/DerivedSources/x86_64 -I/Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/DerivedSources -F/Users/anna/samples/GLSprite/build-arm-google-android/Debug -F/opt/StellaSDK/arm-google-android/System/Library/Frameworks -stella_target arm-google-android -D__STELLA_NANDROID -D__STELLA_VERSION_MAX_ALLOWED -MMD -MT dependencies -MF /Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.d -c /Users/anna/samples/GLSprite/main.m -o /Users/anna/samples/GLSprite/build-arm-google-android/GLSprite-android.build/Debug/GLSprite.build/Objects-normal/x86_64/main.o
warning: unknown warning option '-Wreceiver-is-weak' [-Wunknown-warning-option]
warning: unknown warning option '-Wint-conversion' [-Wunknown-warning-option]
warning: unknown warning option '-Wenum-conversion' [-Wunknown-warning-option]
In file included from /Users/anna/samples/GLSprite/main.m:49:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:17:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaKit.framework/Headers/StellaKit.h:7:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/StellaKit.framework/Headers/SVAcceleration.h:5:
In file included from /opt/StellaSDK/arm-google-android/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:11:
In file included from /usr/include/sys/types.h:78:
/usr/include/machine/types.h:37:10: fatal error: 'arm/types.h' file not found
#include "arm/types.h"
^
3 warnings and 1 error generated.
Command /opt/StellaSDK/bin/android-clang failed with exit code 1
The error message is shown because the compiler is looking for types.h in arm folder. If you could provide the file, the compiler will not show this error and continue. Check the documentation of StellaSDK, they should have a "guide" on how to cross compile

Android ndk-r8 "error trying to exec 'cc1plus': execvp: No such file or directory"

I am trying to use the Android NDK on Mountain Lion to build a library for Android, following this guide
http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/
When it comes time to compile the library, I run:
cd <path to jni>
<ndk>/ndk-build
I get the following error:
Compile++ thumb : echoprint-jni <= AndroidCodegen.cpp
arm-linux-androideabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
I believe I have added everything I need to to my path variable:
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Developer/android-sdk/tools:/Developer/android-sdk/platform-tools:/Developer/android-ndk:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
What else do I need to do in order to get this to compile? I am using the r8b NDK currently, but have tried it with versions all the way back to 6.
EDIT:
I tried this solution: Error while building android ndk sample project
adding
export PATH=$PATH:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2
to my path gets me this error:
cc1plus: error: unrecognized command line option "-mbionic"
cc1plus: error: unrecognized command line option "-mthumb"
cc1plus: error: unrecognized command line option "-mfpu=vfp"
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (armv5te) for -march= switch
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (xscale) for -mtune= switch
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
but adding
export CROSS_COMPILER=$PATH:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
doesn't help, like it did in the link above.
I have experienced same error.
I was not able to execute even 'gcc, g++' command. So I have googled a lot to find solution, but nothing helped for me.
Then, I found that some filename in ndk is not correct, with tailing _ on some filename.. (In my case, in toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/bin folder, there are gcc_, g++_, c++_ instead of gcc, g++, c++.)
I used The unarchiver to extract NDK archive, so I think there are something wrong with unarchiving procedure.
So I re-downloaded NDK and checked MD5 checksum, then extracted archive using Mac's default archive utility.
Now, the problem has solved.
Sounds like you have a bad download/unpack of the NDK. The cc1plus binary that it's looking for should be in $NDK_HOME/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/libexec/gcc/arm-linux-androideabi/4.4.3/. If it's not there, try re-downloading the SDK and/or unpacking it again.
If it is there, be sure to build passing V=1 to ndk-build, and see if there are any odd -B options passed to the compiler. The -B option tells gcc where to find its "sub-programs" (of which cc1plus is one). Pretty sure there shouldn't be any on the command lines for r8, so if there are, something somewhere is passing bad flags. For example, on my system, a C++ NDK command line ends up looking something like this:
/opt/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi-v7a/objs/sometarget/SomeCppFile.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-exceptions -fno-rtti -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I/opt/android-ndk/sources/cxx-stl/stlport/stlport -I/opt/android-ndk/sources/cxx-stl//gabi++/include -DANDROID -Wall -Wa,--noexecstack -frtti -O2 -DNDEBUG -g -I/opt/android-ndk/platforms/android-8/arch-arm/usr/include -c jni/SomeCppFile.cpp -o ./obj/local/armeabi-v7a/objs/sometarget/SomeCppFile.o
Maybe you need to install the g++:
$sudo apt-get install g++
I have spent about a day to find root cause of this
arm-linux-androideabi-gcc: error trying to exec 'cc1': execvp: No such file...
and others issues.
The issues were that I unpacked NDK and SDK with 7z which removed executable permission for all binaries and Eclipse was not able to start cc1.
Once I unpacked tar files of SDK and NDK using tar, everything started working well.

Categories

Resources