strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.75k stars 301 forks source link

execute ./build-emscripten failed #643

Closed cai-zhuo closed 1 year ago

cai-zhuo commented 2 years ago

error: em++: warning: object file output extension (.dylib) used for non-object output. If you meant to build an object file please use -c,-r, or-shared` [-Wemcc] wasm-ld: error: unknown argument: -flat_namespace em++: error: '/Users/bytedance/Workspace/emsdk/upstream/bin/wasm-ld -o .libs/libde265.0.wasm -flat_namespace -undefined suppress .libs/libde265.0.dylib-master.o -L/Users/bytedance/Workspace/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --export-if-defined=main --export-if-defined=start_em_asm --export-if-defined=stop_em_asm --export=stackSave --export=stackRestore --export=stackAlloc --export=wasm_call_ctors --export=errno_location --export=malloc --export=__cxa_is_pointer_type --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1) make[3]: [libde265.la] Error 1 make[2]: [all-recursive] Error 1 make[1]: [all-recursive] Error 1 make: [all] Error 2 emmake: error: 'make' failed (returned 2)

cai-zhuo commented 2 years ago

modified build-emscripten file. changed the LIBDE265_VERSION to 1.0.8 ,also not work with 1.0.2 remove var "cores"

!/bin/bash

set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

LIBDE265_VERSION=1.0.8 [ -s "libde265-${LIBDE265_VERSION}.tar.gz" ] || curl \ -L \ -o libde265-${LIBDE265_VERSION}.tar.gz \ https://github.com/strukturag/libde265/releases/download/v${LIBDE265_VERSION}/libde265-${LIBDE265_VERSION}.tar.gz if [ ! -s "libde265-${LIBDE265_VERSION}/libde265/.libs/libde265.so" ]; then tar xf libde265-${LIBDE265_VERSION}.tar.gz cd libde265-${LIBDE265_VERSION} [ -x configure ] || ./autogen.sh emconfigure ./configure --disable-sse --disable-dec265 --disable-sherlock265 emmake make -j cd .. fi

CONFIGURE_ARGS="--disable-multithreading --disable-go"

emconfigure ./configure $CONFIGURE_ARGS \ PKG_CONFIG_PATH="${DIR}/libde265-${LIBDE265_VERSION}" \ libde265_CFLAGS="-I${DIR}/libde265-${LIBDE265_VERSION}" \ libde265_LIBS="-L${DIR}/libde265-${LIBDE265_VERSION}/libde265/.libs" if [ ! -e "Makefile" ]; then

Most likely the first run of "emscripten" which will generate the

# config file and terminate. Run "emconfigure" again.
emconfigure ./configure $CONFIGURE_ARGS \
    PKG_CONFIG_PATH="${DIR}/libde265-${LIBDE265_VERSION}" \
    libde265_CFLAGS="-I${DIR}/libde265-${LIBDE265_VERSION}" \
    libde265_LIBS="-L${DIR}/libde265-${LIBDE265_VERSION}/libde265/.libs"

fi emmake make -j

export TOTAL_MEMORY=16777216

echo "Running Emscripten..." emcc libheif/.libs/libheif.so \ --bind \ -s NO_EXIT_RUNTIME=1 \ -s TOTAL_MEMORY=${TOTAL_MEMORY} \ -s ALLOW_MEMORY_GROWTH=1 \ -s ASSERTIONS=0 \ -s INVOKE_RUN=0 \ -s DOUBLE_MODE=0 \ -s PRECISE_F32=0 \ -s PRECISE_I64_MATH=0 \ -s DISABLE_EXCEPTION_CATCHING=1 \ -s USE_CLOSURE_COMPILER=0 \ -s LEGACY_VM_SUPPORT=1 \ --memory-init-file 0 \ -O3 \ -std=c++11 \ -L${DIR}/libde265-${LIBDE265_VERSION}/libde265/.libs \ -lde265 \ --pre-js pre.js \ --post-js post.js \ -o libheif.js

cai-zhuo commented 2 years ago

Hi, Do you have plan to support latest version emscripten to produce wasm file?