d.mercanti
d.mercanti

Reputation: 21

emscripten zlib configuration working example

I don't normally develop in c++ (windows) but I would like to try using emscripten for some projects.

I installed, configured and did a first test of communication between JS and C++, exchanging a float array and reading from the virtual file system the file loaded by the browser's input tag.

I can't configure zlib to unzip the file that comes from the browser. I have the libz.a file in "emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten", I put USE_ZLIB=1 in the cmake settings but during compilation I get an error for each zip function used example: CMakeProject1.cpp.o: undefined symbol: zip_open

What could I check?

this is the build output

[1/2] D:\MERCANTI\em\emsdk\upstream\emscripten\em++.bat  -I../../../CMakeProject1/1/system/include/emscripten -g -MD -MT CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o -MF CMakeProject1\CMakeFiles\CMakeProject1.dir\CMakeProject1.cpp.o.d -o CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o -c ../../../CMakeProject1/CMakeProject1.cpp
  [2/2] cmd.exe /C "cd . && D:\MERCANTI\em\emsdk\upstream\emscripten\em++.bat -g --bind  -s USE_ZLIB=1 -lm -O2 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap'] -s EXPORTED_FUNCTIONS=['_print_file','_testdouble_array','_malloc','_free','_unzip_file'] CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o -o CMakeProject1\MyFirstWASM.html   && cd ."
  FAILED: CMakeProject1/MyFirstWASM.html 
  cmd.exe /C "cd . && D:\MERCANTI\em\emsdk\upstream\emscripten\em++.bat -g --bind  -s USE_ZLIB=1 -lm -O2 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=['ccall','cwrap'] -s EXPORTED_FUNCTIONS=['_print_file','_testdouble_array','_malloc','_free','_unzip_file'] CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o -o CMakeProject1\MyFirstWASM.html   && cd ."
D:\MERCANTI\em\sources\CMakeProject1\out\build\x64-Debug\CMakeProject1\em++ : warning : EXTRA_EXPORTED_RUNTIME_METHODS is deprecated (please use EXPORTED_RUNTIME_METHODS instead). Please open a bug if you have a continuing need for this setting [-Wdeprecated]
D:\MERCANTI\em\sources\CMakeProject1\out\build\x64-Debug\CMakeProject1\wasm-ld : error : CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o: undefined symbol: zip_open
D:\MERCANTI\em\sources\CMakeProject1\out\build\x64-Debug\CMakeProject1\wasm-ld : error : CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o: undefined symbol: zip_get_num_entries
D:\MERCANTI\em\sources\CMakeProject1\out\build\x64-Debug\CMakeProject1\wasm-ld : error : CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o: undefined symbol: zip_stat_index
D:\MERCANTI\em\sources\CMakeProject1\out\build\x64-Debug\CMakeProject1\wasm-ld : error : CMakeProject1/CMakeFiles/CMakeProject1.dir/CMakeProject1.cpp.o: undefined symbol: zip_close

Upvotes: 0

Views: 47

Answers (0)

Related Questions