Using Linux toolchain to cross compile static library

Hi,

While working toward adding Linux support to the SocketIO UE4 plugin, I have been trying to compile the static libs on linux, adding them to the plugin and cross compiling a project for linux. Unfortunately linking is not going well, which might come from the different compilers used.

So to avoid this issue I tried to use the UE4 toolchain to cross compile the SocketIO client static lib, which should avoid any issues.
I have to admit that my knowledge of cross compilation is limited, and I could not find any information online.

Is there any information available on the topic?
Does someone have an example of either 3rd party static library compilation on Linux, or better, directly using the UE4 toolchain through a CMake toolchain?

Here is the library: GitHub - socketio/socket.io-client-cpp: C++11 implementation of Socket.IO client

Here is the plugin I tried to add linux compatibility for: GitHub - getnamo/socketio-client-ue4: socket.io client plugin for Unreal Engine 4

It seems others have been trying to use the toolchain but couldn’t manage to use it directly through CMake: GitHub - PjotrSvetachov/VRPNInput: A Unreal Engine 4 plugin to add VRPN input to blueprints.

It’s still a good news as it means it is doable, just gotta figure out how now. :wink:

The build script I used for the compilation can be found here (note that the build script used an older version of the cross-compile toolchain, I don’t know if it will work with the new one.): VRPNInput/CrossCompile.bat at master · PjotrSvetachov/VRPNInput · GitHub

Basically I just hand-picked and compiled the files I needed for that project. I didn’t use any of the build systems that came with the vrpn library.

This was done like a year ago so a lot has changed and this is also probably now the way to do it but it worked out for me then :slight_smile:

May be you can set CC and CXX variables to point to Clang? Also see this file for example /UnrealEngine/Engine/Source/ThirdParty/PhysX/Externals/CMakeModules/Linux/LinuxCrossToolchain.multiarch.cmake