*How to read this post:*
1) Section headings are *Bold*
2) code is Courier New
3) code I typed is blue
4) console messages are gray

*A) What I've done so far:*
1) git pull emscripten-backend
2) build emscripten-backend using cmake
3) git pull emscripten
4) git pull opencv
5) build opencv with cmake using:

$ cmake ../ -DWITH_JPEG=OFF -DBUILD_JPEG=OFF -DWITH_TIFF=OFF 
-DBUILD_TIFF=OFF -DBUILD_JASPER=OFF -DWITH_JASPER=OFF -DBUILD_OPENEXR=OFF 
-DWITH_OPENEXR=OFF -DWITH_FFMPEG=OFF -DWITH_OPENCL=OFF -DWITH_V4L=OFF 
-DWITH_GTK=OFF -DCMAKE_BUILD_TYPE=RELEASE 
-DCMAKE_CXX_COMPILER=/dist/emscripten-fastcomp/build/bin/clang++ 
-DCMAKE_CC_COMPILER=/dist/emscripten-fastcomp/build/bin/clang

$ make && sudo make install

 
Note:  I used the emscripten-fastcomp's clang++ to build opencv.

6) create a simple opencv program (tested that it reads the image and 
prints the size to the console when compiled with normal clang++)

*B) Now my issues.*
1) if I try to compile the test.cpp program with emscripten-fastcomp 
clang++ i get the following error:

 

$ /dist/emscripten-fastcomp/build/bin/clang++ test.cpp -c -o test.bc 
-I/usr/local/include -L/usr/local/lib -lopencv_core -lopencv_highgui
clang-3.3: warning: -lopencv_core: 'linker' input unused
clang-3.3: warning: -lopencv_highgui: 'linker' input unused
clang-3.3: warning: argument unused during compilation: '-L/usr/local/lib'
In file included from test.cpp:1:
In file included from /usr/local/include/opencv2/core/core.hpp:48:
In file included from /usr/local/include/opencv2/core.hpp:50:
In file included from /usr/local/include/opencv2/core/cvdef.h:121:
In file included from 
/dist/emscripten-fastcomp/build/bin/../lib/clang/3.3/include/emmintrin.h:31:
In file included from 
/dist/emscripten-fastcomp/build/bin/../lib/clang/3.3/include/xmmintrin.h:40:
*/dist/emscripten-fastcomp/build/bin/../lib/clang/3.3/include/mm_malloc.h:27:10:
 
**fatal error: *
*'stdlib.h' file not found*#include <stdlib.h>
*         ^*

1 error generated.


2) if I compile the test.cpp program with the system clang++ I get no 
errors.  I then try to compile to byte code with the system clang++ and 
compile with em++ and I get the following errors:

$ clang++ test.cpp -I/usr/local/include -L/usr/local/lib -lopencv_core 
-lopencv_high_gui -c -o test.bc
clang: warning: -lopencv_core: 'linker' input unused
clang: warning: -lopencv_high_gui: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/lib'

 

$ em++ test.bc -o a.out.html -I/usr/local/include -L/usr/local/lib 
-lopencv_core -lopencv_high_gui -v
WARNING  root: -I or -L of an absolute path "-I/usr/local/include" 
encountered. If this is to a local system header/library, it may cause 
problems (local system files make sense for compiling natively on your 
system, but not necessarily to JavaScript). Pass '-Wno-warn-absolute-paths' 
to emcc to hide this warning.
DEBUG    root: invocation: /dist/emscripten/emcc test.bc 
-I/usr/local/include -L/usr/local/lib -lopencv_core -lopencv_high_gui -v
WARNING  root: test.bc is not valid LLVM bitcode
DEBUG    root: looking for library "opencv_core"
DEBUG    root: found library "opencv_core" at 
/usr/local/lib/libopencv_core.dylib
DEBUG    root: looking for library "opencv_high_gui"
WARNING  root: emcc: cannot find library "opencv_high_gui"
DEBUG    root: compiling to bitcode
DEBUG    root: emcc step "parse arguments and setup" took 0.00 seconds
DEBUG    root: copying library file: /usr/local/lib/libopencv_core.dylib
DEBUG    root: emcc step "bitcodeize inputs" took 0.01 seconds
DEBUG    root: emcc step "bitcodeize inputs" took 0.00 seconds
DEBUG    root: will generate JavaScript
DEBUG    root: emcc step "calculate system libraries" took 0.02 seconds
DEBUG    root: emcc step "link" took 0.00 seconds
DEBUG    root: saving intermediate processing steps to /tmp/emscripten_temp
DEBUG    root: emcc: LLVM opts: -internalize 
-internalize-public-api-list=main,malloc,free -globaldce -S
*/dist/emscripten-fastcomp/build/bin/opt: /tmp/tmpTwNjGI/a.out.bc:1:1: **error: 
**expected top-level entity*
????????__TEXT?__text__TEXT  
__stubs__TEXT>?>?__stub_helper__TEXT@?@??__gcc_except_tab__TEXTP?deP?__const__TEXT?,??__cstring__TEXT???{??__unwind_info__TEXT?M
                                                                            
                                                                            
     
J?M__eh_frame__TEXT??__DATA???__got__DATA?h??__nl_symbol_ptr__DATAh?h??__la_symbol_ptr__DATAx?x??__mod_init_func__DATAx?(x?
  
      __const__DATA???0??__data__DATA??xz??__common__DATP ?__bss__DATA?P 
XH__LINKEDITp ?` 4?
Traceback (most recent call last):
  File "/dist/emscripten/emcc", line 1483, in <module>
    shared.Building.llvm_opt(final, link_opts, final + '.link.ll')
  File "/dist/emscripten/tools/shared.py", line 1173, in llvm_opt
    assert os.path.exists(target), 'Failed to run llvm optimizations: ' + 
output
AssertionError: Failed to run llvm optimizations:  



*C) My Questions1) What am I missing that <stdlib.h> cannot be found when 
using emscripten-fastcomp's clang++ in issue #1?2) I am unsure how to 
handle the console output on issue #2.  What is the top-level entity that 
is being referred to?*

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to