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

Installation problem on Windows 7 #8

Closed
simonp0420 opened this issue Jun 3, 2014 · 25 comments
Closed

Installation problem on Windows 7 #8

simonp0420 opened this issue Jun 3, 2014 · 25 comments

Comments

@simonp0420
Copy link

I'm trying to install LightXML on Julia Version 0.3.0-prerelease+3225 (2014-05-27 03:45 UTC) x86_64-w64-mingw32. The Pkg.add session looks like this:

julia> Pkg.add("LightXML")
INFO: Installing LightXML v0.1.5
INFO: Package database updated

It doesn't appear to be installing the libxml2.dll binary dependency. When I try to use the module I get the following:

julia> using LightXML
ERROR: could not load module libxml2: %1 is not a valid Win32 application.

 in dlopen at c.jl:17
 in include at boot.jl:244
 in include_from_node1 at loading.jl:128
 in include_from_node1 at loading.jl:124
while loading c:\home\simonp\.julia\v0.3\LightXML\src\clib.jl, in expression starting on line 3
while loading c:\home\simonp\.julia\v0.3\LightXML\src\LightXML.jl, in expression starting on line 24

I have several libxml2.dll files on my hard drive, installed by various other Windows applications. I tried to see which one occurs first in my PATH by using which at the REPL shell mode:

shell> which libxml2.dll
/cygdrive/c/Program Files (x86)/Graphviz2.26.3/bin/libxml2.dll

So I'm guessing that Julia is finding the DLL installed by Graphviz, which is unsuitable for some reason; perhaps it's 32-bit rather than 64-bit.

Poking around in c:\home\simonp.julia\v0.3\WinRPM\deps\usr\x86_64-w64-mingw32\sys-root\mingw\bin, I see that there is a file there named libxml2-2.dll. I see from the build script in LightXML that this is an alternative name for libxml.dll. I checked DL_LOAD_PATH and it is empty, so I executed

julia> push!(DL_LOAD_PATH, "c:/home/simonp/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin")
1-element Array{Union(UTF8String,ASCIIString),1}:
 "c:/home/simonp/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin"

followed by

julia> require("LightXML.jl")
Warning: replacing module LightXML
ERROR: could not load module libxml2: %1 is not a valid Win32 application.

 in dlopen at c.jl:17
 in include at boot.jl:244
 in include_from_node1 at loading.jl:128
 in include_from_node1 at loading.jl:124
while loading c:\home\simonp\.julia\v0.3\LightXML\src\clib.jl, in expression starting on line 3
while loading c:\home\simonp\.julia\v0.3\LightXML\src\LightXML.jl, in expression starting on line 24

Since this didn't work, I copied libxml2-2.dll in this directory to libxml2.dll in the same directory and tried again:

julia> require("LightXML.jl")
Warning: replacing module LightXML

Progress! So I tried parsing the XML file stored in the test subdirectory:

julia> cd("c:/home/simonp/.julia/v0.3/LightXML/test")

julia> docstr = """
       <?xml version="1.0" encoding="UTF-8"?>
       <bookstore>
         <book category="COOKING" tag="first">
           <title lang="en">Everyday Italian</title>
           <author>Giada De Laurentiis</author>
           <year>2005</year>
           <price>30.00</price>
         </book>
         <book category="CHILDREN">
           <title lang="en">Harry Potter</title>
           <author>J K. Rowling</author>
           <year>2005</year>
           <price>29.99</price>
         </book>
       </bookstore>
       """
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bookstore>\n  <book category=\"COOKING\" tag=\"first\">\n    <title lang=\"en\">Everyday Italian</title>\n    <author>Giada De Laurentiis</author>\n    <year>2005</year>\n    <price>30.00</price>\n  </book>\n  <book category=\"CHILDREN\">\n    <title lang=\"en\">Harry Potter</title>\n    <author>J K. Rowling</author>\n    <year>2005</year>\n    <price>29.99</price>\n  </book>\n</bookstore>\n"

julia> xdoc = parse(docstr)
ERROR: ParseError("colon expected in \"?\" expression")
 in parse at string.jl:1211

Hopefully, my fumbling attempts will help you to pinpoint the problem and its solution.
@tkelman (pinging you since I see you did the WinRPM PR)

