Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable compression support? #56

Closed
dzenanz opened this issue Dec 16, 2021 · 7 comments
Closed

How to enable compression support? #56

dzenanz opened this issue Dec 16, 2021 · 7 comments

Comments

@dzenanz
Copy link
Contributor

dzenanz commented Dec 16, 2021

  xt::xzarr_file_system_store store(this->m_FileName); // version 2 file
  auto h = xt::get_zarr_hierarchy(store);
  //std::cout << "h.get_nodes " << h.get_nodes().dump(); // attempts to read non-existent file
  //std::cout << "h.get_children " << h.get_children("/").dump(); // attempts to read non-existent file
  std::cout << "h.get_array " << h.get_array("spectra"); // Unkown compressor type: blosc

Stepping through the code using debugger, I noticed that instance().m_builders only contains one entry: binary. As I had to specify the paths to zlib and blosc, I went back to CMake configurations, and noticed that xtensor-io has a few have settings so I enabled HAVE_Blosc, HAVE_GDAL and HAVE_ZLIB. After an incremental build of xtensor-io and xtensor-zarr, now instance().m_builders contains no entries. What am I doing wrong?

@davidbrochart
Copy link
Member

You need to register the compressor first, like so:

xzarr_register_compressor<xzarr_gcs_store, xio_gzip_config>();
.

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 17, 2021

When I add that, I run into a link error: itkIOOMEZarrNGFF-5.3.lib(itkOMEZarrNGFFImageIO.obj) : error LNK2019: unresolved external symbol "void __cdecl xt::xzarr_register_compressor<class xt::xzarr_file_system_store,struct xt::xio_blosc_config>(void)" (??$xzarr_register_compressor@Vxzarr_file_system_store@xt@@Uxio_blosc_config@2@@xt@@YAXXZ) referenced in function "protected: __cdecl itk::OMEZarrNGFFImageIO::OMEZarrNGFFImageIO(void)" (??0OMEZarrNGFFImageIO@itk@@IEAA@XZ). This should not happen, as that procedure is templated. Do you have any suggestion? If it helps, my current code is here.

@davidbrochart
Copy link
Member

I don't know, maybe @JohanMabille has some ideas?

@JohanMabille
Copy link
Member

JohanMabille commented Dec 21, 2021

We have some precompiled instantiations of xzarr_register_compressor, maybe they prevent the ocmpiler from instantiating a new one?

Can you try adding this in your code before calling the register function (do not forget the declspec(dllexport/dllimport) if you need to use this instantitation in another library):

namespace xt
{
    template void xzarr_register_compressor<xzarr_file_system_store, xio_blosc_config>();
}

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 21, 2021

Yes, that did it. Perhaps it should be added to documentation? See #57.

@dzenanz dzenanz closed this as completed Dec 21, 2021
@JohanMabille
Copy link
Member

@dzenanz yes definitely. Would you like to open a PR?

@dzenanz
Copy link
Contributor Author

dzenanz commented Dec 23, 2021

I just added a new commit to #54.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants