mphe/GDNative-Ropesim

Problem with Android

araslanix opened this issue · 4 comments

I attempted to execute an Android version on my mobile device, but encountered an issue with the rope not rendering correctly. Upon inspecting the build console, I identified the following error message:

Can't open file from path 'res://addons/ropesim/bin/libropesim.android.template_debug.arm64.so'.
Parser Error: Identifier "NativeRopeServer" not declared in the current scope.

I saw that there are steps in the GitHub Actions for generating Android files: here. So I'm not sure about the cause of my error. Are there any specific guidelines or tricks to successfully get an Android build? I use the GUI godot exporter to directly run on my phone. and the addon is installed from godot AssetLib.

Thanks in advance :)

So, I managed to get it working and had to learn a few things along the way :D Couldn't give up on this beautiful rope extension!

I utilized the docker files from: https://github.com/godotengine/build-containers to build Godot for Android. Then I used Podman to transfer the Ropesim files into the container, after running the following commands:

scons platform=android target=template_debug arch=arm64 -j2
scons platform=android target=template_release arch=arm64 -j2

I could produce the missing ".so" files. Afterward, I moved the files from /demo/addons/ropesim/bin/ to my project's addons ropesim/bin directory. and Now, I can export the project directly from Godot to my phone, and the rope renders correctly.

By the way, I found that the build-containers very neat and user-friendly. Should I submit a PR for your GitHub actions? This way, instead of executing commands directly on GitHub, we could use Podman. The containers would generate artifacts and you could use "podman cp" command to fetch them out. probably the docker images could also use github cache to reduce the build time :)

mphe commented

Indeed the Android debug build was missing.
I have updated the Github workflow. You can find the latest build here.
Could you please test this release (when it finished building) and report back whether it works as expected now?
I'm not an Android developer so I can't really test myself. But I think it should be fine now.

Should I submit a PR for your GitHub actions?

I like the simplicity of the Github workflow as it currently is. No need for an extra docker layer.

Could you please test this release (when it finished building) and report back whether it works as expected now?

Yes it works perfectly fine 👍 Thank you!

No need for an extra docker layer.

Great! I'll then write down the steps for a customized build of this (or any other) GDExtension libraries without messing up your local PC. Could be useful for someone with web or iOS requirements:
follow these steps:

  1. Clone the build-containers repository:

    git clone git@github.com:godotengine/build-containers.git
    cd build-containers/
  2. Make sure you have docker running:

    docker run hello-world  # or something like this
  3. Install Podman (works similar to Docker):

    sudo apt install podman
  4. Build all the images (you can also build only for one, check the build-containers repo):

    ./build.sh 4.x f39
  5. View all the Docker images:

    podman images
  6. Run a specific build in a container:

    podman run -dit --name test-run [image-hash]
  7. Clone the GDNative-Ropesim repository (including its submodules):

    git clone --recurse-submodules git@github.com:mphe/GDNative-Ropesim.git
    cd GDNative-Ropesim
  8. Copy the project files into the container:

    podman cp . test:/root/
  9. Enter the container:

    podman exec -it test-run bash
  10. Within the container, navigate to the GDNative-Ropesim directory and build, e.g. for Android:

    cd GDNative-Ropesim/
    scons platform=android target=template_debug arch=arm64 -j2
    scons platform=android target=template_release arch=arm64 -j2
  11. Copy the built libraries from the container to the local machine (run these outside of the container):

    podman cp test:/root/GDNative-Ropesim/demo/addons/ropesim/bin/libropesim.android.template_release.arm64.so .
    podman cp test:/root/GDNative-Ropesim/demo/addons/ropesim/bin/libropesim.android.template_debug.arm64.so .

This way you keep your PC clean from installing some 20 different libraries.

mphe commented

Fixed in 3c440ce