Thanks,
--Peter

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Not so sure about the ParseError, but looks like we might want to follow the approach we took in LibCURL and use exclusively the libxml2-2 name in deps/build.jl, since that's hopefully less likely to show up randomly somewhere in PATH.

@simonp0420
Copy link
Author

I checked, and libxml2-2.dll does not occur anywhere in my path :-).

The ParseError was due to my mistakenly invoking parse() rather than parse_string() on the string. With the new libxml2.dll in place, parse_string() works fine.

But I do need to both rename or copy the DLL to libxml2.dll and execute push!(DL_LOAD_PATH, "c:/home/simonp/.julia/v0.3/WinRPM/deps/usr/x86_64-w64-mingw32/sys-root/mingw/bin") in order to get the package to work.

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

I was suggesting changing this line https://github.com/lindahua/LightXML.jl/blob/master/deps/build.jl#L6 to libxml2 = library_dependency("libxml2-2") then you shouldn't need to rename the file or mess with DL_LOAD_PATH, hopefully.

@simonp0420
Copy link
Author

It works! Some problems running some of the tests, I think due to deprecated @test_throws, and the fact that rtxt in create.jl contains some ‘\r’ characters that are not present in the string(xdoc) variable to which it is being compared—probably a Windows-only problem that may have escaped attention until now.

