External Libraries with Love Android

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MelloLunar
Prole
Posts: 2
Joined: Thu Jan 12, 2017 11:51 pm

External Libraries with Love Android

Post by MelloLunar »

Hello, I would like to know how I can run external libraries on android,
I installed libraries using luarocks on my PC, then I copied the files into my directory inside a lib/ folder and changed the requirepath and cpath, I then sent my files to mobile using an FTP server and opened the lua file with Love for Android (Or whatever it was called) using X-plore app, now it worked fine on my PC but when I opened my libraries (the .so files, to be more precise), it told me that the infrastructure was different (arm compared to x86_64) and it just didn't run

How would I go about making libraries such as lpeg or cqueues work on android? Thank you for reading ...
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: External Libraries with Love Android

Post by raidho36 »

Well of course you can't run x86 binary code on ARM processor, the same way you can't run PlayStation games on XBox - it's pretty basic thing to know about cross platform distribution, that each platform requires its own build. What you need to do is download source code for your packages and build them as Android-compatible ARM Shared Object files, that'll produce .so files that can be loaded on Android.
MelloLunar
Prole
Posts: 2
Joined: Thu Jan 12, 2017 11:51 pm

Re: External Libraries with Love Android

Post by MelloLunar »

raidho36 wrote:Well of course you can't run x86 binary code on ARM processor, the same way you can't run PlayStation games on XBox - it's pretty basic thing to know about cross platform distribution, that each platform requires its own build. What you need to do is download source code for your packages and build them as Android-compatible ARM Shared Object files, that'll produce .so files that can be loaded on Android.
What compiler would build them as arm shared objects that would be compatible with android? Also, what about the dependencies of libraries such as openssl or the configuration that is related to arm environments and demanded by those compilers

I went that way, but because I really was going in blind, my results were mediocre and I had to deal with a lot of problems... Now... if someone else managed to do it themselves, that's another story...
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: External Libraries with Love Android

Post by raidho36 »

Android SDK and NDK should have everything you need to build your files. If you build from source code, dependencies you'll of course have to resolve yourself. The sure way to do this is to place dependencies in a sub-folder and include them in build list, to hard-embed them into your binaries.

But do try your luck with web search about having luarocks to build for Android.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: External Libraries with Love Android

Post by Positive07 »

Similarly, you could statically link the libraries to the APK, for examples just check how LuaSocket and Lua-ENET are statically linked to LÖVE
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 156 guests