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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libjpeg: add missing stdlib includes in the public header #23428

Closed
wants to merge 1 commit into from

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Apr 9, 2024

libjpeg is apparently missing #include <stddef.h> and #include <stdio.h> in its exported jpeglib.h main public header.

To check whether the package works correctly without additional stdlib includes before its headers.
@valgur
Copy link
Contributor Author

valgur commented Apr 9, 2024

Currently only re-ordered the includes in test_package to not include anything else before #include <jpeglib.h> to demonstrate the issue. Will add a patch next.

@valgur valgur mentioned this pull request Apr 9, 2024
@jcar87 jcar87 self-assigned this Apr 9, 2024
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Failure in build 1 (33e4022d016afa319fbf1b4558cfd193174ce5d1):

  • libjpeg/9e:
    Didn't run or was cancelled before finishing

  • libjpeg/9c:
    CI failed to create some packages (All logs)

    Logs for packageID b34df74c5d19404b38553e37011cc9839b6cc02c:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=5
    os=Linux
    [options]
    libjpeg:shared=True
    
    [...]
       ^
    In file included from /home/conan/workspace/prod-v1/bsr/cci-7ffeaef6/recipes/libjpeg/all/test_package/test_transupp.c:1:0:
    /home/conan/workspace/prod-v1/bsr/18541/cabfe/.conan/data/libjpeg/9c/_/_/package/b34df74c5d19404b38553e37011cc9839b6cc02c/include/jpeglib.h:964:34: error: unknown type name ‘size_t’
     EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
                                      ^
    /home/conan/workspace/prod-v1/bsr/18541/cabfe/.conan/data/libjpeg/9c/_/_/package/b34df74c5d19404b38553e37011cc9839b6cc02c/include/jpeglib.h:966:36: error: unknown type name ‘size_t’
     EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
                                        ^
    /home/conan/workspace/prod-v1/bsr/18541/cabfe/.conan/data/libjpeg/9c/_/_/package/b34df74c5d19404b38553e37011cc9839b6cc02c/include/jpeglib.h:974:30: error: unknown type name ‘FILE’
     EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
                                  ^
    /home/conan/workspace/prod-v1/bsr/18541/cabfe/.conan/data/libjpeg/9c/_/_/package/b34df74c5d19404b38553e37011cc9839b6cc02c/include/jpeglib.h:975:29: error: unknown type name ‘FILE’
     EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
                                 ^
    make[2]: *** [test_package/CMakeFiles/test_package.dir/test_package.c.o] Error 1
    make[1]: *** [test_package/CMakeFiles/test_package.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    /home/conan/workspace/prod-v1/bsr/cci-7ffeaef6/recipes/libjpeg/all/test_package/test_transupp.c: In function ‘main’:
    /home/conan/workspace/prod-v1/bsr/cci-7ffeaef6/recipes/libjpeg/all/test_package/test_transupp.c:53:5: warning: implicit declaration of function ‘jpeg_stdio_src’ [-Wimplicit-function-declaration]
         jpeg_stdio_src(&src, fin);
         ^
    /home/conan/workspace/prod-v1/bsr/cci-7ffeaef6/recipes/libjpeg/all/test_package/test_transupp.c:79:5: warning: implicit declaration of function ‘jpeg_stdio_dest’ [-Wimplicit-function-declaration]
         jpeg_stdio_dest(&dst, fout);
         ^
    make[2]: *** [test_package/CMakeFiles/test_transupp.dir/test_transupp.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [test_package/CMakeFiles/test_transupp.dir/all] Error 2
    make: *** [all] Error 2
    libjpeg/9c (test package): WARN: 
         ************************************************
         The 'cmake_find_package' generator is deprecated.
         Please update your code and remove it.
         *************************************************
    
    libjpeg/9c (test package): WARN: 
         ************************************************
         The 'cmake' generator is deprecated.
         Please update your code and remove it.
         *************************************************
    
    libjpeg/9c (test package): WARN: 
         ************************************************
         The 'cmake_find_package_multi' generator is deprecated.
         Please update your code and remove it.
         *************************************************
    
    libjpeg/9c (test package): WARN: **** The 'from conans import CMake' helper is deprecated. Please update your code and remove it. ****
    ERROR: libjpeg/9c (test package): Error in build() method, line 21
    	cmake.build()
    	ConanException: Error 2 while executing cmake --build '/home/conan/workspace/prod-v1/bsr/cci-7ffeaef6/recipes/libjpeg/all/test_v1_package/build/ce0c03c2820cf79e615fab6dcfbe3aa82f18346a' '--' '-j3'
    
  • libjpeg/9d:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

See details:

Failure in build 1 (33e4022d016afa319fbf1b4558cfd193174ce5d1):

  • libjpeg/9e:
    CI failed to create some packages (All logs)

    Logs for packageID b647c43bfefae3f830561ca202b6cfd935b56205:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.cppstd=17
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    [options]
    */*:shared=False
    
    [...]
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:965:34: error: unknown type name 'size_t'
      965 | EXTERN(void) jpeg_CreateCompress JPP((j_compress_ptr cinfo,
          |                                  ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:965:34: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:967:36: error: unknown type name 'size_t'
      967 | EXTERN(void) jpeg_CreateDecompress JPP((j_decompress_ptr cinfo,
          |                                    ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:967:36: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:975:30: error: unknown type name 'FILE'
      975 | EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
          |                              ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:28:1: note: 'FILE' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
       27 | #include "jmorecfg.h"           /* seldom changed options */
      +++ |+#include <stdio.h>
       28 | 
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:976:29: error: unknown type name 'FILE'
      976 | EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
          |                             ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:976:29: note: 'FILE' is defined in header '<stdio.h>'; did you forget to '#include <stdio.h>'?
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:979:28: error: unknown type name 'size_t'
      979 | EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
          |                            ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:979:28: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:982:27: error: unknown type name 'size_t'
      982 | EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo,
          |                           ^~~
    /home/conan/workspace/prod-v2/bsr/16297/cbeaf/p/libjpd735090e768e2/p/include/jpeglib.h:982:27: note: 'size_t' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
    /home/conan/workspace/prod-v2/bsr/cci-a522545a/recipes/libjpeg/all/test_package/test_transupp.c: In function 'main':
    /home/conan/workspace/prod-v2/bsr/cci-a522545a/recipes/libjpeg/all/test_package/test_transupp.c:53:5: warning: implicit declaration of function 'jpeg_stdio_src' [-Wimplicit-function-declaration]
       53 |     jpeg_stdio_src(&src, fin);
          |     ^~~~~~~~~~~~~~
    /home/conan/workspace/prod-v2/bsr/cci-a522545a/recipes/libjpeg/all/test_package/test_transupp.c:79:5: warning: implicit declaration of function 'jpeg_stdio_dest' [-Wimplicit-function-declaration]
       79 |     jpeg_stdio_dest(&dst, fout);
          |     ^~~~~~~~~~~~~~~
    CMakeFiles/test_transupp.dir/build.make:62: recipe for target 'CMakeFiles/test_transupp.dir/test_transupp.c.o' failed
    make[2]: *** [CMakeFiles/test_transupp.dir/test_transupp.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    CMakeFiles/test_package.dir/build.make:62: recipe for target 'CMakeFiles/test_package.dir/test_package.c.o' failed
    make[2]: *** [CMakeFiles/test_package.dir/test_package.c.o] Error 1
    CMakeFiles/Makefile2:76: recipe for target 'CMakeFiles/test_package.dir/all' failed
    make[1]: *** [CMakeFiles/test_package.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    CMakeFiles/Makefile2:108: recipe for target 'CMakeFiles/test_transupp.dir/all' failed
    make[1]: *** [CMakeFiles/test_transupp.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    
    ERROR: libjpeg/9e (test package): Error in build() method, line 34
    	cmake.build()
    	ConanException: Error 2 while executing
    
  • libjpeg/9d:
    Didn't run or was cancelled before finishing

  • libjpeg/9c:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@valgur
Copy link
Contributor Author

valgur commented Apr 9, 2024

Huh. Apparently it's by design: libjpeg-turbo/libjpeg-turbo#17 (comment)
I suppose we should keep it that way then.

@valgur valgur closed this Apr 9, 2024
@jcar87
Copy link
Contributor

jcar87 commented Apr 9, 2024

Hi @valgur - thanks for opening this PR.

A couple notes:

on the other hand, i can see this is a very complex test package that really doesn't add much. The typical test package, unless there's a strong justification, should just be limited to including a public header and calling a function where the symbol is provided by the library (as opposed to a function that is self-contained in a header). ANY such function would do - even if it the expected results in an error. So I would strongly encourage to simplify this test package as much as possible.

@valgur
Copy link
Contributor Author

valgur commented Apr 9, 2024

@jcar87 Sorry, I did not see your message before closing.

As I mentioned in the previous comment, it was currently just a draft PR without an actual fix just do demonstrate that using libjpeg without a preceding #include <stdio.h> does not work. I could have included more details, though, I agree. The build fails due to undefined size_t and FILE without the include.

This would normally be considered a bug in an upstream project, but it's apparently intentional and should be kept that way for consistency.

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

Successfully merging this pull request may close these issues.

3 participants