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

Add 32bit ARM armel & armhf GNU/Linux support #3196

Closed
wants to merge 3 commits into from
Closed

Conversation

@xranby
Copy link
Contributor

xranby commented Jun 9, 2015

The following cross compile packages needs to be installed on the build server:
gcc-arm-linux-gnueabi
g++-arm-linux-gnueabi
gcc-arm-linux-gnueabihf
g++-arm-linux-gnueabihf

JDK 8 ARM systems will try to load:
libgdxarmgnueabi.so -> 32bit ARM GNU softfp EABI
libgdxarmgnueabihf.so -> 32bit ARM GNU hard float EABI

JDK 6/7 ARM systems will try to load:
libgdxarm.so -> 32bit ARM unknown ABI.
We will use the gnueabihf compiler for JDK systems with unknown ABI.

Signed-off-by: Xerxes Rånby xerxes@gudinna.com

The following cross compile packages needs to be installed on the build server:
gcc-arm-linux-gnueabi
g++-arm-linux-gnueabi
gcc-arm-linux-gnueabihf
g++-arm-linux-gnueabihf

JDK 8 ARM systems will try to load:
lib*armgnueabi.so -> 32bit ARM GNU softfp EABI
lib*armgnueabihf.so -> 32bit ARM GNU hard float EABI

JDK 6/7 ARM systems will try to load:
lib*arm.so -> 32bit ARM unknown ABI.
We will use the gnueabihf compiler for JDK systems with unknown ABI.

Signed-off-by: Xerxes Rånby <xerxes@gudinna.com>
@badlogic
Copy link
Member

badlogic commented Jun 9, 2015

How does the library loader know to load these? Also, we'll need to change
jnigen to emit these linux arm build files.

On Tue, Jun 9, 2015 at 3:45 PM, Xerxes Rånby notifications@github.com
wrote:

The following cross compile packages needs to be installed on the build
server:
gcc-arm-linux-gnueabi
g++-arm-linux-gnueabi
gcc-arm-linux-gnueabihf
g++-arm-linux-gnueabihf

JDK 8 ARM systems will try to load:
lib
_armgnueabi.so -> 32bit ARM GNU softfp EABI lib_armgnueabihf.so -> 32bit
ARM GNU hard float EABI

JDK 6/7 ARM systems will try to load:
lib*arm.so -> 32bit ARM unknown ABI.
We will use the gnueabihf compiler for JDK systems with unknown ABI.

Signed-off-by: Xerxes Rånby xerxes@gudinna.com

You can view, comment on, or merge this pull request online at:

#3196
Commit Summary

  • Add 32bit ARM armel & armhf GNU/Linux support

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#3196.

@xranby
Copy link
Contributor Author

xranby commented Jun 9, 2015

The library loader was patched about a year ago to support this:
8f83f0f

Raspberry Pi users have verified that the loader work:
https://web.archive.org/web/20150519135633/http://www.habitualcoder.com/?page_id=257

JDK 8 ARM systems will try to load:
lib*armgnueabi.so -> 32bit ARM GNU softfp EABI
lib*armgnueabihf.so -> 32bit ARM GNU hard float EABI
lib*armandroideabi.so -> 32bit Android EABI

JDK 6/7 ARM systems will try to load:
lib*arm.so -> 32bit ARM unknown ABI.

Signed-off-by: Xerxes Rånby <xerxes@gudinna.com>
@xranby
Copy link
Contributor Author

xranby commented Jun 9, 2015

Added a commit to update
extensions/gdx-jnigen/src/com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader.java
is there other parts of jnigen that needs to be updated?

@badlogic
Copy link
Member

badlogic commented Jun 9, 2015

Yeah, AntBuildScriptGenerator and all *Build.java files that generate
native libs for various extensions.
On Jun 9, 2015 4:36 PM, "Xerxes Rånby" notifications@github.com wrote:

Added a commit to update

extensions/gdx-jnigen/src/com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader.java
is there other parts of jnigen that needs to be updated?


Reply to this email directly or view it on GitHub
#3196 (comment).

