I need to link my own static libraries (plugins written in C++) on Android with IL2CPP backend.
Everything seems to work right except linking GNU STL static library that my libraries depend on. It looks like il2cpp.exe is not aware of this dependency and I'm getting lot of errors like:
`error: undefined reference to 'std::allocator::allocator()'`
**I can fix this** by adding explicit dependency on il2cpp.exe command line:
`--additional-libraries="C:\android-ndk-r16b\sources\cxx-stl\gnu-libstdc++\4.9\libs\armeabi\libgnustl_static.a"`
**However**, is there any standard way how to make IL2CPP builder aware of this dependency? I looked everywhere but couldn't find anything. And I don't want to "hack" the build process in any way.
I use Unity 2018.4.8f1. I could upgrade to 2019.2 if it helps.
For reference, this is my `Application.mk`:
APP_STL := gnustl_static
APP_CPPFLAGS += -std=c++11
NDK_TOOLCHAIN_VERSION := 4.9
APP_ABI := armeabi-v7a arm64-v8a x86
And `Android.mk`:
LOCAL_PATH:= $(call my-dir)
SRC_PATH := $(LOCAL_PATH)/../../
include $(CLEAR_VARS)
LOCAL_MODULE := libtest
LOCAL_SRC_FILES := test.cpp
LOCAL_C_INCLUDES += $(SRC_PATH)
LOCAL_CPPFLAGS := -fvisibility=hidden -DSTATIC_BUILD
LOCAL_DISABLE_FORMAT_STRING_CHECKS=true
include $(BUILD_STATIC_LIBRARY)
Complete il2cpp command line:
D:\Unity\2018.4.8f1\Editor\Data\il2cpp/build/il2cpp.exe
--convert-to-cpp
--emit-null-checks
--enable-array-bounds-check
--dotnetprofile="unityaot"
--compile-cpp
--libil2cpp-static
--platform="Android"
--architecture="ARMv7"
--configuration="Release"
--outputpath="D:\[...]\Temp\StagingArea\assets\bin\Data\Native\armeabi-v7a\libil2cpp.so"
--cachedirectory="D:\[...]\Assets\..\Library\il2cpp_android_armeabi-v7a/il2cpp_cache"
--additional-include-directories="D:\Unity\2018.4.8f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\bdwgc/include"
--additional-include-directories="D:\Unity\2018.4.8f1\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\libil2cpp/include"
--additional-libraries="D:\[...]\Assets/Plugins/MFG/LibNat/Android/armeabi-v7a/libtest.a"
--tool-chain-path="C:/Android/android-ndk-r16b-windows-x86_64/android-ndk-r16b"
--map-file-parser="D:\Unity\2018.4.8f1\Editor\Data\Tools\MapFileParser\MapFileParser.exe"
--directory="D:\[...]\Temp\StagingArea\assets\bin\Data\Managed"
--generatedcppdir="D:\[...]\Temp\StagingArea\Il2Cpp\il2cppOutput"
↧