That probably the part where I’m having an issue.
In other linker flags I need to add the path of each archive file in /install/lib in order to build on IOS instead of only adding the libtorch.a path as is it said in the IOS Pytorch Tutorial.
It looks like that

$(PROJECT_DIR)/pytorch/install/lib/libtorch.a
$(PROJECT_DIR)/pytorch/install/lib/libc10.a
$(PROJECT_DIR)/pytorch/install/lib/libcpuinfo.a
$(PROJECT_DIR)/pytorch/install/lib/libpthreadpool.a $(PROJECT_DIR)/pytorch/install/lib/libpytorch_qnnpack.a $(PROJECT_DIR)/pytorch/install/lib/libtorch_cpu.a
$(PROJECT_DIR)/pytorch/install/lib/libclog.a
$(PROJECT_DIR)/pytorch/install/lib/libeigen_blas.a

Adding -all_load flag bring me to this error
duplicate symbol '_pthreadpool_compute_4d_tiled' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool.cc.o)

duplicate symbol '_pthreadpool_compute_3d_tiled' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool.cc.o)

duplicate symbol '_pthreadpool_compute_2d_tiled' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool.cc.o)

duplicate symbol '_pthreadpool_compute_1d_tiled' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool.cc.o)

duplicate symbol '_pthreadpool_compute_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool.cc.o)

duplicate symbol '_pthreadpool_destroy' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_impl.cc.o)

duplicate symbol '_pthreadpool_get_threads_count' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_impl.cc.o)

duplicate symbol '_pthreadpool_create' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_impl.cc.o)

duplicate symbol '_pthreadpool_compute_1d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-legacy.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_impl.cc.o)

duplicate symbol '_pthreadpool_parallelize_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_6d_tile_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_5d_tile_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_4d_tile_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_3d_tile_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_2d_tile_2d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_1d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_2d_tile_1d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

duplicate symbol '_pthreadpool_parallelize_1d_tile_1d' in:

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libpthreadpool.a(threadpool-pthreads.c.o)

    /Users/root_anatoscope/Documents/cross-compile/opencvxcode/pytorch/install/lib/libtorch_cpu.a(pthreadpool_new_if_impl.c.o)

ld: 18 duplicate symbols for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

-force_load flag bring me to the previous issue