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

Android NDK build fail #93

Closed
stari4ek opened this issue Feb 4, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@stari4ek
Copy link

commented Feb 4, 2015

$ ndk-which gcc
/Users/sotnikm/NVPACK/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc

$ ndk-build V=1

[armeabi] Compile++ thumb: cppformat_static <= format.cc
/Users/sotnikm/NVPACK/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -MMD -MP -MF ./obj/local/armeabi/objs/cppformat_static/cppformat/format.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 -I/Users/sotnikm/NVPACK/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/include -I/Users/sotnikm/NVPACK/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include -I/Users/sotnikm/NVPACK/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/include/backward -Ijni/../../Libs/3rdParty/cocos2d/external/../../cppformat/project.android/../src -DANDROID  -Wa,--noexecstack -Wformat -Werror=format-security    -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -DNDEBUG  -I/Users/sotnikm/NVPACK/android-ndk-r10d/platforms/android-15/arch-arm/usr/include -c  jni/../../Libs/3rdParty/cocos2d/external/../../cppformat/project.android/../src/cppformat/format.cc -o ./obj/local/armeabi/objs/cppformat_static/cppformat/format.o 
jni/../../Libs/3rdParty/cocos2d/external/../../cppformat/project.android/../src/cppformat/format.cc: In function 'int {anonymous}::safe_strerror(int, char*&, std::size_t)':
jni/../../Libs/3rdParty/cocos2d/external/../../cppformat/project.android/../src/cppformat/format.cc:138:61: error: invalid conversion from 'int' to 'char*' [-fpermissive]
   char *message = strerror_r(error_code, buffer, buffer_size);
                                                             ^
make: *** [obj/local/armeabi/objs/cppformat_static/cppformat/format.o] Error 1

it uses android-ndk-r10d/platforms/android-15/arch-arm/usr/include/string.h where

extern char*  strerror(int);
extern int    strerror_r(int errnum, char *buf, size_t n);
@vitaut

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2015

Thanks for reporting, I'll look into it.

@stari4ek

This comment has been minimized.

Copy link
Author

commented Feb 5, 2015

I've updated it with

-#ifdef _GNU_SOURCE
+#if defined(GNU_SOURCE) && (_POSIX_C_SOURCE < 200112L) && (_XOPEN_SOURCE < 600)

but I'm not totally sure that it's really valid for all kind of platforms.
According to http://linux.die.net/man/3/strerror_r XSI-compatible is preferable (with int)

@vitaut

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2015

Should be fixed in bdeffc3. Unfortunately Android doesn't seem to follow the docs in http://linux.die.net/man/3/strerror_r so I had to check for __ANDROID__. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.