Can't run the demo for unreal engine 4.26

Hi, I want to try PhotonDemoParticle
and follow the step in
https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine

I put the photon sdk of the platform windows and android under source
pre-build libraries in
Source/Photon/lib/Android/Common-cpp/
Source/Photon/lib/Android/LoadBalancing-cpp/
Source/Photon/lib/Android/Photon-cpp/

same as windows
Source/Photon/lib/Windows/....

When I build it show the error
where
Source/Photon/Common-cpp
Source/Photon/LoadBalancing-cpp
Source/Photon/Photon-cpp

are the empty.
so what files should I put in those directories?


and another question is

https://doc.photonengine.com/en-us/realtime/current/getting-started/unreal-engine

at the step1, it asks to download Unreal Engine SDK
what do I need the SDK for ? I already had the Unreal engine installed from installer.

Any help will be apprecaited

Thanks


Comments

  • Hi @kamihiro.


    at the step1, it asks to download Unreal Engine SDK
    what do I need the SDK for ? I already had the Unreal engine installed from installer.
    Well, that step just tells you to install UE. If you already did that, then of course you can skip that step.
    so what files should I put in those directories?
    Just the "inc" folders with the header files in them, like shown in the layout pictures in the guide.
  • Hi @Kaiserludi
    Thank you for answering!

    >Just the "inc" folders with the header files in them, like shown in the layout pictures in the guide.

    Yes, it was simple, Just drop everything into the inc folder... it works.

    just have a small question. Those header files in "inc" at the each sdk platforms, Are those the same files ?

    I pick up the inc from windows platform, and put in here

    ---Photon
    | +---Common-cpp
    | | \---inc
    | | (*.h)
    | +---LoadBalancing-cpp
    | | \---inc
    | | (*.h)
    | |---Photon-cpp
    | | \---inc
    | | (*.h)


    and wonder if it will work for android as well. ( I already put the files under /lib/Android/***)




  • Hi @kamihiro.

    Yes. The C++ SDKs for all platforms all share identical header files as long as the first 3 digits of their version numbers are identical. The 4. digit can differ and it will still work.

    So, if you use i.e. version 4.1.16.5 of the Windows SDK, then these headers work with the Android SDK as well and vice versa, if the version of the Android SDK is 4.1.16.something.

    If the SDK version for one platform is 4.1.16.something and the one for aother one is 4.1.17.something or 4.1.15.something, then their APIs differ and you can't share the headers from version with the other.

    So, if you update to a new version and it isn't just an update of the last digit in the version number, then make sure that you update the SDK for all platforms.
  • Hi @Kaiserludi
    Thank you for help, it clarify my question!

    However, I still run into some problem....
    I was able to packaging with windows but when I try to packaging to Android
    I got this error
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     ld.lld: error: undefined symbol: ExitGames::Common::JString::cstr() const
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>> referenced by JString.h:162 (D:/Unreal_build\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\Common-cpp\inc\JString.h:162)
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>>               D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Intermediate/Build/Android/UE4/Development/PhotonDemoParticle/Console.cppa8.o:(Console::write(ExitGames::Common::JString const&))
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>> referenced by JString.h:162 (D:/Unreal_build\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\Common-cpp\inc\JString.h:162)
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>>               D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Intermediate/Build/Android/UE4/Development/PhotonDemoParticle/Console.cppa8.o:(OutputListener::debugReturn(int, ExitGames::Common::JString const&))
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>> referenced by JVector.h:617 (D:/Unreal_build\Photon-Unreal-SDK_DemoParticle-UE4\Source\Photon\Common-cpp\inc\JVector.h:617)
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>>               D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Intermediate/Build/Android/UE4/Development/PhotonDemoParticle/LoadBalancingListener.cppa8.o:(LoadBalancingListener::onLobbyStatsUpdate(ExitGames::Common::JVector<ExitGames::LoadBalancing::LobbyStatsResponse> const&))
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     >>> referenced 1 more times
    
    

    any tips will be great!
    Thank you

  • Hi @kamihiro.

    Those errors indicate that the libs are not linked correctly on Android.
    Likely your .Build.cs file is not correct for Android.
    You can have a look at the .Build.cs file from our UE4 integration demo project and see what id does differently then your own file in this regard.
  • Hi @Kaiserludi

    Thank you for the advice.
    the problem was I didn't put the Android files properly...
    so I fixed that and use build.cs from demo

    I got new problems..
    ATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     ld.lld: error: D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_no-rtti.a(Base.o) is incompatible with aarch64linux
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     ld.lld: error: D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_no-rtti.a(BaseCharString.o) is incompatible with aarch64linux
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     ld.lld: error: D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_no-rtti.a(Hashtable.o) is incompatible with aarch64linux
    UATHelper: パッケージ化 (Android (マルチ:ASTC,DXT,ETC2)):     ld.lld: error: D:/Unreal_build/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_no-rtti.a(KeyToObject.o) is incompatible with aarch64linux
    

    which I found on this forum someone had similar problem
    https://forum.photonengine.com/discussion/14357/integration-guide

    and follow this advice
    https://forum.photonengine.com/discussion/comment/42718/#Comment_42718.

    still got the same result..

    any help will be appreciated.
  • Hi @kamihiro.

    Please make sure that you link against the variants of the libs with have a '_libc++' in their files names for UE4.25 and newer and against the ones that don't have a '_libc++' in their files names for UE 4.24 and older.

    Example from an accordingly modified demo project .Build.cs file:
    	private void AddPhotonLibPathAndroid(ReadOnlyTargetRules Target, string name)
    	{
    		#if UE_4_25_OR_LATER
    			PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", "lib" + name + "-cpp-static_debug_android_armeabi_libc++_no-rtti.a"));
    		#else
    			PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", "lib" + name + "-cpp-static_debug_android_armeabi_no-rtti.a"));
    		#endif
    	}
    
  • I'm getting similar errors trying to run UE4.26 on Android even after adding "_libc++" to each Android.mk file. I followed all the steps in the Unreal getting started instructions.

    Do I need to have the lib files in two locations? The Android SDK comes with the libs in for example /Photon-cpp/lib/photon-cpp-prebuilt/. This is also where the Android.mk lives. Then the UE4 instructions say to put your libs in /Photon/lib/Android/.

    The UE4 instructions also say "Only the header files and pre-built libraries are required." Do I still need the Android.mk files?

    I may give 4.25 a try to see if I get different results.

    LogPlayLevel:   2> Run: D:\SHO\UE4.26\Projects\Photon-Unreal-SDK_DemoParticle-UE4\Binaries\Android\PhotonDemoParticle-arm64.so
    LogPlayLevel: Error:   2> ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Base.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(BaseCharString.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Hashtable.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(KeyToObject.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(JString.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Logger.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Interface.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Object.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(platformLayer-unix.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(ToString.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libcommon-cpp-static_debug_android_armeabi_libc++_no-rtti.a(UTF8String.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(AuthenticationValues.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Client.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(LobbyStatsRequest.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(MutableRoom.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Player.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(RaiseEventOptions.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(Room.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(RoomOptions.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   ld.lld: error: D:/SHO/UE4.26/Projects/Photon-Unreal-SDK_DemoParticle-UE4/Source/Photon/lib/Android\libloadbalancing-cpp-static_debug_android_armeabi_libc++_no-rtti.a(WebFlags.o) is incompatible with aarch64linux
    LogPlayLevel: Error:   clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    LogPlayLevel: Error:   2> Execution failed. Error: 1 (0x01) Target: 'D:\SHO\UE4.26\Projects\Photon-Unreal-SDK_DemoParticle-UE4\Binaries\Android\PhotonDemoParticle-arm64.so'
    
  • Kaiserludi
    Kaiserludi admin
    edited December 2021
    Hi @prozac.

    No, you don't need the Android.mk files at all (which of course implies, that you also don't need to modify them, either).
    Do I need to have the lib files in two locations?
    No.

    The reason for your err messages is that you have checked the box to build Android 64bit in the Unreal Engine Android settings,but link against the 32bit version of the Photon Android libs.

    In the UE editor under 'Project Settings' -> 'Platforms' -> 'Android' -> 'Build' uncheck 'Support arm64' to build for 32bit ARM.
    To build for 64 bit ARM uncheck 'Support armv7' and modify the .Build.cs file to link against the 'cpp-static_debug_android_arm64-v8a_libc++_no-rtti' variants of the Photon libs.

    If you want to build for both architectures at the same time, it gets a bit of a PITA, because there is no way to tell Unreal which libs to link to for which architecture, except for putting them in subfolders with specific folder names:
    1. Create 2 subfolders named 'ARMv7' and 'ARM64' inside the lib/Android folder.
    2. Move all libs that contain '_arm64-v8a' in their files names to the ARM64 subfolder and all libs that contain '_armeabi-v7a' in their files names to the ARMv7 subfolder.
    3. Rename all the files in the subfolders to what their name was before minus the _arm64-v8a / _armeabi-v7a part (you might want to write yourself a script to do that or use a 3rd party batch-renaming program, as otherwise you need to manually rename a lot of files)
    4. Change the function AddPhotonLibPathAndroid() in the .Build.cs file to the following:
    	private void AddPhotonLibPathAndroid(ReadOnlyTargetRules Target, string name)
    	{
    			string[] Architectures = new string[] {
    				"ARMv7",
    				"ARM64",
    			};
     
    			foreach(var Architecture in Architectures)
    			{
    				#if UE_4_25_OR_LATER
    					PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", Architecture, "lib" + name + "-cpp-static_debug_android_libc++_no-rtti.a"));
    				#else
    					PublicAdditionalLibraries.Add(Path.Combine(PhotonPath, "lib", "Android", Architecture, "lib" + name + "-cpp-static_debug_android_no-rtti.a"));
    				#endif
    			}
    	}
    

    Optionally you can also do the same for x86 and x64 (you need to build Unreal from source to be able to build for these platforms) by putting the according libs into subfolders named "x86" and "x64", adding these subfolders to the Architectures string-array in the Build.cs files and removing the '_x86' and 'x86_64' parts of the files names, if you want to support these architectures as well.
  • Thank you! I wasn't linking the arm64 libs. Once I updated the .Build.cs, it builds correctly. Luckily I only need arm64.