-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix missing symbols when libtiff depends on libjpeg #7270
Conversation
when compiling Pillow with libtiff and libjpeg (with jpeg12 enabled - which is the default with libjpeg-3.0.0) the libtiff object tif_jpeg_12.c.o uses the following libjpeg12 functions: jpeg12_read_raw_data, jpeg12_read_scanlines, jpeg12_write_raw_data, jpeg12_write_scanlines. update the ordering of libs.append(feature.tiff) to be before libs.append(feature.jpeg) to allow the linker to include the required functions. this issue occurs when the libtiff and libjpeg libraries are static (not shared.) Signed-off-by: Rudi Heitbaum <[email protected]>
Could you explain how does it work? Why the order does matter? |
the existing setup.py will be compiling the as the libtiff:tif_jpeg_12.c.o uses the following libjpeg12 functions: jpeg12_read_raw_data, jpeg12_read_scanlines, jpeg12_write_raw_data, jpeg12_write_scanlines as seen in the
this means that whereas compiling with this could also be fixes with a line such as References: |
Ok, but why linker can’t resolve the dependencies? Is it related to extern symbols like in Stackoverflow answer? I'm asking because it's not clear for me why this particular order is more correct than another and what if we'll have some symbols from libjpeg which we are using which is not present in libtiff's version. |
Yes. In that tiff uses jpeg12 (which is in jpeg). The “library providing the symbol should always be on the right” and the “user of the symbol on the left”
as above - in that libtiff needs libjpeg. libjpeg is a standalone library that does not use other libraries (specifically in this case libtiff) as in https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/BUILDING.md and https://github.com/libjpeg-turbo/libjpeg-turbo/blob/main/CMakeLists.txt there are no references to libtiff (or other libraries) whereas libtiff is using libjpeg in https://gitlab.com/libtiff/libtiff/-/blob/master/configure.ac#L548
probably a little confusion in that libtiff is NOT providing any libjpeg (or libjpeg12) symbols. Libtiff needs the libjpeg symbols. So changing the order will not impact Pillow’s use of libjpeg. |
@heitbaum thanks for explanations! |
when compiling Pillow with libtiff and libjpeg (with jpeg12 enabled - which is the default with libjpeg-3.0.0) the libtiff object tif_jpeg_12.c.o uses the following libjpeg12 functions: jpeg12_read_raw_data, jpeg12_read_scanlines, jpeg12_write_raw_data, jpeg12_write_scanlines.
update the ordering of libs.append(feature.tiff) to be before libs.append(feature.jpeg) to allow the linker to include the required functions.
this issue occurs when the libtiff and libjpeg libraries are static (not shared.)
Fixes #7269.
Changes proposed in this pull request:
before - missing functions in _imaging.so
after - functions in _imaging.so