samsam2310 / zbar.wasm

A wasm build of C/C++ ZBar barcode scanning library.
GNU Lesser General Public License v2.1
222 stars 30 forks source link

Build error "fatal error: 'string' file not found" #20

Open suzukieng opened 2 years ago

suzukieng commented 2 years ago

If I try to build according to README (npm install, npm run build), I get the following error on macOS 11.6.2:

docker run --rm -u 501:20 -w /src -v $PWD:/src emscripten/emsdk:3.0.0 emcc -Wall -Werror -g2 -c src/symbol.test.c -o dist/symbol.test.o -I zbar-0.23.90/include/ -I zbar-0.23.90/
In file included from src/symbol.test.c:3:
zbar-0.23.90/include/zbar/symbol.h:34:10: fatal error: 'string' file not found
#include <string>
         ^~~~~~~~
1 error generated.
emcc: error: '/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=0 -D_LIBCPP_ABI_VERSION=2 -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -Wall -Werror -c -Izbar-0.23.90/include/ -Izbar-0.23.90/ src/symbol.test.c -o dist/symbol.test.o' failed (returned 1)

Any idea what could be causing this? I tried substituting the emscripten Docker image to use a local emscripten installation, but that fails too, albeit in a different way (unsupported wasm-ld option -retain-symbols-file).

Is there a recommended Node version to build this project? I'm on 16. Xcode command-line tools are installed.

The full build output is attached: build-output.txt

vandres commented 2 years ago

Same here, macOS 12.2

samsam2310 commented 2 years ago

I'd tested on win10 and linux. But I didn't test on Mac. Base on the error, I guess it could be caused by environment variables.