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

Building for Android with ANDROID_PLATFORM < 24 results in fseeko() and ftello() always return error in 32-bit build #494

Closed
svenoaks opened this issue Oct 21, 2022 · 6 comments

Comments

@svenoaks
Copy link

The 32-bit ABI bugs document suggests they're not available, but I didn't notice it until encoder finish() is always false and metadata not written, it seems like fseeko() is always returning error.

I'm not sure how to fix it yet, I can't raise my ANDROID_PLATFORM to 24 yet.

@ktmf01
Copy link
Collaborator

ktmf01 commented Oct 22, 2022

A stupid question perhaps, but what would one gain by building libFLAC on Android? libFLAC is already part of the Android system API's.

Related to that: perhaps there is a patch somewhere for this in the Android sources? https://android.googlesource.com/platform/external/flac/

@svenoaks
Copy link
Author

A stupid question perhaps, but what would one gain by building libFLAC on Android? libFLAC is already part of the Android system API's.

Related to that: perhaps there is a patch somewhere for this in the Android sources? https://android.googlesource.com/platform/external/flac/

As far as I can tell, libFLAC can't be used directly by app developers, you have to go through through the Media API, which is cumbersome. I'll look more, but can't see how (if?) they resolved the fseeko thing there

@svenoaks
Copy link
Author

I added this to compat.h

#if defined __ANDROID__ && (defined __arm__ || defined __i386__) && __ANDROID_API__ < 24
#define fseeko fseek
#define ftello ftell
#endif

and it works, but I think that will fail with files larger than 2GB.

@ktmf01
Copy link
Collaborator

ktmf01 commented Oct 25, 2022

I can't seem to find any changes in Android's version of FLAC related to this.

Perhaps it is interesting to try and generate a FLAC file through some existing Android app using the Media API? If such a file also lacks the metadata you reference, perhaps this isn't fixed in the Media API either?

Anyway, I can't be of much help here, sadly.

@ktmf01
Copy link
Collaborator

ktmf01 commented Nov 1, 2022

I've been looking through the libFLAC that shipped with Android 6.0 (which shipped with API level 23) at https://android.googlesource.com/platform/external/flac/+/refs/tags/android-6.0.0_r26/

I can't find anything relating to this. It seems fseeko is used at several places. So, it seems fseeko wasn't made available but is available at a lower level?

Can I close this issue? You've found a fix (from the document you linked it seems the only possible fix).

@svenoaks
Copy link
Author

svenoaks commented Nov 1, 2022

I've been looking through the libFLAC that shipped with Android 6.0 (which shipped with API level 23) at https://android.googlesource.com/platform/external/flac/+/refs/tags/android-6.0.0_r26/

I can't find anything relating to this. It seems fseeko is used at several places. So, it seems fseeko wasn't made available but is available at a lower level?

Can I close this issue? You've found a fix (from the document you linked it seems the only possible fix).

Fair enough, since devs compiling flac with ANDROID_PLATFORM < 24 and 32-bit Android in general is getting less and less common we shouldn't waste anymore brain power on it.

@svenoaks svenoaks closed this as completed Nov 1, 2022
kichikuou added a commit to kichikuou/xsystem4-android that referenced this issue Nov 10, 2023
- Update Opus and FLAC to the latest versions
- Build FLAC with -Wno-error=implicit-function-declaration to avoid
  compile errors for fseeko() and ftello(). (According to [1] they don't
  work, but that's fine because we don't really use FLAC.)

[1] xiph/flac#494
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