@xranby
Copy link
Contributor Author

xranby commented Jun 9, 2015

I will refactor jnigen to support 32bit ARM GNU/Linux systems

In the long run it would be best to differentiate all native library’s using
os, arch & abi

os is currently encoded in the libPrefix and libSuffix
arch is not encoded at all in the native names
abi is currently partially encoded in the 64 bit part of the libSuffix.

During this initial bring-up I will add support 32bit ARM GNU/Linux systems by extending linux32 systems from using
libPrefix + sharedLibName + libSuffix;
to
libPrefix + sharedLibName + arch + abi + libSuffix;

@nhydock
Copy link

nhydock commented Jun 11, 2015

How is this different from what #2940 is trying to do?

@xranby
Copy link
Contributor Author

xranby commented Jun 13, 2015

My initial change here make the libgdx build servers provide pre-compiled libgdx .so integrated into the gdx-platform- -natives-desktop.jar for easy use by gradle project users. This also would fix the #3188 enhancement

It is neat, that Robbiedobbie #2940 have patched jnigen! this means that I dont have to do it as well ^_^

Both I and Robbiedobbi #2940 aim to support ARM GNU/Linux systems by picking/inventing a namespace to use for native librarys

the core difference is that I aim to handle the differences in abi variants as well.
The two works have overlap in:
extensions/gdx-jnigen/src/com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader.java

Robbiedobbie #2940 only to support unknown abi 32bit arm and unknown abi 64bit arm.
I feel this is an unessecery invented new namespace that do not cover the namespaces used to differentiate native librarys by the distributions.

I aim to support the 3 versions of 32bit ARM and 1 version of 64bit ARM using the abi names provided by the jvm if available. This would fix the #3188 enhancement that require differentiate natives using the abi. I think the approach to reuse the abi namespace used by the distribution toolchains will be more robust (handled by the jvm instead of manual labor by the libgdx team), it all depends if the new sun.arch.abi system property introduced in jdk 8 will be enforced by the linux distributions.

@xoppa
Copy link
Member

xoppa commented Aug 18, 2015

Thanks @xranby, I've pulled in @Robbiedobbie jnigen PR. Can you pull in changes and solve conflicts for the loader?

@RBogie
Copy link
Member

RBogie commented Aug 19, 2015

I think you should use your loader, and can then use my buildscript generator. One thing that you should adapt is the SharedLibraryFinder. In your commits, you forgot to add support to it for finding arm libraries. I changed it in my commits, but mine doesn't support the multiple ABIs.

I do think it is a big improvement supporting different ABIs. I simply did not include it for time reasons. It was much simpler assuming that the program would only be run on a single arm platform on linux. Finding out how to detect the abi was way too much work for me considering the time constraints I had. (I needed it for some small hobby project that I had to do in the very little spare time I have 😉)

@xranby xranby force-pushed the xranby:master branch 2 times, most recently from 5b4eade to dbb3a55 Aug 21, 2015
Conflicts:
	extensions/gdx-jnigen/src/com/badlogic/gdx/jnigen/JniGenSharedLibraryLoader.java
@xranby
Copy link
Contributor Author

xranby commented Aug 23, 2015

I resolved the conflict in JniGenSharedLibraryLoader by using the loader that supports different ABI's.

I have kept Robbiedobbie's implementation of the SharedLibraryFinder interface for now mainly because there is no code using this interface inside the libgdx main source tree.
Robbiedobbie: can you elaborate when it is useful to use the SharedLibraryFinder interface to override the way of searching for a library on each platform?
I have searched github and I cant find any source currently using it
https://github.com/search?q=implements+SharedLibraryFinder&ref=searchresults&type=Code&utf8=%E2%9C%93

@johnnyapol
Copy link
Member

johnnyapol commented Aug 25, 2015

Regardless of the way it is implemented - I can't personally validate this PR because of my absence from this project. I feel this is something that should definitely be supported. A friend of mine lent me his Raspberry Pi 2 a few days ago so I could tool around with coding on it and I am now awaiting for my own to come. I think that it is a market certainly reachable for indie developers. The more platforms we can easily support, the better. In this case we just need additional native libraries and a modified loader.

