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

Add libwebpdemux to .pc file for static builds #473

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

sharkwouter
Copy link

This is required to successfully link to SDL2_image if it was build statically while not using the vendored version of libwebp.

Here is an example of this error: https://github.com/sharkwouter/oceanpop/actions/runs/11243696277/job/31260185313

[ 85%] Linking CXX executable oceanpop
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: /usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/lib/libSDL2_image.a(IMG_webp.c.obj): in function `IMG_InitWEBP':
(.text+0xec): undefined reference to `WebPDemuxInternal'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0xf4): undefined reference to `WebPDemuxInternal'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0xfc): undefined reference to `WebPDemuxGetFrame'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x100): undefined reference to `WebPDemuxGetI'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x104): undefined reference to `WebPDemuxGetFrame'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x108): undefined reference to `WebPDemuxGetI'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x118): undefined reference to `WebPDemuxDelete'
/usr/local/vitasdk/bin/../lib/gcc/arm-vita-eabi/10.3.0/../../../../arm-vita-eabi/bin/ld: (.text+0x11e): undefined reference to `WebPDemuxDelete'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/oceanpop.dir/build.make:449: oceanpop] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:89: CMakeFiles/oceanpop.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

I'm using pkgconf in CMake for linking basically like this:

include(FindPkgConfig)
pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image)
target_link_libraries(${PROJECT_NAME} PRIVATE
        ${SDL2_IMAGE_STATIC_LIBRARIES}
)

Applying this change fixed the linking errors for me.

I do not know if this also applies to SDL3_image, since I only use SDL2_image.

This is required to successfully link to SDL2_image if it was build statically while not using the vendored version of libwebp.
@sezero
Copy link
Contributor

sezero commented Oct 8, 2024

Yes, autotools seem to do it right, cmake had this missing. Merging.

@madebr: SDL3image possibly need this too? Leaving that to you.

@sezero sezero merged commit 1fa2a92 into libsdl-org:SDL2 Oct 8, 2024
4 of 8 checks passed
@madebr
Copy link
Contributor

madebr commented Oct 8, 2024

See a010117

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

Successfully merging this pull request may close these issues.

3 participants