google / oss-fuzz

OSS-Fuzz - continuous fuzzing for open source software.
https://google.github.io/oss-fuzz
Apache License 2.0
10.17k stars 2.17k forks source link

Build failure in leptonica not related to leptonica #8152

Closed DanBloomberg closed 1 year ago

DanBloomberg commented 1 year ago

Problem appears to be in webp with a set of functions related to SharpYuv. Here are some of the error messages:

Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function SafeInitSharpYuv': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:181: undefined reference toSharpYuvInit' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function PreprocessARGB': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:197: undefined reference toSharpYuvGetConversionMatrix' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /src/libwebp/src/enc/picture_csp_enc.c:193: undefined reference to SharpYuvConvert' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in functionSafeInitSharpYuv': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:181: undefined reference to SharpYuvInit' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in functionPreprocessARGB': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:197: undefined reference to SharpYuvGetConversionMatrix' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /src/libwebp/src/enc/picture_csp_enc.c:193: undefined reference toSharpYuvConvert' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function SafeInitSharpYuv': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:181: undefined reference toSharpYuvInit' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /work/lib/libwebp.a(libwebpencode_la-picture_csp_enc.o): in function PreprocessARGB': Step #3 - "compile-afl-address-x86_64": /src/libwebp/src/enc/picture_csp_enc.c:197: undefined reference toSharpYuvGetConversionMatrix' Step #3 - "compile-afl-address-x86_64": /usr/bin/ld: /src/libwebp/src/enc/picture_csp_enc.c:193: undefined reference to `SharpYuvConvert' Step #3 - "compile-afl-address-x86_64": clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

jonathanmetzman commented 1 year ago

This is an error in one of your dependencies? I'm not sure what I can do about this.

DanBloomberg commented 1 year ago

Strange. I haven't made any changes, and all of a sudden it fails to find some webp function that I never heard of. One possibility is a new version of webp was put out that has a problem building with my script and your system.

I did not write the oss-fuzz-build.sh script, and can't tell if there is something improper in the libwebp section. @AdamKorcz do you have an idea about this.

DavidKorczynski commented 1 year ago

@DanBloomberg I made a pull request on the Leptonica repository with fixes to the build

The main problem was that libwebp.a needs linking to libsharpyuv.a now. A minor issue was also found in one of the fuzzers that needed updating, but verified locally the build passes with the changes in the PR. https://github.com/DanBloomberg/leptonica/pull/635

magicse commented 1 year ago

||=== Build: all in realesrgan-ncnn-vulkan (compiler: GNU GCC Compiler) ===| Z:\demo\Real-ESRGAN-ncnn-vulkan\src\wic_image.h||In function 'int wic_encode_jpeg_image(const wchar_t, int, int, int, void)':| Z:\demo\Real-ESRGAN-ncnn-vulkan\src\wic_image.h|179|warning: ISO C++ forbids converting a string constant to 'LPOLESTR' {aka 'wchar_t*'} [-Wwrite-strings]| ........\LibWebP_GIT\libwebp\Build\install\lib\libwebp.a(picture_csp_enc.c.obj):picture_csp_en|| undefined reference to SharpYuvInit'| ..\..\..\..\LibWebP_GIT\libwebp\Build\install\lib\libwebp.a(picture_csp_enc.c.obj):picture_csp_en|| undefined reference toSharpYuvGetConversionMatrix'| ........\LibWebP_GIT\libwebp\Build\install\lib\libwebp.a(picture_csp_enc.c.obj):picture_csp_en|| undefined reference to SharpYuvConvert'| ..\..\..\..\..\..\mingw64\x86_64-w64-mingw32\lib\libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e)||undefined reference toWinMain'| .||error: ld returned 1 exit status| [CMakeFiles\realesrgan-ncnn-vulkan.dir\build.make|129|realesrgan-ncnn-vulkan.exe] Error 1| [CMakeFiles\Makefile2|109|CMakeFiles/realesrgan-ncnn-vulkan.dir/all] Error 2| [Z:\AI_SDK\CPP_GFPGAN\Real-ESRGAN-ncnn-vulkan\demo\Real-ESRGAN-ncnn-vulkan\Build\Makefile|90|all] Error 2|

DanBloomberg commented 1 year ago

I thought this issue was resolved. A new library dependency on libwebp, libsharpyuv, suddenly happened. The build script was fixed to include this library, and the build succeeded.

@magicse what is the context of these errors? a new build platform? is this an oss-fuzz issue?

DavidKorczynski commented 1 year ago

@DanBloomberg the build is working fine!

I think the comment is out of context and not relevant.

magicse commented 1 year ago

Sorry I was wrong.