Skip to content

Windows support #71

Closed
Closed

Description

@Zammy

Installer fails because there is not "which" under Windows. I have globally installed python so it should be able to use node-gyp.

Activity

  1. Oodar commented on Jul 13, 2013

    @Oodar

    You can use npm's which (npm install -g which), that seemed to get me past the initial inability to detect python. However, after that you'll probably get the same problem I am getting:

    [nodegit] Downloading libgit2 dependency.
    [nodegit] Building libgit2 dependency.

    events.js:72
    throw er; // Unhandled 'error' event
    ^
    Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)

  2. tbranyen commented on Aug 14, 2013

    @tbranyen
    Member

    I've been rewriting our installer in preparation for our next release.

    My goals are:

    • To reduce the complexity surrounding async.js (implementing Promises).
    • Allow for fallbacks if unable to natively build. (Downoading precompiled binaries).
    • Provide Windows support.
  3. caolan commented on Nov 28, 2013

    @caolan

    @tbranyen any news on Windows support? just tried this myself, would be really nice to have!

  4. tbranyen commented on Nov 28, 2013

    @tbranyen
    Member

    Hey @caolan I just pushed up the work I did on the new installer. https://github.com/nodegit/nodegit/compare/new-installer

    Could you give this a shot with node test-installer and see if it works for you. I was testing in a Windows 7 x64 virtual machine.

  5. tbranyen commented on Nov 28, 2013

    @tbranyen
    Member

    I'm seeing this issue when I try and use the installer, I'm not familiar enough with the binding.gyp file to know what msbuild setting I should be adding/changing.

    Looks to be like I need to change the configuration to Release instead of Debug.

  6. caolan commented on Nov 29, 2013

    @caolan

    hmm, not sure what I'm doing wrong but it doesn't find git2.lib - I've fetched the git submodule, do I need to do anything else?

  7. caolan commented on Dec 3, 2013

    @caolan

    Here's what I tried on Windows, using "Visual Studio Command Prompt (2010)"

    git clone https://github.com/nodegit/nodegit.git
    git checkout new-installer
    cd nodegit
    git submodule init
    git submodule update
    cd vendor\libgit2
    mkdir build && cd build
    cmake ..
    cmake --build .
    cd ..\..
    npm install
    

    I first installed:
    http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
    http://www.cmake.org/cmake/resources/software.html
    http://www.python.org/getit/

  8. tbranyen commented on Dec 3, 2013

    @tbranyen
    Member

    @caolan yeah that's the same problem i posted above. i'm not entirely sure why either. if i run msbuild manually I can get it to build no problem. i think this may be an issue with node-gyp

  9. caolan commented on Dec 4, 2013

    @caolan

    Changing the 'libraries' section in binding.gyp to this:

    'libraries': [
         '-L<!vendor\\libgit2\\build\\Debug\\git2.lib'
    ]
    

    Seemed to find git2.lib, but now I get lots of errors like this:

    copy.obj : error LNK2001: unresolved external symbol _git_oid_cpy [C:\Documents and Settings\Caolan McMahon\My Documents\nodegit\build\nodegit.vcxproj] C:\Documents and Settings\Caolan McMahon\My Documents\nodegit\build\Release\nodegit.node : fatal error LNK1120: 164 unresolved externals [C:\Documents and Settings\Caolan McMahon\My Documents\nodegit\build\nodegit.vcxproj]
    
  10. caolan commented on Dec 12, 2013

    @caolan

    The above libraries setting doesn't actually include the file it seems, since using libraries: [] yeilds the same errors.

    Interestingly, attempting to build in C:\NodeGit yields a different error, presumably something to do with spaces in paths?

  11. tbranyen commented on Dec 12, 2013

    @tbranyen
    Member

    @caolan if you run msbuild manually like I did, are you able to get it to build? (I agree I think it's incorrect paths)

  12. caolan commented on Dec 12, 2013

    @caolan

    if I use msbuild directly it doesn't find node.lib

  13. tbranyen commented on Dec 12, 2013

    @tbranyen
    Member

    Okay cool, so we're seeing the same issue.

    I think this piece on node-gyp might be helpful:

    Now you have your compiled .node bindings file! The compiled bindings end up in build/Debug/ or build/Release/, depending on the build mode. At this point you can require the .node file with Node and run your tests!

    Note: To create a Debug build of the bindings file, pass the --debug (or -d) switch when running the either configure or build command.


    I'm trying out --debug right now.

  14. tbranyen commented on Dec 12, 2013

    @tbranyen
    Member

    Okay few things. You probably didn't notice libraries doing anything since you forgot a node-gyp configure maybe?

    I changed the libraries path to:

                'libraries': [
                    '-l../vendor/libgit2/build/Debug/git2.lib'
                ],

    Looks like it's relative to the build directory where the visual studio project is.

    I ran with the path fix and that got past the error, but now it's exploding on compiling our library. Getting there...

  15. Jc2k commented on Dec 12, 2013

    @Jc2k

    What was happening with libraries was that -L gets mangled (if you npm install --verbose you see it doesn't recognise the option and chooses to ignore it). So when @caolan was setting libraries to only contain a -L it as the same as having an empty libraries.

    We tried to find a way to pass /LIBPATH: to the linker, but the docs weren't very clear on how you might do that - and it node-gyp kept mangling it to end in .lib or some other horror.

    Your solution neatly avoids this :)

  16. caolan commented on Dec 12, 2013

    @caolan

    using

    'libraries': [
        '-l../vendor/libgit2/build/Debug/git2.lib'
    ],
    

    I get lots of these errors again:

    ...
    error LNK2001: unresolved external symbol _git_oid_cpy
    
  17. Jc2k commented on Dec 13, 2013

    @Jc2k

    In my environment I can see that it's now finding git2.lib (because if i tell it to use gitX.lib it complains the file doesnt exist) but that it's not finding the symbols within the git2.lib.

    As per: http://stackoverflow.com/questions/488809/tools-for-inspecting-lib-files I checked the symbols were actually there, and can see them.

    So i'm wondering if the C++ bindings are trying to use the wrong calling conventions. Perhaps the functions declared in the includes aren't getting wrapped in extern "C" {} (there are macros to do this in the git2 headers, but they might use defines that aren't defined when using node-gyp??).

  18. tbranyen commented on Mar 23, 2014

    @tbranyen
    Member

    @caolan The branch https://github.com/nodegit/nodegit/tree/new-installer is up with the latest code, please spread the word to someone knowledgeable in this area of Windows node-gyp linking, because it's beyond my capabilities now.

  19. tbranyen commented on Mar 23, 2014

    @tbranyen
    Member

    #140 has more details on how to run and hit the issues.

  20. tbranyen commented on Apr 30, 2014

    @tbranyen
    Member

    If anyone is still interested, I just pushed some changes to master that should allow for installation in Windows. Let me know how it goes!

  21. caolan commented on May 2, 2014

    @caolan

    @tbranyen excellent to hear! I tried it out in a VM but had some problems with it detecting my Python install. Probably just me doing something stupid...

  22. tbranyen commented on May 2, 2014

    @tbranyen
    Member

    @caolan just for testing can you do:

    PYTHON=/path/to/you/python npm install

    Also, make sure it's Python 2.6 or 2.7.

    Sidenote: I'll be publishing prebuilt binaries for Windows soon, so this won't be an issue ;-)

  23. alessioalex commented on May 5, 2014

    @alessioalex

    @tbranyen that would be awesome, Windows is such a pain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions