vmngr / libvirt-old

Libvirt bindings for Node.js®
https://vmngr.com/
MIT License
11 stars 7 forks source link

Figure out how to build on Windows #4

Open leonrinkel opened 4 years ago

leonrinkel commented 4 years ago

Hi, Tested xml thing. I guess it is works as expected. I think i can create domain autostart method. Also added setVcpu method to domain builder, i'm collecting PR request

By the way i'm looking for building and running package on windows but can't get how to link libvirt package to node-gyp :(

Tested VNC configuration. Fuck wow, it is actually simpliest and most usefull solution to manage VMs with typescript. vmngr/libvirt already better than any of existing bindings lmao

Originally posted by @libvirtadept in https://github.com/vmngr/libvirt/pull/3#issuecomment-558607434

libvirtadept commented 4 years ago

In my case solved by switching to Ubuntu instead using 2nd PC with qemu software. I guess it is better to develop and test on one machine instead 2 of them.

Whoops, forgot to say With ubuntu it is just installing sudo apt-get install libvirt-dev

libvirtadept commented 4 years ago

Nah, ubuntu working is kinda shitty actually. Trying to get it working on windows.... Each time showing that virt.lib not found (if specified in link_settings.libraries). If not, it is showing LNK 2019 error (unresolved external symbol)

libvirtadept commented 4 years ago

Hm. It's little bit confusing. In windows without libraries settings it is returning a lot of hypervisor-domain.obj : error LNK2001: unresolved external symbol virDomainGetID [C:\Users\admin\Desktop\libvirt-dev-xml\build\virt.vcxproj] errors

leonrinkel commented 4 years ago

Ok I've had a look into it and I didn't even got close to getting it to work... How did you install the Windows-equivalent of libvirt-dev? Did you build it from source?

libvirtadept commented 4 years ago

As I saw in Linux case it is adding header files in /usr/include (kind of) I’ve downloaded source files from libvirt’s github and added “include” folder to included_dirs (binding.gyp). Note: libvirt-common.h here is named as libvirt-common.h.in. I can create example repo if it will help

libvirtadept commented 4 years ago

vcpkg and chocolatey doesn’t have libvirt-dev package As I remember Cygwin have only old package named as libvirt-devel

leonrinkel commented 4 years ago

That’s not gonna work, the .h.in files are header files that need some preprocessing. Building libvirt will produce the actual header and library files. There is a guide on how to compile it from source on Windows, but that requires even more other dependencies and ugh ... I’ll have a look into it tomorrow.

libvirtadept commented 4 years ago

Oh Didn’t knew about pre processing. Libvirt usage on windows is so problematic 😞

leonrinkel commented 4 years ago

Ok I got it working with WSL. It's not 100% native Windows but it's way easier than anything else. Another easy workaround would be to use Docker.

libvirtadept commented 4 years ago

Yeah, thought about building in wsl. Other case if user developing under windows and downloading package from npm/github that's not gonna build. In case of docker, yes there is will no troubles

libvirtadept commented 4 years ago

I've make domiftune --current work But virsh-way realisation needed a g_malloc0_n func from glib (idk what is actually). Replaced it with malloc and it is seems work, but not sure is it good approach How you looking on requiring linking of glib-2.0 for build ?

image

libvirtadept commented 4 years ago

@leonrinkel Tested to develop inside WSL. Looks terrible. No autcomplete, no "go to definition", included paths are ignored

After some random clicks make it work. Oh that's feel. UI not laggin, switch between windows are so easy :) Time to develop some features....

dhirajtech86 commented 4 years ago

Guys I have installed QEMU on windows and now planning to try this package via WSL on the same system. can you guide me on how to do that? Is it even possible or not?

I have tried installing libvirt on WSL but not able to run its service (/var/run/libvirtd.pid: No such file or directory). Though libvirt-dev is installed.

Please suggest how to proceed further.