xranby added a commit to xranby/libgdx that referenced this pull request Nov 2, 2015
@littletinman
Copy link

littletinman commented Jan 5, 2016

Any updates on this? Would absolutely love Raspi support as it's the perfect platform to bring places for people to try my games/apps. Literally being able to plug it into a tv, attach a keyboard, and show my friends my latest project would be golden!

If there is anyway I can help with this, please let me know! I have a Rasp a+, b+, and 2 as well as another arm based netbook.

@natdan
Copy link

natdan commented Jan 21, 2016

+1 it would really help having it in a main stream LibGDX.

@littletinman
Copy link

littletinman commented Jan 22, 2016

This merge request has been open for 227 days... any reason it's not merging in? ARM support is my TOP LibGDX feature hope for 2016!

If there was a step by step tutorial for building our own natives, that would be awesome! But I have not found anything beyond general suggestions to date.

@badlogic
Copy link
Member

badlogic commented Jan 23, 2016

@littletinman the reason this is still open is that it's a bad way to solve this issue. jnigen, the thing that creates bindings and build scripts for cross-platform builds, needs to be changed. All this PR does is add additional ant scripts manually, and only to the gdx core native project.

@badlogic
Copy link
Member

badlogic commented Jan 23, 2016

Also needs to be integrated on the Maven side of things.

@xranby
Copy link
Contributor Author

xranby commented Jan 23, 2016

jnigen have already been patched for ARM by the #2940 pull request

All the libgdx Maven pom's do is to download the pre-compiled
https://libgdx.badlogicgames.com/nightlies/dist/gdx-natives.jar
jar and use it. Therefore once this gdx-natives.jar have been created by the build server using the ant scripts makes it all integrated on the maven side!

@badlogic
Copy link
Member

badlogic commented Jan 24, 2016

#2940 did NOT patch jnigen properly. It ignores ABI as you want it. Also, GdxBuild.java, FreeTypeBuild.java, BulletBuild.java and Box2DBuild.java also need to be fixed up to emit the additional Ant scripts. Finally, the master Ant script of each native build needs to include the additional shared libraries for ARM Linux in the *-natives-desktop.jar. So again, this PR is not even close to fixing the underlying issue.

I've just looked into what it'd take to fix up JNIGen properly, and it's quite an amount of work. I currently do not have the time to spend on this, nor do i have any test devices (save for QEMU) to test this on. I welcome any proper PR that fixes this issue by:

  1. Not breaking existing "user space" code
  2. Not introducing Ant scripts manually into the build

I'll be happy to have this build and deployed to Central from our build server, even with the additional overhead for the ARM libraries.

@entangledloops
Copy link

entangledloops commented Feb 19, 2016

I've written 2 jni build files for armgnueabihf: 1 for libgdx and 1 for libgdx-freetype.

  1. Download these files and place in their respective jni subfolders.
  2. Remove the prefixes "freetype-" and "gdx-" and change extension to xml.
  3. From each jni folder, run: ant -f build-armgnueabihf.xml
  4. Resulting libs produced in libs/armgnueabihf
    freetype-build-armgnueabihf.txt
    gdx-build-armgnueabihf.txt

Note:
These builds are tuned for arm v7a. You can change those build settings if you are using different hardware without breaking the script.

@badlogic
Copy link
Member

badlogic commented Feb 20, 2016

I'm closing this out now. 3rd parties have the option to build, maintain, and publish their own artifacts that include the natives. I'm happy to make modifications to SharedLibraryLoader as necessary, unless it breaks existing user code.

I hope I've explained why this PR is insufficient in my previous comments. I'm happy to merge (tested) PRs that accomodate the requirements outlined in my previous comments.

@badlogic badlogic closed this Feb 20, 2016
@natdan natdan mentioned this pull request Jan 28, 2017
1 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

9 participants
You can’t perform that action at this time.