ERROR: LoadError: LoadError: error compiling top-level scope: could not load library "zlib1"

Hi all,

I’m excited that travis is offering testing on windows now! I’m running into an error which might be caused by travis, but I’m not sure. When tying to test a package I’m developing in Julia, I get the following error:

ERROR: LoadError: LoadError: error compiling top-level scope: could not load library "zlib1"

This only happens when testing on Julia 1.3 (everything works on Julia 1.2). I’m not entirely sure if I should be posting this here, or if I should post it somewhere visible to Julia developers. I’ll post to the Julia discourse as well.

Here is a link to the full output from Travis: https://travis-ci.org/Circuitscape/Omniscape.jl/jobs/612073548

Thanks for any help or suggestions on other places to post this.

EDIT:
Here is the link to the post in the Julia discourse.

- Vincent

Looks like a problem with the GZip package: https://travis-ci.org/Circuitscape/Omniscape.jl/jobs/612073548#L91

Yeah, I’ve been digging into it a bit and I think I just need to download zlib1.dll and put it in julia/lib (see here)? I’m not sure what the full path is for julia/lib though. Would it be in Program Files?

Turns out downloading the .dll didn’t work. After downloading it and placing it in /julia/bin (placing it in julia/lib did nothing), I got the following error:

ERROR: LoadError: LoadError: error compiling top-level scope: could not load library "zlib1"
%1 is not a valid Win32 application.

Which is slightly different than what I got before:

ERROR: LoadError: LoadError: error compiling top-level scope: could not load library "zlib1"
%1 is not a valid Win32 application.

This is the code I added to my yaml file to download the .dll

before_install:
  - if [ "$TRAVIS_OS_NAME" = "windows" ]; 
    then wget -O zlib-1.2.3-bin.zip http://managedway.dl.sourceforge.net/project/gnuwin32/zlib/1.2.3/zlib-1.2.3-bin.zip;
    unzip zlib-1.2.3-bin.zip;
    mv bin/zlib1.dll C:/julia/bin/zlib1.dll;
    fi

Not sure if that means I have the wrong .dll. I posted an issue on the github repo for GZip. This seems to be a somewhat common problem.

This means that your DLL is for a wrong architecture.

The package’s author needs to ship a private copy of the library – and preferrably, load it via exact path rather than search on PATH. That’s because Windows doesn’t provide a stock copy and even if the user happens to have one somewhere, there’s no guarantee that it will be binary compatible with the Julia module (like in your case. You were lucky and got a descriptive error. If you weren’t, the app would just crash.).

So I posted an issue to the GZip github repo, and it turns out that zlib1 is shipped with Julia, but its name is different in Julia 1.3, so GZip just needs to update the name it’s looking for if the Julia version is 1.3. See the issue here: https://github.com/JuliaIO/GZip.jl/issues/83

Thanks for the help throughout the process of figuring this out!

Imprint