Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#66436 - [python-pytorch-cuda] Cmake display warnings when using find_package(Torch)

Attached to Project: Community Packages
Opened by Benjamin Charlier (bcharlier) - Monday, 27 April 2020, 15:26 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Tuesday, 28 April 2020, 19:43 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Konstantin Gizdov (kgizdov)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Dear Maintainer,


Description:

Trying to reproduce the simple example described here: https://pytorch.org/tutorials/advanced/cpp_frontend.html. I realize that the files

/usr/lib64/cmake/Caffe2Config.cmake
/usr/lib64/cmake/Gloo/GlooConfig.cmake
/usr/lib64/cmake/Torch/Config.cmake

have some references (in the comments) to

<install-prefix>/share/cmake/Caffe2Config.cmake
<install-prefix>/share/cmake/Gloo/GlooConfig.cmake
<install-prefix>/share/cmake/Torch/Config.cmake

It makes cmake throwing warnings during configuration. I guess that some paths should be update in the ***Config.cmake files to fit the directory structure of Arch.


Additional info:
* package version(s): 1.5.0-2
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:


I am compiling the following project with 2 files :

```
dcgan/
CMakeLists.txt
dcgan.cpp
```

The 'CMakeLists.txt' file contains

```
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(dcgan)

set(CMAKE_PREFIX_PATH "/usr/lib/python3.8/site-packages/torch/")
find_package(Torch REQUIRED)

add_executable(dcgan dcgan.cpp)
target_link_libraries(dcgan "${TORCH_LIBRARIES}")
set_property(TARGET dcgan PROPERTY CXX_STANDARD 14)
```

and the main file 'dcgan.cpp' contains
```
#include <torch/torch.h>
#include <iostream>

int main() {
torch::Tensor tensor = torch::eye(3);
std::cout << tensor << std::endl;
}
```

Buildig the project, cmake throw warnings:

```
...

-- Caffe2: Found gflags with new-style gflags target.
-- Caffe2: Cannot find glog automatically. Using legacy find.
CMake Warning (dev) at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to `find_package_handle_standard_args` (glog) does
not match the name of the calling package (Caffe2). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib64/cmake/Caffe2/public/glog.cmake:49 (find_package_handle_standard_args)
/usr/lib64/cmake/Caffe2/Caffe2Config.cmake:36 (include)
/usr/lib64/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

...

CMake Warning (dev) at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
The package name passed to `find_package_handle_standard_args` (torch) does
not match the name of the calling package (Torch). This can lead to
problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
/usr/lib64/cmake/Torch/TorchConfig.cmake:130 (find_package_handle_standard_args)
CMakeLists.txt:5 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

...

```

This task depends upon

Closed by  Sven-Hendrik Haase (Svenstaro)
Tuesday, 28 April 2020, 19:43 GMT
Reason for closing:  Won't fix
Comment by Benjamin Charlier (bcharlier) - Monday, 27 April 2020, 15:46 GMT
My bad should add [python-pytorch-cuda] in the topic.
Comment by Sven-Hendrik Haase (Svenstaro) - Monday, 27 April 2020, 22:34 GMT
Ok, frankly not really sure what I'm supposed to be doing here. What exactly is wrong? Can you produce a patch?
Comment by Konstantin Gizdov (kgizdov) - Tuesday, 28 April 2020, 17:33 GMT
@bcharlier - CMake throwing warnings, specifically dev warnings, is not a problem. These are the same warning we get when we build the package itself. They are caused by the upstream configuration, which is written to support older versions of CMake than the one Arch uses by default. It simply means that the upstream CMake files do not honour the new `find_package()` behaviour. I don't understand, however, how and if at all this prevents you from using pytorch or compiling against it? Could you explain?
Comment by Benjamin Charlier (bcharlier) - Tuesday, 28 April 2020, 19:08 GMT
@kgizdov : you are right, the warnings is appears with cmake 3.17 (I tested with cmake 3.14 and 3.16.5 and they do not throw any messages).

That being said, Pytorch c++ api has evolved a lot between 1.4 and 1.5 and I am experiencing problems building C++/cuda codes with this new api (codes were working with previous versions of pytorch). There are missing symbols in the compiled binary whereas the shared object dependencies list is suspiciously long. To fix that, I was planning to use the find_package(Torch) in the project but this does not suffice.

Anyway, the problem is independent from the Arch package and I suggest to close the task. Thanks for your reactivity. Sorry for the trouble.

Loading...