Help with Android Build in Unreal 5

Using the Pulse Engine with Unreal 5. We are using the older version where there were 4 lib files. I added it to Public AdditionalLLibraries in the Build.cs File. It builds properly for windows but it throws the following error for an android build. Any ideas ?
UATHelper: Packaging (Android (ASTC)): ld.lld: error: cannot open E:/wkspaces/I3NucleusPOC/UE_POC/Plugins/PulsePhysiologyEngine/Source/ThirdParty/PulseLibrary/lib/release: Is a directory

Since Pulse is a C++ library, you will need to have libraries/binaries built for each specific platform.

Currently, we are only providing libraries/binaries for the Win64 platform.

I am not very familiar with how Unreal supports code plugins on android, but I would think you will need to build Pulse for your targeted platform and update the Build.cs file for Unreal to properly build your application for your targeted platform.

I am not sure how complicated this is… but I would guess this would be challenging…

Hey Aaron, thanks for the above response. I tried to give this a shot to make an Android build with UE5.3, but having some trouble with it.

  • I first used the dockcross build flow, copied the PulseC.so and libC++shared.so into the Unreal plugin folder and added the respective module paths to the PulseLibrary.Build.cs. When I packaged for Android, it threw up this error : Lib libc++_shared depends on libc++_shared.so. There are known incompatibility issues when linking libc++_shared.so with Unreal Engine built with NDK22+. Please rebuild your dependencies with static libc++!
  • It threw the same error for PulseC.so if I added that first to the module paths instead
  • Google results about other plugins facing this suggested rebuild static instead (libC++ instead of libC++_shared), and the Pulse docs also mentioned “iOS can only link to static iOS arm64 C++ Pulse libraries”
  • Hence I felt I’ll give those settings a shot in the cmake configuration. I followed the “Using MSVC” steps on the wiki for the same, but with the Pulse_C_STATIC as ON, and the JAVA and PYTHON API as OFF.
  • The MSVC build now fails with the error: Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE) (found version “24.3.0”)

Beyond this I’m not sure what else to try, or if I’m even headed in the right direction. Any ideas or direction on this will help (using Windows 10 btw).

iOS is cross compiled using xcode, which is a whole other animal

Sounds like you need to build static libraries rather than a dynamic library

I suppose I would try to build using dockcross and adding in the -DPulse_C_STATIC:BOOL=ON and see what happens

As for why MSVC does not like that flag… sounds like something was not happy in the protobuf build, it should have built a protoc.exe which would be installed into the pulse_build/install/bin. Need to check the build log and see if something pops out as to why it was not built, or why cmake could not find it…

Hey Aaron, thanks for replying. I tried building using dockcross after adding in that flag. It still fails towards the end with the same error: Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE) (found version “24.3.0”)

I also tried manually installing protobuf within my wsl, but even that didn’t help. Also I didn’t face any errors in the dockcross build when I had NOT added the Pulse_C_STATIC flag (ofcourse finally Unreal does crib during packaging for static libs in that case). Anything else I could be missing here that’s causing this issue?

[Edit : I forgot to mention one detail. We’re using a slightly older version of Pulse, specifically the commit from Dec 5, 2023]

I also tried the latest stable Pulse (unlike the older one in the above posts), there were two things of concern.

  • I no longer see the ThirdParty folder in Visual Studio in the updated Pulse?
  • I also retried the dockross flow with the static flag on the latest Pulse. That one “finished successully”, but the logs in the middle say “Manually-specified variables were not used by the project: Pulse_C_STATIC”. Not sure if the flag actually did make a difference in that case.

Also, can you please help me figure out what exactly needs to be added as PublicAdditionalLibraries and RuntimeDependencies for Android (in the PulseEngine.Build.cs)? I see the prebuilt plugin has them added for Windows, but I’m having some trouble figuring out what all needs to be added for Android.

Looks like you need to be using Pulse_C_AS_STATIC

When you build for android, I suggest using/editing our helper scripts

If you are on windows, using wsl, you can modify this batch file which calls this batch file (Which is where you can add the static cmake flag)

The pulse build wants to build and run the protoc compiler, but since you are cross compiling, its not easy to run protoc built for android on the wsl during the build, so these scripts will copy the protoc generated files from another build rather than run the protoc compiler

As for what goes in PublicAdditionalLibraries, I would put references to all the libs that get put in pulse_build/install/lib when you get the android build going

I see. I updated it to Pulse_C_AS_STATIC, but now the build fails again with the same protobuf error : Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE) (found version “25.2.0”)

I have been editing and using those helper scripts you mentioned in most of my attempts till now (including the above one). Unreal forces static libs on Android from 5.1 onwards, so we certainly need those but I’m not sure how to get past this one.

I ran xcompile.bat with only the clang line on my machine and was able to run the clang build fine.

I have this line from my build:
-- Found Protobuf: /work/dockcross-builds/pulse-engine-linux-x64-clang/install/bin/protoc-25.2.0 (found version "25.2.0")
Is there a protoc executable in the bin directory?

Was there any error in the protobuf build?

Can you build this clang xcompile build from the Pulse repository? (no changes to the .bat files)

Hey Aaron, apologies for the delayed response, for some reason I didn’t get notified of this reply. The odd thing I’m facing is that I can build successfully using xcompile when I don’t touch the bat files at all. But when I add the Pulse_C_AS_STATIC flag, it fails with the protobuf error (both via manually cmake flow as well as just using helper scripts). Also note how my error oddly says “found version x.x.x” in the parenthesis in the end : Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE) (found version “25.2.0”)

Were you able to build using xcompile on your end with the static flag as well?

It looks like I am turning off the protoc build when we build static libraries

I will have to think about how to properly support the Pulse_C_AS_STATIC in xcompile build paradigm.

But, just looking back over this post…
By default, Pulse builds static libraries… Unreal does not use the PulseC.so/dll … I am not sure why you are trying to use it… PulseC.dll != Pulse.dll
If the point of this post is to get static libraries out of the build for use in Unreal… just run xcompile normally and use the *.a file in the android/pulse_build/install/lib folder

Thanks Aaron. I retried a standard dockcross build with no changes, threw in the .a files and edited the build.cs for the same. Now I get the same “is a directory” error that’s seen on the original post here (on the Unreal packaging). The only difference is that in original run (without the .a files added), it complained of lprotobuf being missing…now that error is no longer there. But the “cannot open ---- is a directory” errors still persist. Please help me understand if there’s something else I’m missing here.

Here’s a snap of the edited build.cs, with .a replacing the .lib dependencies in the Android codepath.

This is the error on the UE output log (same as original post, just for the android path this time): PackagingResults: Error: cannot open {ProjectDir}/Plugins/PulsePhysiologyEngine/Source/ThirdParty/PulseLibrary/lib/android: Is a directory

Note that we’re using a slightly older version of Pulse, specifically the Dec 05 commit

I am just not familiar enough with the unreal android build system to advise without doing the research.

It seems like packaging is a build step associated with the android build process… Like it’s getting things ready for a gradle step or something…

I used this project as a resource when researching how to get Pulse into the plugin as a dynamic library. I’d look through it’s android support and follow along in the unreal build system documentation to try and figure out the proper way to get Pulse into an Android target.