Thanks, that works for me. Until I read
http://mozakai.blogspot.de/2012/03/howto-port-cc-library-to-javascript.html
I had no clue how to get a proper build. Thanks for the
--disable-shared-tip!
Am Freitag, 1. Mai 2015 15:07:08 UTC+2 schrieb Boris Gjenero:
>
> This simply works for me in Emscripten 1.32.0. Disable shared libraries
> when configuring, because those are not supported by Emscripten. I used
> "emconfigure ./configure --disable-shared". The library is generated
> at .libs/libjpeg.a. Then I added main() to example.c:
> int main(void) {
> printf("got %i\n", read_JPEG_file("testimg.jpg"));
> return 0;
> }
> I also commented out "put_scanline_someplace(buffer[0], row_stride);"
> because it doesn't exist and added "#include <stdlib.h>". Finally, I built
> it with:
> emcc --preload-file testimg.jpg example.c .libs/libjpeg.a -o example.html
>
> On Thursday, 30 April 2015 11:21:42 UTC-4, Björn K. wrote:
>>
>> 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.