I want to implement grpc on UE4 and build iOS / Android

Nice to meet you, I am currently writing an application for ios / android using UE4.
But I am facing a big problem.

The application under construction uses gRPC to communicate with the server.
But I’m not sure how to incorporate gRPC into UE4.
When I searched by myself, I found that the pioneer published a wonderful plugin.

InfraworldRuntime (GitHub - vizor-games/InfraworldRuntime: A solution that enables Unreal Engine 4 to work with Google gRPC services from either C++ or Blueprints.)
(Great! Thank you!)

I have succeeded in communicating with the UE editor on Windows using this, but the application I am creating must also run on iOS / Android.

Looking at the official gRPC documentation, I first tested the Android build.

I created a Linux virtual environment, started the build as shown below, and created a * .a file.

RUN cmake ${BUILD_DIR}/grpc-source \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=/usr/local/test/grpc \
  -Dprotobuf_BUILD_TESTS=OFF \
  -DgRPC_RE2_PROVIDER=module \
  -DgRPC_ZLIB_PROVIDER=package \
  -DZLIB_INCLUDE_DIR=${BUILD_DIR}\Engine\Source\ThirdParty\zlib\v1.2.8\include\Linux\aarch64-unknown-linux-gnueabi \
  -DZLIB_LIBRARY_DEBUG=${BUILD_DIR}\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Linux\aarch64-unknown-linux-gnueabi\libz_fPIC.a \
  -DZLIB_LIBRARY_RELEASE=${BUILD_DIR}\Engine\Source\ThirdParty\zlib\v1.2.8\lib\Linux\aarch64-unknown-linux-gnueabi\libz_fPIC.a \
  -DgRPC_SSL_PROVIDER=package \
  -DOPENSSL_INCLUDE_DIR=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\include\Linux\aarch64-unknown-linux-gnueabi \
  -DLIB_EAY_LIBRARY_DEBUG=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libcrypto.a \
  -DLIB_EAY_LIBRARY_RELEASE=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libcrypto.a \
  -DLIB_EAY_DEBUG=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1\Lib\Linux\aarch64-unknown-linux-gnueabi\libcrypto.a \
  -DLIB_EAY_RELEASE=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1\Lib\Linux\aarch64-unknown-linux-gnueabi\libcrypto.a \
  -DSSL_EAY_DEBUG=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libssl.a \
  -DSSL_EAY_LIBRARY_DEBUG=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libssl.a \
  -DSSL_EAY_LIBRARY_RELEASE=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libssl.a \
  -DSSL_EAY_RELEASE=${BUILD_DIR}\Engine\Source\ThirdParty\OpenSSL\1.1.1c\Lib\Linux\aarch64-unknown-linux-gnueabi\libssl.a \
  -DgRPC_BUILD_CSHARP_EXT=OFF

I created an Android folder in the hierarchy where the * .lib file is installed and put the * .a file created from here in it.
And I wrote in * .Build.cs to read all * .a files in the Android folder if the Platform is Android.
Then I launched the UE editor and ran the packaging for Android but it failed with the following error:

