Failing to build WebP JavaScript decoder on MacOS

6 views
Skip to first unread message

Joanna Kus

unread,
2:08 PM (5 hours ago) 2:08 PM
to WebP Discussion
Hey, all. I'm attempting to follow the instructions listed here. I'm running MacOS Sequoia 15.7.1.

I'm getting errors with SDL2 in the build process. Have attempted to locate a solution with some good ol' Google Fu, but struggling to nail one down. Any help?

jkus@machine webp_js % emcmake cmake -DWEBP_BUILD_WEBP_JS=ON ../
emcmake: cmake -DWEBP_BUILD_WEBP_JS=ON ../ -DCMAKE_TOOLCHAIN_FILE=/Users/jkus/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/jkus/emsdk/node/22.16.0_64bit/bin/node in directory /Users/jkus/libwebp/webp_js
-- Disabling AVX2 optimization.
-- Disabling AVX2 optimization.
-- Performing Test HAS_COMPILE_FLAG
-- Performing Test HAS_COMPILE_FLAG - Failed
-- Disabling SSE41 optimization.
-- Disabling SSE41 optimization.
-- Performing Test HAS_COMPILE_FLAG
-- Performing Test HAS_COMPILE_FLAG - Failed
CMake Error at CMakeLists.txt:730 (find_package):
  By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SDL2", but
  CMake did not find one.

  Could not find a package configuration file provided by "SDL2" with any of
  the following names:

    SDL2Config.cmake
    sdl2-config.cmake

  Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
  "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!

Vincent Rabaud

unread,
4:22 PM (2 hours ago) 4:22 PM
to webp-d...@webmproject.org
Thx for reporting, it indeed seems to be wrong. Can you confirm the following patch works for you ? https://chromium-review.googlesource.com/c/webm/libwebp/+/7153698 Thx.

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To view this discussion visit https://groups.google.com/a/webmproject.org/d/msgid/webp-discuss/40991392-69a6-4b0d-b40d-124f06633581n%40webmproject.org.

Vincent Rabaud

unread,
4:37 PM (2 hours ago) 4:37 PM
to Joanna Kus, WebP Discussion
sdl2 has to be installed within emscripten, the other versions on your machine do not matter.
You can force emscripten to build it with:
embuilder build sdl2

On Thu, Nov 13, 2025 at 10:30 PM Joanna Kus <jk...@superfile.com> wrote:
No dice; same error. Maybe something's wrong with my install; not sure. I tried the following before running the emcmake command.

brew install sdl2
brew install sdl2_ttf
brew install sdl2_image

So SDL2 is sitting somewhere on my machine.

Joanna Kus

unread,
5:42 PM (1 hour ago) 5:42 PM
to WebP Discussion, Vincent Rabaud
No dice; same error. Maybe something's wrong with my install; not sure. I tried the following before running the emcmake command.

brew install sdl2
brew install sdl2_ttf
brew install sdl2_image

So SDL2 is sitting somewhere on my machine.
On Thursday, November 13, 2025 at 3:22:51 PM UTC-6 Vincent Rabaud wrote:

Joanna Kus

unread,
5:42 PM (1 hour ago) 5:42 PM
to WebP Discussion, Vincent Rabaud, WebP Discussion, Joanna Kus
Thank you so much. Running that got the build to work. Maybe worth adding that step to the README?

James Zern

unread,
6:17 PM (1 hour ago) 6:17 PM
to webp-d...@webmproject.org, Vincent Rabaud, Joanna Kus
On Thu, Nov 13, 2025 at 2:42 PM Joanna Kus <jk...@superfile.com> wrote:
Thank you so much. Running that got the build to work. Maybe worth adding that step to the README?

On Thursday, November 13, 2025 at 3:37:45 PM UTC-6 Vincent Rabaud wrote:
sdl2 has to be installed within emscripten, the other versions on your machine do not matter.
You can force emscripten to build it with:
embuilder build sdl2

Another way I had worked around this in a nightly test script was:

    if [[ -d $EMSDK/upstream/emscripten/tools/ports/sdl2 ]]; then
      # Needed since:
      # SDK 4.0.9:
      #     node-20.18.0-64bit
      #     releases-cb2a69bce627bd2247624c71fc12907cb8785d2f-64bit
      # CMAKE_PREFIX_PATH doesn't seem to work.
      opts="-DSDL2_DIR=$EMSDK/upstream/emscripten/tools/ports/sdl2"
    fi

The embuilder command is probably the more correct way to go about it.
 
Reply all
Reply to author
Forward
0 new messages