Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails: error: unknown type name 'j_decompress_ptr' #8397

Closed
yurivict opened this issue Apr 25, 2024 · 3 comments
Closed

Build fails: error: unknown type name 'j_decompress_ptr' #8397

yurivict opened this issue Apr 25, 2024 · 3 comments

Comments

@yurivict
Copy link

馃悰 Describe the bug

FAILED: /usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/build/temp.freebsd-14.0-STABLE-amd64-cpython-39/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/decode_png.o 
c++ -MMD -MF /usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/build/temp.freebsd-14.0-STABLE-amd64-cpython-39/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/decode_png.o.d -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -DPNG_FOUND=1 -DJPEG_FOUND=0 -DNVJPEG_FOUND=0 -I/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc -I/usr/local/include/libpng16 -I/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc -I/usr/local/lib/python3.9/site-packages/torch/include -I/usr/local/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.9/site-packages/torch/include/TH -I/usr/local/lib/python3.9/site-packages/torch/include/THC -I/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image -I/usr/local/lib/python3.9/site-packages/torch/include -I/usr/local/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/usr/local/lib/python3.9/site-packages/torch/include/TH -I/usr/local/lib/python3.9/site-packages/torch/include/THC -I/usr/local/include/python3.9 -c -c /usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/decode_png.cpp -o /usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/build/temp.freebsd-14.0-STABLE-amd64-cpython-39/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/decode_png.o -g0 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_clang"' '-DPYBIND11_STDLIB="_libcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1002"' -DTORCH_EXTENSION_NAME=image -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
In file included from /usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/decode_png.cpp:3:
/usr/ports/misc/py-torchvision/work-py39/vision-0.18.0/torchvision/csrc/io/image/cpu/exif.h:200:40: error: unknown type name 'j_decompress_ptr'
  200 | inline int fetch_jpeg_exif_orientation(j_decompress_ptr cinfo) {
      |                                        ^
1 error generated.

Versions

0.18.0
pytorch-2.2.2
clang-18
Python-3.9

@yurivict yurivict changed the title Build fails with PyTorch-2.2.2: error: unknown type name 'j_decompress_ptr' Build fails: error: unknown type name 'j_decompress_ptr' Apr 25, 2024
@NicolasHug
Copy link
Member

@yurivict Can you please share the snippet you used to build torchvision? As well as the full output of

wget https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

@lrhammond
Copy link

I had the same error and got things to compile by editing vision-0.18.0/torchvision/csrc/io/image/cpu/exif.h. Specifically, I moved #include <jpeglib.h> to outside the #if JPEG_FOUND condition. Further down in this file you can see that it makes use of j_decompress_ptr both under the condition #if JPEG_FOUND and under #else. I'm not sure whether the latter is deliberate, as I can see that the relevant lines are:

#else // #if JPEG_FOUND
inline int fetch_jpeg_exif_orientation(j_decompress_ptr cinfo) {
  return -1;
}
#endif // #if JPEG_FOUND

This indicates that perhaps this used to be #if JPEG_FOUND but has been changed. I didn't test this yet, but my guess is that if these lines had been changed back to #if JPEG_FOUND instead of #else, then that would have also solved the problem, because j_decompress_ptr would not be needed anywhere.

Hope that helps!

@NicolasHug
Copy link
Member

Thanks @lrhammond .

I suspect we've fixed that build issue already (probably in https://github.com/pytorch/vision/pull/8342/files) because the lines you're referring to aren't present in the code anymore. I suspect the latest changes weren't pulled in when you tried to build from source?

I'll close this issue as I believe if it has been resolved, but please feel free to re-open a new one if the build keeps failing on the latest main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants