Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'to_string' is not a member of 'std' while cross compile with android-ndk-11c #65

Closed
zazd opened this issue Jun 2, 2016 · 6 comments
Closed

Comments

@zazd
Copy link

zazd commented Jun 2, 2016

When I cross compile with android-ndk-11c,I got the error:
CLBlast/include/internal/clpp11.h:129:70: error: 'to_string' is not a member of 'std'
Someone say that using -std=c++11. But I have find it in the CMakeList.txt:

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(FLAGS "/Ox")
set(FLAGS "${FLAGS} /wd4715")
else ()
set(FLAGS "-O3 -std=c++11")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

I am not familiar with cross compile and ndk. So my cmake configure is:
cmake -DCMAKE_AR=$TOOLCHAIN_DIR/arm-linux-androideabi-ar
-DCMAKE_C_COMPILER=$TOOLCHAIN_DIR/arm-linux-androideabi-gcc
-DCMAKE_CXX_COMPILER=$TOOLCHAIN_DIR/arm-linux-androideabi-g++
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_LINKER=$TOOLCHAIN_DIR/arm-linux-androideabi-ld
-DCMAKE_NM=$TOOLCHAIN_DIR/arm-linux-androideabi-nm
-DCMAKE_OBJCOPY=$TOOLCHAIN_DIR/arm-linux-androideabi-objcopy
-DCMAKE_OBJDUMP=$TOOLCHAIN_DIR/arm-linux-androideabi-objdump
-DCMAKE_RANLIB=$TOOLCHAIN_DIR/arm-linux-androideabi-ranlib
-DCMAKE_STRIP=$TOOLCHAIN_DIR/arm-linux-androideabi-strip
-DCMAKE_INSTALL_PREFIX=$INSTALL_DIR/CLBlast
-DOPENCL_INCLUDE_DIRS=$INSTALL_DIR/MaliOpenCL/include
-DOPENCL_LIBRARIES=$$INSTALL_DIR/MaliOpenCL/lib/libGLES_mali.so $CLBLAST_ROOT

Is that something wrong above or Would you tell me how to solve the problem?

Thank you!

@zazd zazd changed the title 'stoi' is not a member of 'std' while cross compile with android-ndk-11c 'to_string' is not a member of 'std' while cross compile with android-ndk-11c Jun 2, 2016
@CNugteren
Copy link
Owner

CNugteren commented Jun 2, 2016

I am not too familiar with Android either, but perhaps you can run your build-system in a verbose manner? So after running CMake, you'll probably run something like make or nmake, right? In that case, can you for example run make VERBOSE=1? It will then print out the commands which are actually used, so the first thing to check is whether the -std=c++11 flag is actually missing: perhaps it is some other problem.

@zazd
Copy link
Author

zazd commented Jun 4, 2016

I try it. But everything seems ok, and I can not find what wrong with it. However I override "std::to_string" and the same functions such as "stoi", and it works. Thank you for your help.

@CNugteren
Copy link
Owner

What do you mean, you 'override' them? Did you define and implement those functions yourself? Can you post the complete solution in case other people also encounter this problem? Thanks!

@zazd
Copy link
Author

zazd commented Jun 6, 2016

Yes,In cross compile a lot of people encounter the error that 'to_string' is not a member of 'std', the same as "stoi","stof","stod" and so on. Even if they use -std=c++11 to compile these functions, they can not solve it and find nothing about the reason. So I fulfill these functions instead of using them. Because they are too simple. Such as
namespace clblast {
string to_string(int value) {
stringstream stm;
stm << value;
return stm.str();
}
}
to instead of std::to_string(value).

However, I cross-compile CLBlast successfully, but in arm, when running the function, likes CLBlast::Gemm, it failed. I am now looking for the reason. But can CLBlast run in the arm?

@CNugteren
Copy link
Owner

CNugteren commented Jun 6, 2016

OK, thanks for the details, hopefully that helps others trying to cross-compile for Android.

The library has been tested on ARM before with success, but I never tried Android. Note that if the used device (Mali, Adreno, ...) is not tuned for, performance might be sub-optimal. But let's first try to get it to work. First step would be to compile the tests (cmake -DTESTS=ON ..) and run them (e.g. ./clblast_test_xaxpy). Can you perhaps open a separate issue and post the results of one or more of the failing tests, along with the device you are targeting?

@CNugteren
Copy link
Owner

I know it's been a while, but I've now implemented the missing functions (when using GCC's gnustl_static instead of LLVM's c++_static) in the repository. They are in a header which is not included by default: 00b5771.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants