0

I got this error while compiling cc1: error: unrecognized command line option '-std=c11' a project. All the related issues suggest to use a gcc greater than 4.7 but I already have a gcc greater than 4.7.This is the details

gcc version 6.3.0 20170519 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04)

I am trying to compile this https://github.com/rhdunn/espeak/tree/master/android . Issue is happening in this file https://github.com/rhdunn/espeak/blob/master/android/jni/Android.mk while ndk-build.

This is what I am doing

-vbox:~/eSpeak/espeak-master/android/jni$ ndk-build
Compile mips   : ttsespeak <= case.c
cc1: error: unrecognized command line option '-std=c11'
make: *** [/home/apertium/eSpeak/espeak-master/android/obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o] Error 1

ndk-build V=1 command will give the following log.

apertium@ap-vbox:~/eSpeak/espeak-master/android/jni$ ndk-build V=1 
rm -f /home/apertium/eSpeak/espeak-master/android/libs/armeabi/lib*.so /home/apertium/eSpeak/espeak-master/android/libs/armeabi-v7a/lib*.so /home/apertium/eSpeak/espeak-master/android/libs/mips/lib*.so /home/apertium/eSpeak/espeak-master/android/libs/x86/lib*.so 
rm -f /home/apertium/eSpeak/espeak-master/android/libs/armeabi/gdbserver /home/apertium/eSpeak/espeak-master/android/libs/armeabi-v7a/gdbserver /home/apertium/eSpeak/espeak-master/android/libs/mips/gdbserver /home/apertium/eSpeak/espeak-master/android/libs/x86/gdbserver 
rm -f /home/apertium/eSpeak/espeak-master/android/libs/armeabi/gdb.setup /home/apertium/eSpeak/espeak-master/android/libs/armeabi-v7a/gdb.setup /home/apertium/eSpeak/espeak-master/android/libs/mips/gdb.setup /home/apertium/eSpeak/espeak-master/android/libs/x86/gdb.setup 
Compile mips : ttsespeak <= case.c 
/home/apertium/android-ndk-x86/android-ndk-r9/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86/bin/mipsel-linux-android-gcc -MMD -MP -MF /home/apertium/eSpeak/espeak-master/android/obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o.d -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -no-canonical-prefixes -O2 -g -DNDEBUG -fomit-frame-pointer -funswitch-loops -finline-limit=300 -I/home/apertium/eSpeak/espeak-master/android/jni/include -I/home/apertium/eSpeak/espeak-master/android/jni/../../src/ucd-tools/src/include -I/home/apertium/eSpeak/espeak-master/android/jni/../../src/include -I/home/apertium/eSpeak/espeak-master/android/jni -DANDROID -std=c11 -DINCLUDE_KLATT -DINCLUDE_SONIC -Wa,--noexecstack -Wformat -Werror=format-security -I/home/apertium/android-ndk-x86/android-ndk-r9/platforms/android-14/arch-mips/usr/include -c /home/apertium/eSpeak/espeak-master/android/jni/../../src/ucd-tools/src/case.c -o /home/apertium/eSpeak/espeak-master/android/obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o 
cc1: error: unrecognized command line option '-std=c11' 
make: *** [/home/apertium/eSpeak/espeak-master/android/obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o] Error 1

Any help is greatly appreciated.

  • 1
    Compiling how? What commands are you running? – muru Nov 16 '17 at 6:30
  • @muru I am trying to compile this github.com/rhdunn/espeak/tree/master/android . Issue is happening in this file github.com/rhdunn/espeak/blob/master/android/jni/Android.mk while ndk-build. – sunil sunny Nov 16 '17 at 6:32
  • @muru Can you please check my edit. I don't know how to make it more clear.This error occured while using 'ndk-build' command. – sunil sunny Nov 16 '17 at 7:09
  • Where is the MIPS compiler located on your system? What version is it? I'd guess that it's not the same version as /usr/bin/gcc. Also, which build procedure are you using? ndk-build doesn't appear in README.md at all. – David Foerster Nov 16 '17 at 9:50
  • 1
    @DavidFoerster I am following Android make apk-release is failing with the same error. All the other steps where successfull.MIPS is located here /usr/lib/gcc-cross/mips-linux-gnu with version 5 and 5.4.0 available. gcc is located in /usr/lib/gcc/i686-linux-gnu with version 5,5.4.1,6 and 6.3.0. How to make both same ? – sunil sunny Nov 16 '17 at 10:59
1

With the help of David Foerster I found out that the above mentioned error was due to the fact that the Android NDK includes its own C compiler so my NDK was using GCC 4.6 which doesn't support C11. So I updated my NDK to r16 and resulted in the below error.

root@ap-vbox:~/eSpeak/espeak-master# make V=1 apk-release
cd android && ndk-build
/home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: 10: /home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: Syntax error: word unexpected (expecting ")")
/home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: 10: /home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: Syntax error: word unexpected (expecting ")")
Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in ./AndroidManifest.xml. NDK binaries will *not* be comptible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.    
/home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: 10: /home/apertium/android-ndk-r-16/android-ndk-r16/prebuilt/linux-x86_64/bin/python: Syntax error: word unexpected (expecting ")")
make[1]: Entering directory `/home/apertium/eSpeak/espeak-master/android'
rm -f ./libs/arm64-v8a/* ./libs/armeabi/* ./libs/armeabi-v7a/* ./libs/mips/* ./libs/mips64/* ./libs/x86/* ./libs/x86_64/*
rm -f ./libs/arm64-v8a/gdbserver ./libs/armeabi/gdbserver ./libs/armeabi-v7a/gdbserver ./libs/mips/gdbserver ./libs/mips64/gdbserver ./libs/x86/gdbserver ./libs/x86_64/gdbserver
rm -f ./libs/arm64-v8a/gdb.setup ./libs/armeabi/gdb.setup ./libs/armeabi-v7a/gdb.setup ./libs/mips/gdb.setup ./libs/mips64/gdb.setup ./libs/x86/gdb.setup ./libs/x86_64/gdb.setup
[mips] Compile        : ttsespeak <= case.c
/home/apertium/android-ndk-r-16/android-ndk-r16/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF ./obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o.d -gcc-toolchain /home/apertium/android-ndk-r-16/android-ndk-r16/toolchains/mips64el-linux-android-4.9/prebuilt/linux-x86_64 -target mipsel-none-linux-android -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fmessage-length=0 -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -no-canonical-prefixes  -g -mips32 -O2 -DNDEBUG  -Ijni/include -Ijni/../../src/ucd-tools/src/include -Ijni/../../src/include -Ijni   -DANDROID -std=c11 -DINCLUDE_KLATT -DINCLUDE_SONIC -D__ANDROID_API__=14 -Wa,--noexecstack -Wformat -Werror=format-security  --sysroot /home/apertium/android-ndk-r-16/android-ndk-r16/sysroot -isystem /home/apertium/android-ndk-r-16/android-ndk-r16/sysroot/usr/include/mipsel-linux-android -c  jni/../../src/ucd-tools/src/case.c -o ./obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o
/home/apertium/android-ndk-r-16/android-ndk-r16/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: 1: /home/apertium/android-ndk-r-16/android-ndk-r16/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: Syntax error: ")" unexpected
make[1]: *** [obj/local/mips/objs/ttsespeak/__/__/src/ucd-tools/src/case.o] Error 2
make[1]: Leaving directory `/home/apertium/eSpeak/espeak-master/android'
make: *** [jni] Error 2

I was using a virtual box for this. But when I tried to compile the same on an ubuntu installed system there were no issues. Everything went smooth and compiled. So I guess the issue was with my virtual box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.