Skip to content

fix: correct FTBFS for Android #38

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

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Conversation

flexiondotorg
Copy link
Contributor

@flexiondotorg flexiondotorg commented Feb 26, 2025

This pull request adds the missing UnixLibraryLoader.cpp to Android.mk so that it links successfully.

I found the pre-built https.so artifacts for other platforms useful, so I've added a GitHub workflow job to attach Android https.so artifacts during CI builds. As lua-https is bundled in LÖVE 12.0 by default, the workflow I've added builds against LÖVE 11.5a for Android.

Copy link
Contributor

@MikuAuahDark MikuAuahDark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit looks good to me but 641a245 probably won't work as you expected.

The reason the user has to insert lua-https as part of their compilation in LOVE 11.5 because lua-https requires additional Java files to be compiled inside the LOVE itself. This inclusion of Java files is automatically handled by LOVE build.gradle as long as you put lua-https properly in the specified folder. Cherry-picking https.so into prebuilt binary of your custom LOVE APK is not sufficient to make lua-https work in Android.

To prevent misleads, can you remove that particular commit? Thanks.

@flexiondotorg
Copy link
Contributor Author

@MikuAuahDark I can (and will) remove that commit, but can you help educate me before I do?

I'm new to building Android apps. Android builds of my LOVE 11.5 demo have the architecture-specific versions of https.so in the lib/{arch} directories of the .apk. All good so far. But https = require("https") in main.lua fails to find https. Is that expected?

I've worked around this by bundling the https.so files in my game assets and creating a helper function to copy the appropriate https.so to the save directory, update packages.cpath accordingly and then require("https") works.

I want to be sure I'm using https correctly with LOVE 11.5 because I use the same pattern for Linux, Windows, and macOS.

@MikuAuahDark
Copy link
Contributor

MikuAuahDark commented Feb 27, 2025

You have to be careful with that approach as Android 10 and later doesn't allow that workaround (save directory is writable but you can't load any .so in save directory).

It should able to find them as long as you follow the approach. If it cannot find https despite having lib/{arch}/https.so then you need to single-step around this code https://github.com/love2d/love/blob/6807e54bab3a080b7ac3f75ac8c02d1c00fd8f67/src/modules/filesystem/wrap_Filesystem.cpp#L802 to find what's going on.

Furthermore, even if you able to load https.so, if the necessary Java side is not compiled along the LOVE then https.request will always fail with "no backends" error (because the necessary Java classes were missing). That's why the only supported way to use lua-https in 11.5 is to add it to lua-modules and recompile LOVE.

@flexiondotorg
Copy link
Contributor Author

Thanks for the insight @MikuAuahDark

I've dropped the commit that adds the Android artifact collection.

@MikuAuahDark MikuAuahDark changed the title fix: correct FTBFS for Android and add CI to collect https.so artifacts fix: correct FTBFS for Android Feb 28, 2025
@MikuAuahDark MikuAuahDark merged commit e1b7704 into love2d:main Feb 28, 2025
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

Successfully merging this pull request may close these issues.

2 participants