*My simple CPP file:*
#include<stdio.h>
#include"opencv2/opencv.hpp"
#include<iostream>
#include<emscripten.h>
using namespace std;
using namespace cv;
int main(){
cout<<"Let's see\n";
uint8_t uarr[] = {1,2,3,4,5,6,7,8,9,10,11,12};
int rows=2;
int cols=2;
Mat mat1(rows,cols,CV_8UC3, uarr);
cout<<: "<<mat1<<"\n";
return 1;
}
I have built opencv libraries for Wasm and then I made the CMake as follows
This My *CMakeLists.txt:*
cmake_minimum_required( VERSION 3.1 )
set( CMAKE_CXX_STANDARD 11 )
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
project( HelloCV )
# Does not work
# find_package( OpenCV REQUIRED PATHS third-party/opencv-4.1.0/build_wasm
NO_DEFAULT_PATH)
# Needed for opencv2/opencv.hpp
include_directories( /Users/arvindarya/Desktop/aspen/opencv/include )
# Needed by opencv.hpp for opencv2/opencv_modules.hpp
include_directories( /Users/arvindarya/Desktop/aspen/opencv/build_wasm )
# Needed by opencv_modules.hpp for every module
file( GLOB opencv_include_modules
"/Users/arvindarya/Desktop/aspen/opencv/modules/*/include" )
include_directories( ${opencv_include_modules} )
# Our hello world executable
add_executable( hello image.cpp )
# Link to opencv.js precompiled libraries
file( GLOB opencv_js
"/Users/arvindarya/Desktop/aspen/opencv/build_wasm/lib/*.a" )
target_link_libraries( hello ${opencv_js} )
the error I am getting. Please help. I am getting an error After I have
used:
*emmake cmake. *
and then
*make*
*% make *
[ 50%] Building CXX object CMakeFiles/hello.dir/image.cpp.o
clang-14: warning: argument unused during compilation:
'-mmacosx-version-min=10.15' [-Wunused-command-line-argument]
In file included from /Users/arvindarya/Desktop/aspen/image.cpp:2:
In file included from
/Users/arvindarya/Desktop/aspen/opencv/include/opencv2/opencv.hpp:52:
In file included from
/Users/arvindarya/Desktop/aspen/opencv/modules/core/include/opencv2/core.hpp:3292:
In file included from
/Users/arvindarya/Desktop/aspen/opencv/modules/core/include/opencv2/core/cvstd.inl.hpp:47:
In file included from
/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot/include/c++/v1/complex:242:
In file included from
/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot/include/c++/v1/sstream:184:
In file included from
/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot/include/c++/v1/ostream:137:
In file included from
/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot/include/c++/v1/ios:215:
/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot/include/c++/v1/__locale:40:11*:
fatal error: 'xlocale.h' file not found*
*# include <xlocale.h>*
* ^~~~~~~~~~~*
*1 error generated.*
em++: error: '/usr/local/opt/emscripten/libexec/llvm/bin/clang++ -target
wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0
-D__EMSCRIPTEN_tiny__=32 -D_LIBCPP_ABI_VERSION=2
-Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL
--sysroot=/usr/local/Cellar/emscripten/2.0.32/libexec/cache/sysroot -Xclang
-iwithsysroot/include/compat
-I/Users/arvindarya/Desktop/aspen/opencv/include
-I/Users/arvindarya/Desktop/aspen/opencv/build_wasm
-I/Users/arvindarya/Desktop/aspen/opencv/modules/calib3d/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/core/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/dnn/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/features2d/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/flann/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/gapi/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/highgui/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/imgcodecs/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/imgproc/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/ml/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/objdetect/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/photo/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/stitching/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/ts/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/video/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/videoio/include
-I/Users/arvindarya/Desktop/aspen/opencv/modules/world/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
-mmacosx-version-min=10.15 -std=gnu++11 -MD -MT
CMakeFiles/hello.dir/image.cpp.o -MF CMakeFiles/hello.dir/image.cpp.o.d -c
/Users/arvindarya/Desktop/aspen/image.cpp -o
CMakeFiles/hello.dir/image.cpp.o' failed (returned 1)
make[2]: *** [CMakeFiles/hello.dir/image.cpp.o] Error 1
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
make: *** [all] Error 2
I have tried emcc --clear-cache it is not making the error go away.
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/509480b5-18a5-4d55-a8b2-e02103a1ef78n%40googlegroups.com.