[ITK-users] ITK emscripten compilation

Matt McCormick matt.mccormick at kitware.com
Fri Oct 30 00:17:10 EDT 2015


Dear Juan,

A few follow-ups:

If you have seen this demonstration:

  http://insightsoftwareconsortium.github.io/ITKAnisotropicDiffusionLBR/

the code for fetching an input image and writing it to the virtual
filesystem is here:
    https://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR/blob/0d186b9bf29c96fc31029e52af12d39c5e1700e9/js/Runner.js#L138-L162
  https://github.com/InsightSoftwareConsortium/ITKAnisotropicDiffusionLBR/blob/0d186b9bf29c96fc31029e52af12d39c5e1700e9/js/FilterWorker.js#L11


I think it would be very excellent to add interactivity to some of our
Sphinx Examples:

  http://itk.org/ITKExamples/

I have started to add the Sphinx bootstrap extension:

  http://review.source.kitware.com/#/c/20119/

with the goal of facilitating interactive versions of the examples.


I will build of the Docker image with Emscripten 1.35.4, and I will
see if I can reproduce your build errors.

Thanks,
Matt

On Wed, Oct 28, 2015 at 3:26 PM, Juan Carlos Prieto
<juanprietob at gmail.com> wrote:
> Hi Matt,
>
>> Are you using the Docker image?
>
> Yes, I tried with the Docker image and also I tried building it in my system
> with the same results.
>
>> What version of Emscripten are you using?
>
> In my system I'm using emscripten tag-1.35.4
>
>> What is CMAKE_SYSTEM?
>
> In the docker image CMAKE_SYSTEM = Emscripten-1
> In my system CMAKE_SYSTEM = Darwin-14.5.0
>
>
> I also noticed the code block in the file
> https://github.com/InsightSoftwareConsortium/ITK/blob/2f2ae65eec72701b0fc69c07b59453cc6ac2e575/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5FDstdio.c#L136-L148
>
> If H5_HAVE_FSEEKO64 is  undefined, the compilation is successful.
>
>
> I'll try with the example and see if I am able to read the images.
>
> Best,
>
> Juan
>
>
>
> On Wed, Oct 28, 2015 at 2:53 PM, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
>>
>> 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
>
>


More information about the Insight-users mailing list