ld.lld: error: S:/MyProject/Release/libraries/Android\libz.a(compress.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libz.a(deflate.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libz.a(inflate.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(arena.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(generated_message_util.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(coded_stream.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(zero_copy_stream.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(message_lite.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(parse_context.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(repeated_field.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(common.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf-lite.a(wire_format_lite.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(arena.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(generated_message_util.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(coded_stream.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(zero_copy_stream.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(message_lite.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(parse_context.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(repeated_field.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: S:/MyProject/Release/libraries/Android\libprotobuf.a(common.cc.o) is incompatible with armelf_linux_eabi
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I investigated this error but didn’t understand.
I’m new to English, so I rely on machine translation.
I think the text is difficult to read, but could you please help me?

I will add it because there was progress in my own investigation.

After reviewing cmake options etc. with reference to the above
I created a Docker container like the one below and ran a C ++ build in a Linux environment

FROM debian:stretch

RUN apt-get update && apt-get install -y \
  build-essential autoconf libtool git pkg-config curl \
  automake libtool curl make g++ unzip cmake wget tar sudo libssl-dev clang libc++-dev \
  && apt-get clean

# jdk install
RUN  apt-get install -y openjdk-8-jre
RUN mkdir /usr/local/android
WORKDIR /usr/local/android
RUN wget https://dl.google.com/android/repository/android-ndk-r21b-linux-x86_64.zip
RUN unzip android-ndk-r21b-linux-x86_64.zip

# install grpc
ENV GRPC_RELEASE_TAG v1.32.x
RUN git clone -b ${GRPC_RELEASE_TAG} https://github.com/grpc/grpc /var/local/git/grpc
WORKDIR /var/local/git/grpc
RUN ls -la
RUN git fetch
RUN git submodule update --init

RUN mkdir /usr/build
WORKDIR /usr/build
RUN cmake /var/local/git/grpc \
    -DCMAKE_TOOLCHAIN_FILE=/usr/local/android/android-ndk-r21b/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=armeabi-v7a \
    -DANDROID_PLATFORM=android-26 \
    -DANDROID_STL=c++_static \
    -DRUN_HAVE_STD_REGEX=0 \
    -DRUN_HAVE_POSIX_REGEX=0 \
    -DRUN_HAVE_STEADY_CLOCK=0 \
    -Dprotobuf_BUILD_TESTS=OFF \
    -DCMAKE_BUILD_TYPE=Release 
RUN cmake --build . --target grpc++

Move the resulting * .a file to your UE4 project
I tried Android packaging again, but it failed with the following error.

ld.lld: error: duplicate symbol: SSL_clear
>>> defined at ssl_lib.cc:2896 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_lib.cc:2896)
>>>            ssl_lib.cc.o:(SSL_clear) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_lib.o:(.text.SSL_clear+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CIPHER_description
>>> defined at ssl_cipher.cc:1589 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1589)
>>>            ssl_cipher.cc.o:(SSL_CIPHER_description) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_CIPHER_description+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CIPHER_get_version
>>> defined at ssl_cipher.cc:1705 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1705)
>>>            ssl_cipher.cc.o:(SSL_CIPHER_get_version) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_CIPHER_get_version+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CIPHER_get_name
>>> defined at ssl_cipher.cc:1491 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1491)
>>>            ssl_cipher.cc.o:(SSL_CIPHER_get_name) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_CIPHER_get_name+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CIPHER_get_bits
>>> defined at ssl_cipher.cc:1546 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1546)
>>>            ssl_cipher.cc.o:(SSL_CIPHER_get_bits) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_CIPHER_get_bits+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CIPHER_get_id
>>> defined at ssl_cipher.cc:1377 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1377)
>>>            ssl_cipher.cc.o:(SSL_CIPHER_get_id) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_CIPHER_get_id+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_COMP_get_compression_methods
>>> defined at ssl_cipher.cc:1708 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1708)
>>>            ssl_cipher.cc.o:(SSL_COMP_get_compression_methods) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_COMP_get_compression_methods+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_COMP_add_compression_method
>>> defined at ssl_cipher.cc:1710 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1710)
>>>            ssl_cipher.cc.o:(SSL_COMP_add_compression_method) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_COMP_add_compression_method+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_COMP_get_name
>>> defined at ssl_cipher.cc:1712 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_cipher.cc:1712)
>>>            ssl_cipher.cc.o:(SSL_COMP_get_name) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_ciph.o:(.text.SSL_COMP_get_name+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_new
>>> defined at ssl_lib.cc:661 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_lib.cc:661)
>>>            ssl_lib.cc.o:(SSL_new) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_lib.o:(.text.SSL_new+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_get_ex_data_X509_STORE_CTX_idx
>>> defined at ssl_x509.cc:1273 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1273)
>>>            ssl_x509.cc.o:(SSL_get_ex_data_X509_STORE_CTX_idx) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_get_ex_data_X509_STORE_CTX_idx+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_dup_CA_list
>>> defined at ssl_x509.cc:1039 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1039)
>>>            ssl_x509.cc.o:(SSL_dup_CA_list) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_dup_CA_list+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_set_client_CA_list
>>> defined at ssl_x509.cc:1068 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1068)
>>>            ssl_x509.cc.o:(SSL_set_client_CA_list) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_set_client_CA_list+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CTX_set_client_CA_list
>>> defined at ssl_x509.cc:1078 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1078)
>>>            ssl_x509.cc.o:(SSL_CTX_set_client_CA_list) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_CTX_set_client_CA_list+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CTX_get_client_CA_list
>>> defined at ssl_x509.cc:1145 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1145)
>>>            ssl_x509.cc.o:(SSL_CTX_get_client_CA_list) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_CTX_get_client_CA_list+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_get_client_CA_list
>>> defined at memory:2578 (/usr\local/android/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:2578)
>>>            ssl_x509.cc.o:(SSL_get_client_CA_list) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_get_client_CA_list+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_add_client_CA
>>> defined at ssl_x509.cc:1193 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1193)
>>>            ssl_x509.cc.o:(SSL_add_client_CA) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_add_client_CA+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CTX_add_client_CA
>>> defined at ssl_x509.cc:1206 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_x509.cc:1206)
>>>            ssl_x509.cc.o:(SSL_CTX_add_client_CA) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_cert.o:(.text.SSL_CTX_add_client_CA+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_free
>>> defined at ssl_lib.cc:746 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_lib.cc:746)
>>>            ssl_lib.cc.o:(SSL_free) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_lib.o:(.text.SSL_free+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: duplicate symbol: SSL_CTX_free
>>> defined at ssl_lib.cc:626 (/var/local/git/grpc/third_party/boringssl-with-bazel/src/ssl\ssl_lib.cc:626)
>>>            ssl_lib.cc.o:(SSL_CTX_free) in archive S:/ServerTest/Plugins/InfraworldRuntime/grpc_library/Release/libraries/Android\libssl.a
>>> defined at ssl_lib.o:(.text.SSL_CTX_free+0x1) in archive C:/Program Files/Epic Games/UE_4.25/Engine/Source/ThirdParty/libcurl/lib/Android/ARMv7\libcurl.a

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I think it’s an error that a particular function is overloaded
I didn’t know how to fix this.

need to rebuild grpc with UE version ssl, I use cmd from here