0

Probably this is very noobish mistake, but can anyone try to reproduce my steps & check for errors?

I'm using Linux Mint 15. I've downloaded doc2x (binary->openxml msword converter) from here : https://sourceforge.net/project/downloading.php?group_id=216787&filename=doc2x_r649.tar.gz&a=13775724

Untar'ed it with tar -xzf doc2x_r649.tar.gz

The archive contains binaries, should be Mono compatible.

I've got mono v2.0 & mono v4.0 profiles installed.

Any attempt to make a conversion throws an error :

2/23/2014 9:00:25 PM [D] System.DllNotFoundException: zlibwapi.dll
at (wrapper managed-to-native) DIaLOGIKa.b2xtranslator.ZipUtils.ZipLib:zipOpen     (string,int)
at DIaLOGIKa.b2xtranslator.ZipUtils.ZlibZipWriter..ctor (System.String path) [0x00000]   in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) DIaLOGIKa.b2xtranslator.ZipUtils.ZlibZipWriter:.ctor (string)
at DIaLOGIKa.b2xtranslator.ZipUtils.ZipFactory.CreateArchive (System.String path) [0x00000] in <filename unknown>:0 
at DIaLOGIKa.b2xtranslator.OpenXmlLib.OpenXmlWriter.Open (System.String fileName) [0x00000] in <filename unknown>:0 
at DIaLOGIKa.b2xtranslator.OpenXmlLib.OpenXmlPackage.Close () [0x00000] in <filename unknown>:0 
at DIaLOGIKa.b2xtranslator.OpenXmlLib.OpenXmlPackage.Dispose () [0x00000] in <filename unknown>:0 
at DIaLOGIKa.b2xtranslator.WordprocessingMLMapping.Converter.Convert(DIaLOGIKa.b2xtranslator.DocFileFormat.WordDocument doc,    DIaLOGIKa.b2xtranslator.OpenXmlLib.WordprocessingML.WordprocessingDocument docx) [0x00000] in <filename unknown>:0 
at DIaLOGIKa.b2xtranslator.doc2x.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

I think the problem lies in first line "2/23/2014 9:00:25 PM [D] System.DllNotFoundException: zlibwapi.dll". zlibwapi.dll is located in converter's directory. I've tried copying it into several locations (typically used by libraries) but no luck. I've read that Mono is looking for libraries at current directory in the first place, so there should be no problem.

How to get it to work? Thanks in advance!

Gobol
  • 126
  • 8
  • Well, after few hours, I've found one problem - the libzlibwapi.so wasn't 64bit, so I compiled new version from source, now it's 64bit, ldconfig'd it, etc/mono/config updated... still no luck, because there is a problem with some functions not found in library (deflateInit2_, but its there... checked that!) – Gobol Feb 23 '14 at 21:36
  • Problem lies in 64bit Mono runtime, which cannot load 32bit external libraries. Solutions? Install 32bit Mono on 64bit linux (how???) or recode application to use 64bit library... (assembly bitness doesn't matter) – Gobol Feb 25 '14 at 10:09

2 Answers2

1

I came across a similar problem building and running OdfConverter using mono on 64 bit Ubuntu.

The issue seems to be that the linker no longer automatically includes references to shared libraries if it doesn't think it needs them. If you ldd libzlibwapi.so you'll probably find there's no reference to libz.so.1 which is where the deflateInit2_ symbol is defined.

In my case I was able to rebuild the libzlibwapi.so from the source distribution, but I added a -Wl,--no-as-needed linker directive to force the following dependency on libz.so to be added.


In my case I edited odf-converter/source/AdditionalTools/zlib123/contrib/minizip/Makefile from:

    $(CC) -lz -shared -fPIC $(DEBUG) $(CFLAGS) \
        -o libzlibwapi.$(DLLEXT) $(SOURCE)

to read:

    $(CC) -Wl,--no-as-needed -lz -shared -fPIC $(DEBUG) $(CFLAGS) \
        -o libzlibwapi.$(DLLEXT) $(SOURCE)

I was then able to build a 64 bit working libzlibwapi.so as follows:

cd odf-converter/source/AdditionalTools/zlib123
dos2unix configure
chmod 755 ./configure
./configure --shared
make test
cd contrib/minizip
make
cp libzlibwapi.so ../../../../../lib

Mono can then be used to compile and run OdfConverter against this:

cd odf-converter/source/Shell/OdfConverter
xbuild /p:Configuration=Release

(Once you fix a few case sensitive file names that is!)

woodcoder
  • 31
  • 4
0

@woodcoder's answer worked for me, except that the build of minizip couldn't find the zlib I had just built. I needed to modify source/AdditionalTools/zlib123/contrib/minizip/Makefile to change the line

CFLAGS=-Wall

to

CFLAGS=-Wall -I ../.. -L ../..

then all was well.

Nik Bates-Haus
  • 211
  • 2
  • 4