Android NDK fseeko/ftello undefined on 32-bit architectures? And UniPCemu on Linux...

Emulation of old PCs, PC hardware, or PC peripherals.

Android NDK fseeko/ftello undefined on 32-bit architectures? And UniPCemu on Linux...

Postby superfury » 2019-2-11 @ 02:20

When used for the armeabi-v7a and x86 architectures, they still compile, but I receive this warning:
Code: Select all
X:/projects/unipcemu/android-project/jni_androidstudio/../jni/src/../../../UniPCemu/../commonemuframework/basicio/fopen64.c
:76:17: warning: implicit declaration of function 'fseeko' is invalid in C99 [-Wimplicit-function-declaration]
        if (!(result = fseeko(b->f, pos, direction))) //Direction is constant itself!
                       ^
X:/projects/unipcemu/android-project/jni_androidstudio/../jni/src/../../../UniPCemu/../commonemuframework/basicio/fopen64.c:78:17: warning: implicit declaration of function 'ftello' is invalid in C99 [-Wimplicit-function-declaration]
                b->position = ftello(b->f); //Use our own position indicator!
                              ^


Anyone knows how to fix this? It still compiles fine, other than that warning being produced, so it actually exists? Why isn't it defined(I've added all possible headers already to types.h:
Code: Select all
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
#define _FILE_OFFSET_BITS 64

#ifdef _LARGEFILE_SOURCE
#undef _LARGEFILE_SOURCE
#endif
#define _LARGEFILE_SOURCE 1

#ifdef _LARGEFILE64_SOURCE
#undef _LARGEFILE64_SOURCE
#endif
#define _LARGEFILE64_SOURCE 1

#ifdef _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif

#define _POSIX_C_SOURCE 200808L


64-bit platforms for Android take it without warnings?
Last edited by superfury on 2019-2-15 @ 10:44, edited 2 times in total.
superfury
l33t
 
Posts: 2805
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Android NDK fseeko/ftello undefined on 32-bit architectures?

Postby realnc » 2019-2-14 @ 21:27

These are POSIX functions. They do exist in the C library, which is why linking doesn't fail, but at compilation time they are #ifdef'ed out in the system headers if the POSIX specific macro that guards them isn't being defined. Compiling in GNU mode usually defines all the needed macros automatically. That is, if you want to build in C99 mode, then use -std=gnu99 in your C compiler flags. For C11, use -std=gnu11. Same for C14 and C17.

With that, you should be able to just include stdio.h and get the prototypes for these functions.
User avatar
realnc
Member
 
Posts: 318
Joined: 2010-10-13 @ 11:02

Re: Android NDK fseeko/ftello undefined on 32-bit architectures?

Postby superfury » 2019-2-15 @ 09:40

Slightly related, I created a Virtualbox setup(with passthrough to Windows UniPCemu's folder since I couldn't manage to pull/clone the UniPCemu repository after installing git), then fixed various bugs trying to compile it for 64-bit Ubuntu(editing done in Windows). Eventually managed to fix all compiler warnings and errors but the issues with the 64-bit lseek/close/write file functions(no problems linking, though). Eventually found out a missing header on Linux(they need unistd.h too, after fcntl.h and sys/types.h). Then I needed to undefine the sleep macro for the unistd.h include(since it insists on definining a function called delay using a extern keyword). Luckily said macro(which is defined way earlier in the global headers of the project) isn't used in the fopen64 module.

Having fixed those coding warnings and errors, I see it compiling entirely without any errors or warnings on Ubuntu. So now, there's proper 64-bit file I/O support on Linux as well, while I can simply verify if building on Linux works by compiling it on the Ubuntu VM(with shared directories in Virtualbox as a replacement for the git repository support I couldn't get working properly on Ubuntu). :D

Although I still have no idea how to distribute it, when built on Ubuntu and releasing through itch.io(other than compiling it yourself from source).
superfury
l33t
 
Posts: 2805
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Android NDK fseeko/ftello undefined on 32-bit architectures?

Postby realnc » 2019-2-15 @ 22:04

superfury wrote:Slightly related, I created a Virtualbox setup(with passthrough to Windows UniPCemu's folder since I couldn't manage to pull/clone the UniPCemu repository after installing git)

If it's anything like VMware, then this is fixed by adding this line at the top of your ~/.ssh/config file:

IPQoS throughput
User avatar
realnc
Member
 
Posts: 318
Joined: 2010-10-13 @ 11:02


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 3 guests