Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ftello() and fseeko() android build errors

I am trying to build Android L for 64-bit architecture.

My code goes like:

#if (HAS_LARGE_FILE_SUPPORT)
#define _FILE_OFFSET_BITS 64   //Defined in header file


/*Some File operations*/
#if HAS_LARGE_FILE_SUPPORT
     return fseeko(iFile, offset, seekmode);
#else
     return fseek(iFile, offset, seekmode);


/*Some File operations*/
    #if HAS_LARGE_FILE_SUPPORT
         return ftello(iFile, offset, seekmode);
    #else
         return ftell(iFile, offset, seekmode);

I am getting below ftello and fseeko errors:

error: call to 'ftello' declared with attribute error: not available with _FILE_OFFSET_BITS=64

error: call to 'fseeko' declared with attribute error: not available with _FILE_OFFSET_BITS=64

I checked about fseeko and ftello, on the manual pages it is mentioned that defining _FILE_OFFSET_BITS with the value 64 will turn off_t into a 64-bit type. Still I am seeing this error. I checked about this error but couldn't find any satisfactory answer.

It will be really helpful if anyone can help me with this.

like image 279
Android_Noob Avatar asked Nov 10 '22 04:11

Android_Noob


1 Answers

I solved similar issue by specifying api to 24 when create standalone ndk

./make_standalone_toolchain.py --arch arm --api 24 --stl libc++ --install-dir /tmp/ndk

From ndk file sysroot/usr/include/stdio.h, it looks like ftello only support for api greater or equal than 24

#if __ANDROID_API__ >= 24
int fgetpos(FILE* __fp, fpos_t* __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24);
int fsetpos(FILE* __fp, const fpos_t* __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24);
int fseeko(FILE* __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24);
off_t ftello(FILE* __fp) __RENAME(ftello64) __INTRODUCED_IN(24);
#endif /* __ANDROID_API__ >= 24 */
like image 149
alijandro Avatar answered Nov 14 '22 21:11

alijandro