Compile libtorch c++ api from source

Hey, i need to compile libtorch with c++ api to QNX operating system on arm64. for that i need to get libtorch source code and to adjust it to my environment. is there anyway to get the source code of libtorch with c++ api. without clone and build the whole pytorch project?
P.S. if its more easy i can manage with building only libtorch c++ support for jit.
Thanks.

Hello,

Sorry, the libtorch you can download from pytorch.org is based on x64(amd64) architecture. Other architecture’s libtorch ( armv7l on raspberry pi(raspian), aarch64(arm64) on raspberry pi(ubuntu) ) and pytorch must be compiled from source, or ask somebody else to get the compiled result.

I want to tell you my experience of building libtorch on Raspberry 4 4GB (Raspian, armv7l)

Since you just want the libtorch C++ api, and Python API is not in consideration, and QNX is a UNIX operating system. emm…

you QNX should have a python3.5+ (I tested cmake+make, but it does not work at all, so I changed the reply here)

clone the pytorch source code:

git clone --recursive https://github.com/pytorch/pytorch.git

and then

cd pytorch
python3 tools/build_libtorch.py

to get libtorch on aarch64(arm64) devices.

(in fact, as far as I observed from pytorch’s building guide, this building method(cmake+make) is not that recommended, but it works)

Compiling directly on arm device really needs a long time… so if possible, you can try cross-platform compiling tools. I do not know if there exists that tool and option for compiling libtorch.

That is what i have experienced and thought, hope it might help you a little.

yours sincerely,
@wmf1997