Your project builds and runs fine here (M1 Mac) using the following inputs (after '>') mixed with console outputs:
> git clone https://github.com/notasuperhero/new_opencv_repo ... > cd new_opencv_repo > mkdir build > cd build > emcmake cmake -G"Unix Makefiles" .. configure: cmake "-GUnix Makefiles" .. -DCMAKE_TOOLCHAIN_FILE=/Users/floh/projects/fips-sdks/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/Users/floh/projects/fips-sdks/emsdk/node/14.15.5_64bit/bin/node -- Configuring done -- Generating done -- Build files have been written to: /Users/floh/scratch/new_opencv_repo/build > cmake --build . [ 50%] Building CXX object CMakeFiles/hello.dir/image.cpp.o [100%] Linking CXX executable hello.js [100%] Built target hello > ls CMakeCache.txt CMakeFiles Makefile cmake_install.cmake hello.js hello.wasm > node hello.js Let's see Put oil in the car: [ 1, 2, 3, 4, 5, 6; 7, 8, 9, 10, 11, 12] On Monday, 6 December 2021 at 15:06:45 UTC+1 [email protected] wrote: > Can you please confirm this I have this program the very basic program I > can find and the CMakeLists.txt to go with it. I cannot get it to compile > to WASM using Emscripten. Can you please check out and tell me if it gets > made because I have done everything right I think. The CMake and the Make > part is giving me trouble. Can you please please check it out. I have spent > weeks on this issue and I would be forever grateful if you could check it > out. I just don't know about emmake and from what I have gathered this > should work. > > https://github.com/notasuperhero/new_opencv_repo > > On Monday, December 6, 2021 at 2:15:32 PM UTC+5:30 Arvind Arya wrote: > >> >> Thank You for your reply. I ran this Pacman project and it built and ran >> . I read on it and apple has made Macs 32 bit incompatible post OSX 15 >> could this be the problem. I will try to run this in a windows environment >> and get back to you >> On Sunday, December 5, 2021 at 8:38:33 PM UTC+5:30 Floh wrote: >> >>> Just a shot in the dark, but this -isysroot option might cause problems >>> (and the following Mac-specific option doesn't look right either): >>> >>> -isysroot >>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk >>> >>> -mmacosx-version-min=10.15 >>> >>> Maybe this causes a mixup of C++ stdlib headers in the Emscripten SDK >>> and the Xcode SDKs. >>> >>> Looking at your CMakeLists.txt file I have no idea where those macOS >>> specific build options would come from though. >>> >>> One very obscure problem I've seen in the past is that global >>> environment variables might pollute your Emscripten build options (e.g. run >>> "env" and check the output for anything suspicious). I've seen this with >>> the CPATH variable (however your problem looks different - but maybe there >>> are other env variables which influence the build). >>> >>> To find out whether the problem is in your system setup you could try >>> building my Pacman clone here: >>> >>> >>> https://github.com/floooh/pacman.c#build-and-run-wasmhtml-version-via-emscripten >>> >>> If this also fails, the problem could be in your setup (however this is >>> a plain C project, which is a much easier case than a C++ project using the >>> C++ stdlib). >>> >>> Cheers, >>> -Floh. >>> On Saturday, 4 December 2021 at 14:00:47 UTC+1 [email protected] >>> wrote: >>> >>>> I built my opencv libraries for WebAssembly and have a simple >>>> program,My *Program*: >>>> #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<<"Put oil in the car: "<<mat1<<"\n"; >>>> return 1; >>>> } >>>> >>>> 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} ) >>>> >>>> >>>> I am running >>>> *emmake cmake *. >>>> >>>> and >>>> *make * >>>> >>>> I am getting an *error*: >>>> >>>> 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:3: >>>> >>>> In file included from >>>> /Users/arvindarya/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/iostream:37: >>>> >>>> In file included from >>>> /Users/arvindarya/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/ios:215: >>>> >>>> /Users/arvindarya/emsdk/upstream/emscripten/cache/sysroot/include/c++/v1/__locale:40:11: >>>> >>>> fatal error: 'xlocale.h' file not found >>>> >>>> # include <xlocale.h> >>>> >>>> ^~~~~~~~~~~ >>>> >>>> 1 error generated. >>>> >>>> em++: error: '/Users/arvindarya/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=/Users/arvindarya/emsdk/upstream/emscripten/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 >>>> >>>> Can anyone help me with this.I want to run a WebAssembly with some >>>> opencv this is the most basic code. Is something wrong with my CMake. I >>>> cannot even get <iostream> work there is something seriously wrong. Please >>>> help me. I have tried emcc --clear-cache it does not work. >>>> >>> -- 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/676cbc3b-99b1-4488-ae50-3c524010986dn%40googlegroups.com.
