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

What files are needed to compile the wasm for HTML, and what other parameters are needed? #74

Closed
DebugNoob opened this issue Jun 7, 2023 · 6 comments

Comments

@DebugNoob
Copy link

HI, your project is amazing to me.
I want to try modifying some parameters to compile wasm and encountered some issues.
What files are needed to compile the wasm for HTML, and what other parameters are needed?

@sz3
Copy link
Owner

sz3 commented Jun 8, 2023

For the wasm build (and the asm.js build), I use a docker container and run this script inside it. The docker command is the (commented out) 2nd line of the script:
https://github.com/sz3/libcimbar/blob/master/package-wasm.sh

You can also see how it's used by the github actions workflow here. The only real interesting thing is that you need to download opencv and extract it to the opencv4/ subdirectory ahead of time.

@DebugNoob
Copy link
Author

DebugNoob commented Jun 9, 2023

Thank you very much ^_^.
But I have encountered a new problem that I searched the internet but couldn't find the relevant answer.
Have you encountered it again?
When I execute to
make -j5 install

[ 61%] Building CXX object build/src/third_party_lib/wirehair/CMakeFiles/wirehair.dir/wirehair.cpp.o
clang++: error: unsupported option '-march=' for target 'wasm32-unknown-emscripten'
em++: error: '/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN --sysroot=/emsdk/upstream/emscripten/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -DLIBCIMBAR_PROJECT_ROOT="/usr/src/app" -I/usr/src/app/opencv4/include -I/usr/src/app/opencv4/opencv-build-wasm/build_wasm -I/usr/src/app/opencv4/modules/calib3d/include -I/usr/src/app/opencv4/modules/core/include -I/usr/src/app/opencv4/modules/dnn/include -I/usr/src/app/opencv4/modules/features2d/include -I/usr/src/app/opencv4/modules/flann/include -I/usr/src/app/opencv4/modules/gapi/include -I/usr/src/app/opencv4/modules/highgui/include -I/usr/src/app/opencv4/modules/imgcodecs/include -I/usr/src/app/opencv4/modules/imgproc/include -I/usr/src/app/opencv4/modules/ml/include -I/usr/src/app/opencv4/modules/objdetect/include -I/usr/src/app/opencv4/modules/photo/include -I/usr/src/app/opencv4/modules/stitching/include -I/usr/src/app/opencv4/modules/ts/include -I/usr/src/app/opencv4/modules/video/include -I/usr/src/app/opencv4/modules/videoio/include -I/usr/src/app/opencv4/modules/world/include -I/usr/src/app/src/lib -I/usr/src/app/src/third_party_lib -I/usr/src/app/src/third_party_lib/wirehair/include -DGF256_TARGET_MOBILE -march=native -Os -std=gnu++11 -MD -MT build/src/third_party_lib/wirehair/CMakeFiles/wirehair.dir/wirehair.cpp.o -MF CMakeFiles/wirehair.dir/wirehair.cpp.o.d -c /usr/src/app/src/third_party_lib/wirehair/wirehair.cpp -o CMakeFiles/wirehair.dir/wirehair.cpp.o' failed (returned 1)
make[2]: *** [build/src/third_party_lib/wirehair/CMakeFiles/wirehair.dir/build.make:77: build/src/third_party_lib/wirehair/CMakeFiles/wirehair.dir/wirehair.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:669: build/src/third_party_lib/wirehair/CMakeFiles/wirehair.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

😢

@sz3
Copy link
Owner

sz3 commented Jun 10, 2023

Ok, I'm seeing the same error when using emscripten/emsdk:latest. Thanks for noticing this... I think we need to use a (slightly) older emscripten image.

@sz3
Copy link
Owner

sz3 commented Jun 10, 2023

emscripten/emsdk:3.1.39 works.

@sz3
Copy link
Owner

sz3 commented Jun 10, 2023

#75

@DebugNoob
Copy link
Author

Thank you very much!
Wishing you great success in your future work!

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

No branches or pull requests

2 participants