Repository: pytorch
Issue: nn::Sequential Link error in Android version
Labels: module: android,oncall: mobile

#NDK 21C Build ok
cd pytorch
export ANDROID_NDK=/opt/android-ndk
export ANDROID_ABI=arm64-v8a
export ANDROID_NATIVE_API_LEVEL=28
./scripts/build_android.sh

/////////////////

build link ok
at::Tensor ref_res = at::zeros({23, 23});   

build link error
nn::Linear	actor = nn::Linear(8, 64);

#error message
1 warning generated.
[arm64-v8a] Compile++      : ppo <= actorcritic.cpp
rm -f ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -MMD -MP -MF ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o.d -target aarch64-none-linux-android28 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes  --sysroot /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument  -D_FORTIFY_SOURCE=2 -fno-exceptions -fno-rtti -fpic -O0 -UNDEBUG -fno-limit-debug-info  -Ijni/../../../../../cpp_src -Ijni/../../../../../cpp_src/libtorch/include -Ijni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include -I/opt/android-ndk/sources/cxx-stl/llvm-libc++/include -I/opt/android-ndk/sources/cxx-stl/llvm-libc++abi/include -Ijni  -fexceptions  -DANDROID -pthread -std=gnu++14 -DANDROID -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -nostdinc++ -Wformat -Werror=format-security -fno-strict-aliasing -pthread -std=gnu++14 -DANDROID -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -frtti  -c  jni/../../../../../cpp_src/actorcritic.cpp -o ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o
[arm64-v8a] SharedLibrary  : libppo.so
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `LinearImpl':
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -Wl,-soname,libppo.so -shared ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/jniapi.o ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/link_list.o ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/servermessage.o ./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o -Wl,--whole-archive jni/../../../../../cpp_src/libtorch/lib/libc10.a jni/../../../../../cpp_src/libtorch/lib/libclog.a jni/../../../../../cpp_src/libtorch/lib/libcpuinfo.a jni/../../../../../cpp_src/libtorch/lib/libeigen_blas.a jni/../../../../../cpp_src/libtorch/lib/libnnpack.a jni/../../../../../cpp_src/libtorch/lib/libpthreadpool.a jni/../../../../../cpp_src/libtorch/lib/libpytorch_qnnpack.a jni/../../../../../cpp_src/libtorch/lib/libtorch.a jni/../../../../../cpp_src/libtorch/lib/libtorch_cpu.a jni/../../../../../cpp_src/libtorch/lib/libXNNPACK.a -Wl,--no-whole-archive /opt/android-ndk/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a /opt/android-ndk/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/arm64-v8a/libc++abi.a -lgcc -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -latomic -Wl,--exclude-libs,libatomic.a -target aarch64-none-linux-android28 -no-canonical-prefixes    -Wl,--build-id   -nostdlib++ -Wl,--no-undefined -Wl,--fatal-warnings -ldl -llog -lz -lc -lm -o ./obj/local/arm64-v8a/libppo.so
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/linear.h:53: undefined reference to `torch::nn::LinearOptions::LinearOptions(long, long)'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/linear.h:53: undefined reference to `torch::nn::LinearImpl::LinearImpl(torch::nn::LinearOptions const&)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `SequentialImpl<torch::nn::Linear>':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/sequential.h:101: undefined reference to `torch::nn::Module::Module()'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `~Module':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/module.h:(.text._ZN5torch2nn6ModuleD2Ev[_ZN5torch2nn6ModuleD2Ev]+0xc): undefined reference to `vtable for torch::nn::Module'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/module.h:(.text._ZN5torch2nn6ModuleD2Ev[_ZN5torch2nn6ModuleD2Ev]+0x10): undefined reference to `vtable for torch::nn::Module'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `torch::nn::Cloneable<torch::nn::SequentialImpl>::clone(c10::optional<c10::Device> const&) const':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:54: undefined reference to `torch::nn::Module::named_parameters(bool) const'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:67: undefined reference to `torch::nn::Module::named_buffers(bool) const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `AnyModule<torch::nn::LinearImpl>':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/any.h:(.text._ZN5torch2nn9AnyModuleC2INS0_10LinearImplEEENSt6__ndk110shared_ptrIT_EE[_ZN5torch2nn9AnyModuleC2INS0_10LinearImplEEENSt6__ndk110shared_ptrIT_EE]+0xc): undefined reference to `torch::nn::LinearImpl::forward(at::Tensor const&)'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/any.h:(.text._ZN5torch2nn9AnyModuleC2INS0_10LinearImplEEENSt6__ndk110shared_ptrIT_EE[_ZN5torch2nn9AnyModuleC2INS0_10LinearImplEEENSt6__ndk110shared_ptrIT_EE]+0x10): undefined reference to `torch::nn::LinearImpl::forward(at::Tensor const&)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `AnyModuleHolder':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h:(.text._ZN5torch2nn15AnyModuleHolderINS0_10LinearImplEJRKN2at6TensorEEEC2EONSt6__ndk110shared_ptrIS2_EE[_ZN5torch2nn15AnyModuleHolderINS0_10LinearImplEJRKN2at6TensorEEEC2EONSt6__ndk110shared_ptrIS2_EE]+0xc): undefined reference to `typeinfo for torch::nn::LinearImpl'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h:(.text._ZN5torch2nn15AnyModuleHolderINS0_10LinearImplEJRKN2at6TensorEEEC2EONSt6__ndk110shared_ptrIS2_EE[_ZN5torch2nn15AnyModuleHolderINS0_10LinearImplEJRKN2at6TensorEEEC2EONSt6__ndk110shared_ptrIS2_EE]+0x10): undefined reference to `typeinfo for torch::nn::LinearImpl'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `torch::nn::AnyValue torch::nn::AnyModuleHolder<torch::nn::LinearImpl, at::Tensor const&>::InvokeForward::operator()<at::Tensor>(at::Tensor&&)':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/any_module_holder.h:63: undefined reference to `torch::nn::LinearImpl::forward(at::Tensor const&)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE':
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x40): undefined reference to `typeinfo for torch::nn::Module'
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x44): undefined reference to `typeinfo for torch::nn::Module'
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x48): undefined reference to `typeinfo for torch::nn::LinearImpl'
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn10LinearImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x4c): undefined reference to `typeinfo for torch::nn::LinearImpl'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `Module':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/module.h:(.text._ZN5torch2nn6ModuleC2ERKS1_[_ZN5torch2nn6ModuleC2ERKS1_]+0xc): undefined reference to `vtable for torch::nn::Module'
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/module.h:(.text._ZN5torch2nn6ModuleC2ERKS1_[_ZN5torch2nn6ModuleC2ERKS1_]+0x10): undefined reference to `vtable for torch::nn::Module'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn14SequentialImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE':
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn14SequentialImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn14SequentialImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x40): undefined reference to `typeinfo for torch::nn::Module'
/opt/android-ndk/sources/cxx-stl/llvm-libc++/include/memory:(.text._ZNSt6__ndk120dynamic_pointer_castIN5torch2nn14SequentialImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE[_ZNSt6__ndk120dynamic_pointer_castIN5torch2nn14SequentialImplENS2_6ModuleEEENS_9enable_ifIXaantsr8is_arrayIT_EE5valuentsr8is_arrayIT0_EE5valueENS_10shared_ptrIS6_EEE4typeERKNS8_IS7_EE]+0x44): undefined reference to `typeinfo for torch::nn::Module'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o: In function `SequentialImpl':
/root/pycharm_project/PPO_libtorch/android/application/src/main//jni/../../../../../cpp_src/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/sequential.h:97: undefined reference to `torch::nn::Module::Module()'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0xf0): undefined reference to `torch::nn::Module::train(bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0xf8): undefined reference to `torch::nn::Module::is_training() const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x100): undefined reference to `torch::nn::Module::to(c10::Device, c10::ScalarType, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x108): undefined reference to `torch::nn::Module::to(c10::ScalarType, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x110): undefined reference to `torch::nn::Module::to(c10::Device, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x118): undefined reference to `torch::nn::Module::zero_grad()'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x120): undefined reference to `torch::nn::Module::save(torch::serialize::OutputArchive&) const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x128): undefined reference to `torch::nn::Module::load(torch::serialize::InputArchive&)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTVN5torch2nn14SequentialImplE[_ZTVN5torch2nn14SequentialImplE]+0x138): undefined reference to `torch::nn::Module::is_serializable() const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0xe8): undefined reference to `torch::nn::Module::train(bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0xf0): undefined reference to `torch::nn::Module::is_training() const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0xf8): undefined reference to `torch::nn::Module::to(c10::Device, c10::ScalarType, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x100): undefined reference to `torch::nn::Module::to(c10::ScalarType, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x108): undefined reference to `torch::nn::Module::to(c10::Device, bool)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x110): undefined reference to `torch::nn::Module::zero_grad()'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x118): undefined reference to `torch::nn::Module::save(torch::serialize::OutputArchive&) const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x120): undefined reference to `torch::nn::Module::load(torch::serialize::InputArchive&)'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x128): undefined reference to `torch::nn::Module::pretty_print(std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >&) const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE[_ZTCN5torch2nn14SequentialImplE0_NS0_9CloneableINS0_14SequentialImplEEE]+0x130): undefined reference to `torch::nn::Module::is_serializable() const'
./obj/local/arm64-v8a/objs-debug/ppo/__/__/__/__/__/cpp_src/actorcritic.o:(.data.rel.ro._ZTIN5torch2nn9CloneableINS0_14SequentialImplEEE[_ZTIN5torch2nn9CloneableINS0_14SequentialImplEEE]+0x18): undefined reference to `typeinfo for torch::nn::Module'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

Android.mk
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libc10
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libc10.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libclog
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libclog.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libcpuinfo
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libcpuinfo.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libeigen_blas
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libeigen_blas.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libnnpack
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libnnpack.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libpthreadpool
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libpthreadpool.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libpytorch_qnnpack
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libpytorch_qnnpack.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libtorch
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libtorch.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libtorch_cpu
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libtorch_cpu.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libXNNPACK
LOCAL_SRC_FILES := \
../../../../../cpp_src/libtorch/lib/libXNNPACK.a
include $(PREBUILT_STATIC_LIBRARY)
##############################
########## libppo.so #########
##############################
include $(CLEAR_VARS)
LOCAL_MODULE := libppo
LOCAL_CPP_FEATURES := rtti
LOCAL_CFLAGS := -pthread -std=gnu++14 -DANDROID -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER
LOCAL_CPPFLAGS := -pthread -std=gnu++14 -DANDROID -DUSE_PTHREADPOOL -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER
	
APP_DEBUG := $(strip $(NDK_DEBUG))
ifeq ($(APP_DEBUG),1)
	LOCAL_STRIP_MODULE := false
endif

LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../../../../cpp_src \
$(LOCAL_PATH)/../../../../../cpp_src/libtorch/include \
$(LOCAL_PATH)/../../../../../cpp_src/libtorch/include/torch/csrc/api/include
                
LOCAL_SRC_FILES := \
../../../../../cpp_src/jniapi.cpp \
../../../../../cpp_src/link_list.cpp \
../../../../../cpp_src/servermessage.cpp \
../../../../../cpp_src/actorcritic.cpp

LOCAL_WHOLE_STATIC_LIBRARIES := \
libc10 \
libclog \
libcpuinfo \
libeigen_blas \
libnnpack \
libpthreadpool \
libpytorch_qnnpack \
libtorch \
libtorch_cpu \
libXNNPACK

LOCAL_LDLIBS := -ldl -llog -lz

include $(BUILD_SHARED_LIBRARY)


#my srouce code actorcritic.cpp
#include "torch/torch.h"
using namespace torch;
#include "actorcritic.h"

ActorCritic::ActorCritic()
{
	nn::Sequential	actor = nn::Sequential(nn::Linear(8, 64));
}

ActorCritic::~ActorCritic()
{
}