The problem here seems to be that you are not linking all the compiled libjpeg functions into your main program. Try to locate where the missing function jpeg_str_error is defined, and trace through the path where it should be compiled and linked in to the main program. Most likely it exists in a .c file, which you then compile to either an object file (.o), or a library (.bc, .a). When you do the final link (emcc -o x.js/x.html), you should include the compiled object/library file that contains that function so that it does not get dropped out.
2015-04-30 18:21 GMT+03:00 Björn K. <[email protected]>: > Hi there! > > I'm trying to compile libjpeg to JavaScript for using it in a webapp. So > far I've had no luck with getting it to work. What I've done: > > 1. I've set up emscripten with my Ubuntu 14.04 LTS, the simple "Hello > world"-c-code compiled successfully to JavaScript. > 2. I've downloaded/extracted http://www.ijg.org/files/jpegsrc.v9a.tar.gz. > I've made sure that I can build the included programs like djpeg or cjpeg. > 3. I've made some modifications to example.c (mainly adding a > main-function) and created a makefile for compiling it with gcc. > 4. I've made sure I can successfully run the natively compiled "example". > 5. I called emcc for example.c with HTML-output, getting the following: > warning: unresolved symbol: jpeg_read_header > warning: unresolved symbol: jpeg_CreateDecompress > warning: unresolved symbol: jpeg_start_decompress > warning: unresolved symbol: jpeg_stdio_src > warning: unresolved symbol: jpeg_std_error > warning: unresolved symbol: jpeg_destroy_decompress > warning: unresolved symbol: jpeg_finish_decompress > warning: unresolved symbol: jpeg_read_scanlines > 6. I've opened the generated HTML-output in a Firefox instance, but get > file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.data > uncaught exception: abort(-1) at jsStackTrace > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:1316:13 > stackTrace > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:1333:22 > abort > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10939:44 > _jpeg_std_error > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:6541:59 > _jpeg_std_error__wrapper > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10637:59 > dynCall_ii > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10605:10 > invoke_ii > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:6663:12 > _read_JPEG_file > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:6902:11 > _main > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:7091:8 > asm._main > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10676:8 > callMain > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10805:15 > doRun > @file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10863:42 > > run/<@file:///home/kopiske/emscripten/jpeg-components/jpeg-9a/example.js:10874:7 > > "pre-main prep time: 241 ms" example.html:1245 > Module.printErr() example.html:1245 > doRun() example.js:10858 > run/<() example.js:10874 > > "missing function: jpeg_std_error" example.html:1245 > Module.printErr() example.html:1245 > _jpeg_std_error() example.js:6541 > _jpeg_std_error__wrapper() example.js:10637 > dynCall_ii() example.js:10605 > invoke_ii() example.js:6663 > _read_JPEG_file() example.js:6902 > _main() example.js:7091 > asm._main() example.js:10676 > callMain() example.js:10805 > doRun() example.js:10863 > run/<() > > > I haven't provided the modified example.c, since I get the same warnings > mentioned in step 5 when I try to compile the unmodified "djpeg" with emcc. > > When I provide -s INCLUDE_FULL_LIBRARY=1 to emcc, the warnings disappear, > but the error in 6 still remains. I have no idea why the used functions are > not included. > > Any help with this is highly appreciated! (As you might have noticed, my > knowledge of C is rudimentary to non-existent ;-)) > > Best regards, > Björn > > -- > 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. > -- 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.
