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

Build failed. #398

Closed
zhaowq32 opened this issue Jan 17, 2018 · 2 comments
Closed

Build failed. #398

zhaowq32 opened this issue Jan 17, 2018 · 2 comments

Comments

@zhaowq32
Copy link

Hi.I want to build a json-c static lib for android.But i have some errors.

error: implicit declaration of function 'uselocale' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

And this is my command:

C:\Users\TT\AppData\Local\Android\Sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe   
-D HAVE_SETLOCALE --target=armv7-none-linux-androideabi 
--gcc-toolchain=C:/Users/TT/AppData/Local/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 
--sysroot=C:/Users/TT/AppData/Local/Android/Sdk/ndk-bundle/sysroot  
-I../../../../src/main/cpp/cstring/include -Isrc/main/cpp/json_c/src/include 
-isystem C:/Users/TT/AppData/Local/Android/Sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -D__ANDROID_API__=15 
-g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong 
-no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 
-fno-integrated-as -mthumb -Wa,--noexecstack -Wformat -Werror=format-security  
-Werror -D_GNU_SOURCE -O0 -fno-limit-debug-info  -std=gnu99 -MD 
-MT src/main/cpp/json_c/src/CMakeFiles/json-c.dir/json_tokener.c.o 
-MF src\main\cpp\json_c\src\CMakeFiles\json-c.dir\json_tokener.c.o.d 
-o src/main/cpp/json_c/src/CMakeFiles/json-c.dir/json_tokener.c.o   
-c D:\Develope\Android_Projects\SecurePart\app\src\main\cpp\json_c\src\json_tokener.c

This is the error code:

#ifdef HAVE_USELOCALE
  locale_t oldlocale = uselocale(NULL);
  locale_t newloc;
#elif defined(HAVE_SETLOCALE)
  char *oldlocale = NULL;
#endif

BTW I have defined "HAVE_SETLOCALE".

@hawicz
Copy link
Member

hawicz commented Jan 18, 2018

Variables like HAVE_USELOCALE and HAVE_SETLOCALE are intended to be set or unset in config.h, created by running the configure script. If you've decided to manually populate config.h (not recommended), then it sounds like you should undefine HAVE_USELOCALE.

@zhaowq32
Copy link
Author

THX.It's worked.

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