From: Tony Kelman [mailto:notifications@github.com]
Sent: Tuesday, June 03, 2014 1:20 PM
To: lindahua/LightXML.jl
Cc: simonp0420
Subject: Re: [LightXML.jl] Installation problem on Windows 7 (#8)

I was suggesting changing this line https://github.com/lindahua/LightXML.jl/blob/master/deps/build.jl#L6 to libxml2 = library_dependency("libxml2-2") then you shouldn't need to rename the file or mess with DL_LOAD_PATH, hopefully.


Reply to this email directly or view it on GitHub #8 (comment) . https://github.com/notifications/beacon/4294361__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzQ0NjAyMywiZGF0YSI6eyJpZCI6MzM3MzMyNDZ9fQ==--45dc4b774e814afcc61671ad78e5e61a2acb936e.gif

@lindahua
Copy link
Contributor

lindahua commented Jun 3, 2014

I made a change in dd22ca7 following @tkelman's suggestion.

Would you please checkout the latest master branch and see whether it works in windows? I don't have a windows machine to test it.

@simonp0420
Copy link
Author

Thanks for the quick action. It now works fine, except for a single deprecation warning when running the tests:

julia> include("test/parse.jl")

WARNING: @test_throws without an exception type is deprecated

     Use @test_throws XMLAttributeNotFound attribute($(Expr(:parameters, :(required=true))),xb2,"wrongattr")

in backtrace at error.jl:30

Ptr{Void} @0x0000000000000000

To fix it I had to change line 103 of tests/parse.jl to

@test_throws LightXML.XMLAttributeNotFound attribute(xb2, "wrongattr"; required=true)

It needed the module prefix or it would complain that the exception type was undefined.

From: Dahua Lin [mailto:notifications@github.com]
Sent: Tuesday, June 03, 2014 2:11 PM
To: lindahua/LightXML.jl
Cc: simonp0420
Subject: Re: [LightXML.jl] Installation problem on Windows 7 (#8)

I made a change in dd22ca7 dd22ca7 following @tkelman https://github.com/tkelman 's suggestion.

Would you please checkout the latest master branch and see whether it works in windows? I don't have a windows machine to test it.


Reply to this email directly or view it on GitHub #8 (comment) . https://github.com/notifications/beacon/4294361__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzQ0OTA1OCwiZGF0YSI6eyJpZCI6MzM3MzMyNDZ9fQ==--d373c85fffbdfd81040b5997f569de617b1429ab.gif

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Thanks @lindahua! Whoops, I can confirm the run_tests.jl is erroring due to line endings, my previous tests several months ago were not very thorough. Should run_tests.jl be renamed to test/runtests.jl to allow Pkg.test("LightXML") to work?

@simonp0420
Copy link
Author

Adding the line

@windows_only rtxt=replace(rtxt, "\r", "")

just before the @Assert line in create.jl and cdata.jl eliminated the test failures for me.

@tkelman
Copy link
Contributor

tkelman commented Jun 3, 2014

Safer to make that replace(rtxt, "\r\n", "\n")

@simonp0420
Copy link
Author

Sounds right. Thanks for all the quick help, @tkelman and @lindahua . OK to close the issue now?

@simonp0420
Copy link
Author

Hmm, just tried installing on a new machine and got this error:

julia> Pkg.add("LightXML")
INFO: Installing LightXML v0.1.6
INFO: Building LibCURL
WARNING: The URLParse.jl package has been deprecated in favour of JuliaWeb/URIParser.jl
https://github.com/JuliaWeb/URIParser.jl
As of Julia 0.4 this package will no longer be installable
through `Pkg.add`. Please convert your code accordingly.
INFO: Updating WinRPM package list
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_13.1//repodata/repomd.xml INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_13.1//repodata/repomd.xml INFO: Building WinRPM
INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_13.1//repodata/repomd.xml INFO: Downloading http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_13.1//repodata/repomd.xml INFO: Building LightXML
=================================================[ ERROR: LightXML ]=================================================


None of the selected providers can install dependency libxml2.
Use BinDeps.debug(package_name) to see available providers

while loading c:\home\simonp\.julia\v0.3\LightXML\deps\build.jl, in expression starting on line 11

=====================================================================================================================

Then I tried checking out the master version and got the same error. Playing with this a bit, I found that replacing https://github.com/lindahua/LightXML.jl/blob/master/deps/build.jl#L8 with

provides(WinRPM.RPM, "libxml2-2", libxml2, os = :Windows)

seems to fix the problem. I'm happy to submit a PR, if desired.

--Peter

@tkelman
Copy link
Contributor

tkelman commented Sep 25, 2014

@simonp0420 I have a commit that makes exactly that change pending in #9

@lindahua I can understand if you're busy, but ignoring your github notifications is a major problem. Would you be willing to give a few other people commit access to this repository, or migrate it to JuliaLang so it can be maintained by the community?

@tkelman
Copy link
Contributor

tkelman commented Sep 25, 2014

@IainNZ or @StefanKarpinski what's the standard practice for moving a repository to the organization, assuming Dahua agrees?

@IainNZ
Copy link
Contributor

IainNZ commented Sep 25, 2014

The organization needs to grant temporary administrative rights to @lindahua, then @lindahua can transfer it (in the repo settings). METADATA url can then be updated (but it'll work with old one because of redirects).

@lindahua
Copy link
Contributor

I am willing to transfer the package. But I need the temporary permission.

@tkelman
Copy link
Contributor

tkelman commented Oct 28, 2014

Paging @ViralBShah or @JeffBezanson or @StefanKarpinski

@lindahua
Copy link
Contributor

The package has been transferred to JuliaLang.

@tkelman
Copy link
Contributor

tkelman commented Nov 2, 2014

Great, thanks! It seems I got #9 a little bit wrong, I'm getting BinDeps not defined. I think I may instead just add BinDeps to REQUIRE for all platforms, since so many other packages need BinDeps I don't think it's a major problem to do so.

@lindahua
Copy link
Contributor

lindahua commented Nov 2, 2014

I don't have windows machines. Hopefully somebody working with Windows can figure this out.

@tkelman
Copy link
Contributor

tkelman commented Nov 2, 2014

I think I got it resolved on master, I made a couple small commits (hope you don't mind). Can you verify that master still works okay on existing platforms?

@simonp0420
Copy link
Author

I can confirm that master passes all the tests on CentOS 6.4, Julia 0.3.2.

@tkelman
Copy link
Contributor

tkelman commented Nov 17, 2014

@simonp0420 thanks, I'll tag a new version then

@simonp0420
Copy link
Author

Thanks very much, @tkelman! Tagged version now installs and runs smoothly in Windows :).

@tkelman
Copy link
Contributor

tkelman commented Nov 18, 2014

Does it pass Pkg.test or do we still need to figure out the line endings problem?

@simonp0420
Copy link
Author

The tests also run smooth as silk. Thanks again!

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

4 participants