informationsea / xlsxwriter-rs

Excel file writer for Rust
https://crates.io/crates/xlsxwriter
Apache License 2.0
265 stars 44 forks source link

Linker error: z_errmsg already defined -> Depend on flate2? #27

Closed Christoph-AK closed 2 years ago

Christoph-AK commented 2 years ago

I'm trying to include xlsxwriter into a poem rest server with a mysql db to create and serve xslx-reports.

On compilation I get:

  = note: liblibz_sys-b7ca100a7b308d29.rlib(zutil.o) : error LNK2005: z_errmsg ist bereits in liblibxlsxwriter_sys-9b150791908fa04f.rlib(zutil.o) definiert.
          liblibz_sys-b7ca100a7b308d29.rlib(zutil.o) : error LNK2005: zlibVersion ist bereits in liblibxlsxwriter_sys-9b150791908fa04f.rlib(zutil.o) definiert.
          liblibz_sys-b7ca100a7b308d29.rlib(zutil.o) : error LNK2005: zlibCompileFlags ist bereits in liblibxlsxwriter_sys-9b150791908fa04f.rlib(zutil.o) definiert.
          liblibz_sys-b7ca100a7b308d29.rlib(zutil.o) : error LNK2005: zError ist bereits in liblibxlsxwriter_sys-9b150791908fa04f.rlib(zutil.o) definiert.
          C:\Users\local\Desktop\Daten\Programme\project\.\target\debug\deps\project.exe : fatal error LNK1169: Mindestens ein mehrfach definiertes Symbol gefunden.

MySQL seems to depend on zlib aswell and pulls it in via flate2. Do you think you could change this library to depend on flate2 aswell, instead of bringing its own zlib? That could hopefully solve the double depency.

informationsea commented 2 years ago

xlsxwriter-rs contains zlib copy in xlsxwriter-sys crate. Because original C library xlsxwriter requires zlib, it is impossible to use flate2. Instead of using flate2, xlsxwriter-rs can use system zlib by enabling system-zlib feature. This feature was tested on linux only, but may be useful for you.

Christoph-AK commented 2 years ago

Thanks alot for the quick answer! I did try that, but couldn't get the compilation to succeed. Probably some paths need to be adjusted, but because I am short on time I switched to another pure rust xlsx-writer crate for now.

Still using this crate for other projects, it's awesome. Thanks so much for maintaining it!