Skip to content

Building libtorch + tests results in a failure #66030

@n-v-k

Description

@n-v-k

🐛 Bug

Building libtorch using CMake with binary tools and without python part will result into failure:

[100%] Linking CXX executable ../bin/aot_model_compiler
/usr/bin/ld: cannot find -laot_compiler
collect2: error: ld returned 1 exit status
binaries/CMakeFiles/aot_model_compiler.dir/build.make:106: recipe for target 'bin/aot_model_compiler' failed
make[2]: *** [bin/aot_model_compiler] Error 1
CMakeFiles/Makefile2:6428: recipe for target 'binaries/CMakeFiles/aot_model_compiler.dir/all' failed
make[1]: *** [binaries/CMakeFiles/aot_model_compiler.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

It happens because CMake script exits too early if python part is disabled.
Also it does not install required library for aot_model_compiler target.

I will provide PR wit fix.

To Reproduce

mkdir build && cd build
cmake -DBUILD_BINARY=ON -DBUILD_PYTHON=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
make

Environment

  • PyTorch Version (e.g., 1.0): master
  • OS (e.g., Linux): Ubuntu 18.04
  • How you installed PyTorch (conda, pip, source): source
  • Python version: 3.6.9

cc @malfet @seemethere

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: abilibtorch C++ ABI related problemsmodule: buildBuild system issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions