[ITK] [ITK-users] ITK emscripten compilation

Matt McCormick matt.mccormick at kitware.com
Wed Oct 28 14:53:17 EDT 2015


Hi Juan,

> I have build ITK as described in post 912
> http://www.kitware.com/blog/home/post/912
>
> However, I did not use ninja and I added the flag -D_LARGEFILE64_SOURCE=1,
> i.e.,
>
> flags=' -Wno-warn-absolute-paths --memory-init-file 0 -s
> DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1
> -D_LARGEFILE64_SOURCE=1'
>
> cmake -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
>   "-DCMAKE_CXX_FLAGS=$flags" "-DCMAKE_C_FLAGS=$flags" \
>   -DBUILD_EXAMPLES=OFF \
>
>     ../ITK
>
>
> make
>
>
> This flag is needed to avoid the error while compiling itkhdf5:
>
>
> /usr/src/ITK/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDstdio.c:192:5:
> error: use of undeclared identifier 'off64_t'
>
>
> After I added the flag, the compilation is successful.

This is interesting.  Are you using the Docker image? What version of
Emscripten are you using? This is supposed to avoided with this code
block:

  https://github.com/InsightSoftwareConsortium/ITK/blob/2f2ae65eec72701b0fc69c07b59453cc6ac2e575/Modules/ThirdParty/HDF5/src/itkhdf5/config/cmake/ConfigureChecks.cmake#L294-L304

What is CMAKE_SYSTEM?



> Now, I'm trying to build a project using ITK.
>
>
> The cmake configuration process is similar to ITK, and the compilation is
> also successful. The javascript file is generated as expected.

Cool.


> However, the execution produces the following error while on the docker
> machine:
>
>
> Could not create IO object for reading file someImage.nrrd
> The file doesn't exist.
> Filename = someImage.nrrd
>
>
> The image file is in the same built directory (not a problem of read-write
> permissions).

You'll need to mount directories from the local filesystem that you
want the Javascript code to see with NODEFS [1].  See how we do it for
the ITK test driver [2].

HTH,
Matt


[1] https://kripken.github.io/emscripten-site/docs/api_reference/Filesystem-API.html#file-systems

[2] http://itk.org/gitweb?p=ITK.git;a=commit;h=0c82b97b749cea9f409aba99c918b94295ed24c7
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list