jsscheller / imagemagick-wasm

imagemagick compiled to WASM
Apache License 2.0
2 stars 2 forks source link

failed semaphore assertion when converting from PNG format (self-built) #3

Open wipeautcrafter opened 4 months ago

wipeautcrafter commented 4 months ago

Issue

When building from source, using PNG as an input results in a failed assertion:

Assertion failed: semaphore_info != (SemaphoreInfo *) NULL, at: MagickCore/semaphore.c,295,LockSemaphoreInfo

Note that when listing the available formats, PNG is listed as both an input and output.

Environment

Reproduction

Run build.sh, but comment out the -j and --target fftw3 arguments for the fftw cmake command. These arguments don't work for cmake, and result in an error.

Stack Trace

Aborted(Assertion failed: semaphore_info != (SemaphoreInfo *) NULL, at: MagickCore/semaphore.c,295,LockSemaphoreInfo) magick.js:13:36
    Ea magick.js:13
    a magick.js:85
    <anonymous> magick.wasm:48171
    <anonymous> magick.wasm:434261
    <anonymous> magick.wasm:306550
    <anonymous> magick.wasm:208593
    <anonymous> magick.wasm:775868
    <anonymous> magick.wasm:991022
    <anonymous> magick.wasm:1497381
    <anonymous> magick.wasm:1003145
    <anonymous> magick.wasm:781142
    <anonymous> magick.wasm:45037
    fc magick.js:109
    <anonymous> magick.wasm:1712823
    <anonymous> magick.wasm:3743851
    <anonymous> magick.wasm:225997
    <anonymous> magick.wasm:396561
    <anonymous> agick.wasm:372990
    <anonymous> magick.wasm:3453097
    <anonymous> magick.wasm:1996965
    _main httpmagick.js:109
    zc magick.js:115
    <anonymous> worker.js:11
    <anonymous> worker.js:18
jsscheller commented 4 months ago

If you are seeing a semaphore error, I would guess that whatever changes you made to the build script require pthreads. You might try building with pthreads enabled.

jsscheller commented 4 months ago

Try this to build fftw:

cd "$ROOT/lib/fftw/fftw-src/fftw-3.3.8"
fn_git_clean
emconfigure ./configure \
  --prefix="$OUT_DIR" \
  --disable-shared \
  --disable-doc \
  --enable-static \
  --disable-fortran \
  --disable-alloca \
  --disable-threads \
  --disable-openmp \
  --without-g77-wrappers
emmake make -j install
wipeautcrafter commented 3 months ago

After reverting to your original build script, and just changing the FFTW build commands like you provided, nothing changes. It still builds successfully, and fails when trying to convert from a PNG file. There must be something different about my build environment, but all I can see is a difference in the EMSDK version (3.1.10 -> 3.1.56). Are you building from the Dockerfile you provided, or a different environment?

jsscheller commented 3 months ago

I just tried to build myself and ran into the error you described. I used the Dockerfile but updated to the latest EMSDK. I didn't have time to pursue it further. My next step was to try to use the original EMSDK version to see if that fixes things.