Skip to content

Conversation

zeruniverse
Copy link
Contributor

When building libtorchvision.so for C++ following README

mkdir build
cd build
# Add -DWITH_CUDA=on support for the CUDA if needed
cmake ..
make
make install

I found the built library is not linked to libpng / libjpeg. After some debug, I found #if *_FOUND presents in related source files but corresponding macros is not set in CMakeLists.txt.

I have tested that with this PR, the built libtorchvision.so successfully links to libpng and libjpeg

@facebook-github-bot
Copy link
Contributor

Hi @zeruniverse!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Mar 4, 2022

💊 CI failures summary and remediations

As of commit ab362f7 (more details on the Dr. CI page):


  • 1/1 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build cmake_windows_gpu (1/1)

Step: "set -ex
source packaging/windows/internal/vc_install_helper.sh
packaging/windows/internal/cuda_install.bat
packaging/build_cmake.sh
" (full log | diagnosis details | 🔁 rerun)

C:\Users\circleci\project\cpp_build\Release\tor...rs\circleci\project\cpp_build\torchvision.vcxproj]
       "C:\Users\circleci\project\cpp_build\INSTALL.vcxproj" (default target) (1) ->
       "C:\Users\circleci\project\cpp_build\ALL_BUILD.vcxproj" (default target) (3) ->
       "C:\Users\circleci\project\cpp_build\torchvision.vcxproj" (default target) (4) ->
       (Link target) -> 
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegGetProperty referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegCreateSimple referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegJpegStateCreate referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegJpegStateDestroy referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegGetImageInfo referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         decode_jpeg_cuda.obj : error LNK2019: unresolved external symbol nvjpegDecode referenced in function "class at::Tensor __cdecl vision::image::decode_jpeg_cuda(class at::Tensor const &,__int64,struct c10::Device)" (?decode_jpeg_cuda@image@vision@@YA?AVTensor@at@@AEBV34@_JUDevice@c10@@@Z) [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]
         C:\Users\circleci\project\cpp_build\Release\torchvision.dll : fatal error LNK1120: 6 unresolved externals [C:\Users\circleci\project\cpp_build\torchvision.vcxproj]

    0 Warning(s)
    7 Error(s)

Time Elapsed 00:00:03.51


Exited with code exit status 1


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@zeruniverse zeruniverse changed the title Add *_FOUND macros to CMakeLists.txt Fix libtorchvision.so not able to encode images by adding *_FOUND macros to CMakeLists.txt Apr 30, 2022
Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zeruniverse , LGTM

@NicolasHug NicolasHug merged commit 7c8ab62 into pytorch:main May 3, 2022
facebook-github-bot pushed a commit that referenced this pull request May 6, 2022
…FOUND macros to CMakeLists.txt (#5547)

Summary:
* Add *_FOUND macros to CMakeLists.txt

* Remove NVJPEG as it fails CI

Reviewed By: jdsgomes, NicolasHug

Differential Revision: D36095650

fbshipit-source-id: 6cdd417b651b49b73f2eb8138965c6614baa6288

Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants