Android NDK build fail #93

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

Comments

Projects
None yet
2 participants
@stari4ek

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

Show comment
Hide comment
@vitaut

vitaut Feb 4, 2015

Contributor

Thanks for reporting, I'll look into it.

Contributor

vitaut commented Feb 4, 2015

Thanks for reporting, I'll look into it.

@stari4ek

This comment has been minimized.

Show comment
Hide comment
@stari4ek

stari4ek 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)

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

Show comment
Hide comment
@vitaut

vitaut Feb 5, 2015

Contributor

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!

Contributor

vitaut 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!

@vitaut vitaut closed this Feb 5, 2015

@azadkuh azadkuh referenced this issue in gabime/spdlog Jul 18, 2016

Closed

Compile error on OS X #245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment