Build command failed on telegram - android

I got this error on the last version of the telegram.
telegram source code version: 4.9.0
envirement :
ubuntu 17.10.0
android studio:3.2 canary 9
ndk version: 14.1.3816874
[armeabi-v7a] Compile++ arm : tmessages.28 <= TgNetWrapper.cpp
/home/joker/telegram490/TMessagesProj/jni/./jni.c: In function
'listdir':
/home/joker/telegram490/TMessagesProj/jni/./jni.c:193:31: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec != 0) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:194:35: error:
'struct stat' has no member named 'st_atim'
if (attrib.st_atim.tv_sec < time) {
^
/home/joker/telegram490/TMessagesProj/jni/./jni.c:198:35: error:
'struct stat' has no member named 'st_mtim'
if (attrib.st_mtim.tv_sec < time) {
^make: ***
[/home/joker/telegram490/TMessagesProj/build/intermediates
/ndkBuild/afat/
debug/obj/local/armeabi-v7a/objs-debug/tmessages.28/./jni.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/TLObject.h:13:0,
from
/home/joker/telegram490/TMessagesProj/jni/./tgnet/ApiScheme.h:15,
from
/home/joker/telegram490/TMessagesProj/jni/./TgNetWrapper.cpp:2:
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h: In
function 'std::string to_string_uint64(uint64_t)':
/home/joker/telegram490/TMessagesProj/jni/./tgnet/Defines.h:184:32:
error: expected ')' before 'PRIu64'
int len = sprintf(buf, "%" PRIu64, value);
Edit:
thanks to #anubhav-gupta, Through SDK Manager, I can only upgrade to version r18-beta1.
after the upgrade I face up with this error:
Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared
Edit:
update NDK to r15 and The problem was solved.

The main problem is in this line 'struct stat' has no member named 'st_atim'
If you're using a modern version of the NDK, you'll have a modern struct stat: https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/stat.h
Note that you need to be using the NDK's unified headers to get the up to date headers. This is the default in r15, but opt-in for r14.

Related

Undefined reference to 'jniRegisterNativeMethods' Android NDK

I'm trying to build the .so file from available NDK project. But I encounter the
undefined reference to 'jniRegisterNativeMethods' error when I try to compile the code using cmd with ndk-build
Here I'm posting the block of that execution
Android NDK: WARNING:jni/Android.mk:gba: non-system libraries in linker flags: -lnativehelper
Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK: current module
[armeabi] Compile++ arm : gba <= emulator.cpp
[armeabi] SharedLibrary : libgba.so
C:/sdk/android-ndk-r10e-windows-x86_64/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lnativehelper
jni/gbalib/nativehelper/JNIHelp.h:108: error: undefined reference to 'jniRegisterNativeMethods'
collect2.exe: error: ld returned 1 exit status
make.exe: *** [obj/local/armeabi/libgba.so] Error 1
E:\Android-Projects-Archieve\Library-Archives\gameboid>
I expect it to build an .so file called libgba.so Let me know in the comments if you need more info to look into this issue. Thanks in advance.

Flac Extension for Exoplayer

I am trying to compile flac extensions to use with Android Studio, ExoPlayer in my project. I tried following the instructions in the ExoPlayer README however, I get the following error:
cd ExoPlayer
EXOPLAYER_ROOT="$(pwd)"
FLAC_EXT_PATH="${EXOPLAYER_ROOT}/extensions/flac/src/main"
NDK_PATH="~/Downloads/android-ndk-r17c"
cd "${FLAC_EXT_PATH}/jni"
mv ~/Downloads/flac-1.3.2 flac
${NDK_PATH}/ndk-build APP_ABI=all -j4
...:~/Downloads/ExoPlayer/extensions/flac/src/main/jni$
NDK_PATH=.../Downloads/android-ndk-r17c
...:~/Downloads/ExoPlayer/extensions/flac/src/main/jni$ ${NDK_PATH}/ndk-build APP_ABI=all -j4
Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in .../Downloads/ExoPlayer/extensions/flac/src/main/AndroidManifest.xml. NDK binaries will *not* be compatible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information.
[arm64-v8a] Compile : flacJNI <= format.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_framing.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_avx2.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_sse2.c
[arm64-v8a] Compile : flacJNI <= stream_encoder_intrin_ssse3.c
[arm64-v8a] Compile : flacJNI <= window.c
.../Downloads/ExoPlayer/extensions/flac/src/main/jni/flac/src/libFLAC/format.c:47:45: error:
use of undeclared identifier 'VERSION'
FLAC_API const char *FLAC__VERSION_STRING = VERSION;
^
.../Downloads/ExoPlayer/extensions/flac/src/main/jni/flac/src/libFLAC/format.c:49:64: error:
expected ';' after top level declarator
FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION ...
^
;
2 errors generated.
make: *** [/home/philip/Downloads/ExoPlayer/extensions/flac/src/main/obj/local/arm64-v8a/objs/flacJNI/flac/src/libFLAC/format.o] Error 1
make: *** Waiting for unfinished jobs....
How do I get this to work? Thanks.
To get the flac extensions to compile in Android Studio I needed to go to:
Tools | SDKManager | SDKTools and checked Cmake

Assembler Messages: Branch out of range

I'm developing game on cocos2d-x with C++.
I developed whole code in xCode. compiled, run in iphone and ipad, run as expected.
But when compiling code for android in windows 7 OS, using Cygwin (64-bit)..I encounterd following code..
$ ./build_native.sh
NDK_ROOT = D:\android-ndk-r9
COCOS2DX_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../..
APP_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/..
APP_ANDROID_ROOT = /cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android
Using prebuilt externals
make: Entering directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'
Android NDK: WARNING:/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android/../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
Compile++ thumb : cocos2dcpp_shared <= AppDelegate.cpp
Compile++ thumb : cocos2dcpp_shared <= PlayerSelection.cpp
jni/../../Classes/PlayerSelection.cpp: In member function 'void PlayerSelection::update()':
jni/../../Classes/PlayerSelection.cpp:1511:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
Compile++ thumb : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range
/cygdrive/d/android-ndk-r9/build/core/build-binary.mk:348: recipe for target 'obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o' failed
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/GameScene.o] Error 1
make: Leaving directory '/cygdrive/d/cocos2d-x-2.2/projects/Totals/proj.android'
In the Above command-line output the problem is:
Compile++ thumb : cocos2dcpp_shared <= GameScene.cpp
C:\cygwin64\tmp\ccdF8Sjo.s: Assembler messages:
C:\cygwin64\tmp\ccdF8Sjo.s:12180: Error: branch out of range
I tried Following links:
Why does branching occur in assembly code while comparing for a number to be in range?
https://in.answers.yahoo.com/question/index?qid=20100603163224AAAGX7J
branch out of range compile error
None of above references were helpfull that I could compile code.
After battling with my code by checking each function ONE by ONE, I found the problem was lying in nested switch case, if anyone happen to hit this problem this could be it..
And thank you LearnCocos2D for Your interest.

Cocos2d-x fails to compile C++ code in MacOs using ./build_native.sh

I'm using android-ndk-r9b and cocos2d-x-2.1.4 under MacOs Mavericks. I was able to create the android application for cocos2d-x, but when I tried to compile the C++ code using ./build_native.sh script, the compiler get me some warnings and at the end failed.
These warnings are:
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
[armeabi] Compile thumb : cocos2dx_static <= quaternion.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c: In function 'kmQuaternionAssign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c:478:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile thumb : cocos2dx_static <= vec4.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c: In function 'kmVec4Assign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c:150:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile++ thumb: cocos2dx_static <= CCCommon.cpp
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]
cc1plus: some warnings being treated as errors
I'm wondering if someone has encounter similar errors, how how to revolve it?
Thanks!
Same problem here (Cocos2DX 2.1.1)
http://www.cocos2d-x.org/forums/6/topics/32437?r=39742#message-39742
You can shut down the compiler error:
in Application.mk:
APP_CFLAGS += -Wno-error=format-security
or better, solve the problem of string format, in 4 points of cocos code (as you can see in the link above):
1 - CCCommon.cpp - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf); -> __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
2 - SimpleAudioEngine.cpp - LOGD(deviceModel); -> LOGD("%s",deviceModel);
3 - OpenSLEngine.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo);
4 - SimpleAudioEngineOpenSL.cpp - LOGD(errorInfo); -> LOGD("%s",errorInfo);

Two different NDK build error for same libarary for two different NDK version?

I have an ndk library that is build in c to be included in a project. Tried building the ndk with Windows environment variable Path=C:\android\android-ndk-r8c-windows\android-ndk-r8c\
The command is run from cygwin bash prompt.
Tried with ndk-build from cmd directly and issue persists
Received the following error
$ ndk-build
/cygdrive/c/android/android-ndk-r8c-windows/android-ndk-r8c/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 7 in /cygdrive/c/REPOS/Androidtrunk/ciLibrary/AndroidManifest.xml
Cygwin : Generating dependency file converter script
Compile++ thumb : ciandroid <= CellRecord.cpp
Compile++ thumb : ciandroid <= ci.cpp
Compile++ thumb : ciandroid <= ConnectionRecord.cpp
In file included from C:/REPOS/Androidtrunk/ciLibrary/jni/ciandroid/ConnectionRecord.cpp:8:0:
C:/REPOS/Androidtrunk/ciLibrary/jni/ciandroid/../data_common/ConnectionObserverData.h:23:19: fatal error: Redis.h: No such file or directory
compilation terminated.
/cygdrive/c/android/android-ndk-r8c-windows/android-ndk-r8c/build/core/build-binary.mk:263: recipe for target '/cygdrive/c/REPOS/Androidtrunk/ciLibrary/obj/local/armeabi/objs/ciandroid/ConnectionRecord.o' failed
make: *** [/cygdrive/c/REPOS/Androidtrunk/ciLibrary/obj/local/armeabi/objs/ciandroid/ConnectionRecord.o] Error 1
NOTE :THE ABOVE ERROR WAS RESOLVED WHEN THE MISSING HEADER FILE REDIS.H was added however when the same file was run from LATEST NDK VERSION the same error shown below occurs.
Now changed the windows environment variable Path=C:\android\android-ndk-r9-windows-x86_64\android-ndk-r9\ and the error is
Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 7 in /cygdrive/c/REPOS/Androidtrunk/ciLibrary/AndroidManifest.xml
Cygwin : Generating dependency file converter script
Compile++ thumb : catmgrd <= ActiveTestMgrAndroid.cpp
Compile++ thumb : catmgrd <= ControlMsg.cpp
Compile++ thumb : catmgrd <= DNSTObserver.cpp
Compile++ thumb : catmgrd <= DnsTestDriver.cpp
Compile++ thumb : catmgrd <= FileMoveActor.cpp
In file included from C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curl.h:35:0,
from C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:24:
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:79:4: error: #error "CURL_SIZEOF_LONG definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:94:4: error: #error "CURL_TYPEOF_CURL_OFF_T definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:99:4: error: #error "CURL_FORMAT_CURL_OFF_T definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:104:4: error: #error "CURL_FORMAT_CURL_OFF_TU definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:109:4: error: #error "CURL_FORMAT_OFF_T definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:114:4: error: #error "CURL_SIZEOF_CURL_OFF_T definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:119:4: error: #error "CURL_SUFFIX_CURL_OFF_T definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:124:4: error: #error "CURL_SUFFIX_CURL_OFF_TU definition is missing!"
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:80:4: error: 'Error' does not name a type
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:153:6: error: 'curl_off_t' was not declared in this scope
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:153:6: error: 'CURL_SIZEOF_CURL_OFF_T' was not declared in this scope
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curlrules.h:163:6: error: 'curl_off_t' was not declared in this scope
In file included from C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:24:0:
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curl.h:235:3: error: 'curl_off_t' does not name a type
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/../curl/include/curl/curl.h:296:35: error: 'curl_off_t' has not been declared
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp: In function 'int FileTransferRunCurl(FileTransferInfo*, char*, char const*, char const*, char const*)':
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:397:13: error: 'curl_off_t' was not declared in this scope
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp: In function 'char* CreateTempFileName(char*)':
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:915:78: warning: format '%d' expects argument of type 'int', but argument 4 has type 'time_t {aka long int}' [-Wformat]
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:915:78: warning: format '%d' expects argument of type 'int', but argument 5 has type 'suseconds_t {aka long int}' [-Wformat]
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp: In function 'int FileMoveActorRun(FileTransferInfo*)':
C:/REPOS/Androidtrunk/ciLibrary/jni/catmgrd/FileMoveActor.cpp:1083:90: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'long long int' [-Wformat]
/cygdrive/c/android/android-ndk-r9-windows-x86_64/android-ndk-r9/build/core/build-binary.mk:348: recipe for target '/cygdrive/c/REPOS/Androidtrunk/ciLibrary/obj/local/armeabi/objs/catmgrd/FileMoveActor.o' failed
make: *** [/cygdrive/c/REPOS/Androidtrunk/ciLibrary/obj/local/armeabi/objs/catmgrd/FileMoveActor.o] Error 1
-------------------------------------
Android.mk file has
include $(call all-subdir-makefiles)
android latest adt plugin is used.

Categories

Resources