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

Windows OS support #13

Open
bbrendon opened this issue Jan 1, 2021 · 25 comments
Open

Windows OS support #13

bbrendon opened this issue Jan 1, 2021 · 25 comments
Labels
port ports to other browsers/OSes

Comments

@bbrendon
Copy link

bbrendon commented Jan 1, 2021

Any hope for the Windows crew?

@jtagcat
Copy link

jtagcat commented Jan 2, 2021

Though it probably doesn't 'just work' (assuming you're not running the browser in WSL), I think you could do something with WSL..?

@MinchinWeb
Copy link

WSL doesn't officially support GUI applications, so you'd first have get your browser up and running in WSL. I've never tried, so I don't know how involved that would be...

@osnr
Copy link
Owner

osnr commented Jan 3, 2021

maybe with WinFUSE: https://github.com/billziss-gh/winfuse it sounds like this may work with Windows processes too?

or maybe with Dokan FUSE instead of WSL/WinFUSE? https://dokan-dev.github.io/

I don't plan on getting to this myself, but if someone wants to look at it, I'll certainly merge a pull request. My hope is that you could use one of the above and just add another set of cases to the fs Makefile and install.sh and tabfs.c -- like for FreeBSD and it would otherwise just work.

@JinchengWang
Copy link

So I just tried this on WSL2.
WSL2 actually supports FUSE natively https://devblogs.microsoft.com/commandline/announcing-wsl-2/
The host binary compiled perfectly too, but accessing mnt just hangs forever. No idea what's going on here...

@osnr
Copy link
Owner

osnr commented Jan 3, 2021

cool! do you know if the FUSE filesystem gets exposed to Windows applications?

re: the hang, I would look at the browser console for the extension to see if it gets any fs requests and/or try to strace a basic command like ls mnt to see what requests it tries to issue (can you do that on WSL2?)

@JinchengWang
Copy link

Concerning whether the FUSE filesystem gets exposed to Windows applications: I have no idea how FUSE or WSL work....
I set this up by making the manifest reference a .bat script which calls wsl which calls bash which calls tabfs which is a linux binary.

The extension says:
Unchecked runtime.lastError: Error when communicating with the native messaging host.
Context
_generated_background_page.html
Stack Trace
_generated_background_page.html:0 (anonymous function)

And this is the strace
strace.txt

@osnr osnr added the port ports to other browsers/OSes label Jan 4, 2021
@osnr
Copy link
Owner

osnr commented Jan 16, 2021

update from @nightlark trying MinGW + WinFsp: https://twitter.com/rmast/status/1350344895882412032

@AlexRMU
Copy link

AlexRMU commented Jan 16, 2021

@osnr
Can I have instructions for the uninitiated?

@nightlark
Copy link

@AlexRMU the rough steps I followed were:

  1. Install WinFsp
  2. Install mingw-w64 (if not already installed, make sure it has a working copy of gcc).
  3. In a MinGW command prompt, run this command to compile the native component of tabfs: gcc tabfs.c -o tabfs.exe -L"C:\Program Files (x86)\WinFsp\lib" -I"C:\Program Files (x86)\WinFsp\inc\fuse" -lwinfsp-x64
  4. Run compiled tabfs binary using TABFS_MOUNT_DIR="Q:" ./tabfs.exe (winfsp-x64.dll will need to be in the same folder as the tabfs binary). This is where things currently stop working -- the WinFsp memfs example mounts a drive, whereas running tabfs creates a directory in the current working directory that doesn't seem to be accessible other than from a MinGW shell.

A weird thing with (native) Windows FUSE implementations is that the virtual filesystems get mounted as drive letters rather than folders.

@AlexRMU
Copy link

AlexRMU commented Jan 16, 2021

  1. What version do I need? Win-Builds?
    http://mingw-w64.org/doku.php/download

@nightlark
Copy link

I think the one I have on my system is listed as MingW-W64-builds on that page, but I don't see why Win-Builds wouldn't work to compile tabfs. Will be interesting to see if you get better results with the filesystem mounting correctly.

@AlexRMU
Copy link

AlexRMU commented Jan 16, 2021

D:\Desktop\TabFS-win-tabfs\fs\tabfs.c: In function 'tabfs_readdir':
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:367:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0; json_scanf_array_elem(rdata, rsize, ".entries", i, &t) > 0; i++) {
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:367:5: note: use option -std=c99 or -std=gnu99 to compile your code
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c: At top level:
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:456:5: warning: initialization from incompatible pointer type [enabled by default]
     .getattr  = tabfs_getattr,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:456:5: warning: (near initialization for 'tabfs_oper.getattr') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:460:5: warning: initialization from incompatible pointer type [enabled by default]
     .read    = tabfs_read,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:460:5: warning: (near initialization for 'tabfs_oper.read') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:461:5: warning: initialization from incompatible pointer type [enabled by default]
     .write   = tabfs_write,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:461:5: warning: (near initialization for 'tabfs_oper.write') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:465:5: warning: initialization from incompatible pointer type [enabled by default]
     .readdir    = tabfs_readdir,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:465:5: warning: (near initialization for 'tabfs_oper.readdir') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:468:5: warning: initialization from incompatible pointer type [enabled by default]
     .truncate = tabfs_truncate,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:468:5: warning: (near initialization for 'tabfs_oper.truncate') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:471:5: warning: initialization from incompatible pointer type [enabled by default]
     .mkdir  = tabfs_mkdir,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:471:5: warning: (near initialization for 'tabfs_oper.mkdir') [enabled by default]
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:472:5: warning: initialization from incompatible pointer type [enabled by default]
     .create = tabfs_create,
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:472:5: warning: (near initialization for 'tabfs_oper.create') [enabled by default]

And the file didn't appear

@nightlark
Copy link

Try adding the suggested option to the gcc command. Is that using the Win-Builds gcc?

@AlexRMU
Copy link

AlexRMU commented Jan 16, 2021

Yes
.\gcc .\TabFS-win-tabfs\fs\tabfs.c -o .\tabfs.exe -L"D:\Program Files (x86)\WinFsp\lib" -I"D:\Program Files (x86)\WinFsp\inc\fuse" -lwinfsp-x64

@AlexRMU
Copy link

AlexRMU commented Jan 17, 2021

What's up?

@nightlark
Copy link

Did you try adding one of the standard options the error message suggested?

D:\Desktop\TabFS-win-tabfs\fs\tabfs.c: In function 'tabfs_readdir':
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:367:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (int i = 0; json_scanf_array_elem(rdata, rsize, ".entries", i, &t) > 0; i++) {
     ^
D:\Desktop\TabFS-win-tabfs\fs\tabfs.c:367:5: note: use option -std=c99 or -std=gnu99 to compile your code

@AlexRMU
Copy link

AlexRMU commented Jan 17, 2021

Oh, sorry, I didn't notice

@AlexRMU
Copy link

AlexRMU commented Jan 17, 2021

You can't run this command in the console, I used this: .\tabfs.exe TAGS_MOUNT_DIR="Q:".
If just open tabfs.exe then he writes that he needs libwinpthread-1.dll from mingw-w64\bin and winfsp-x64.dll from WinFsp\bin. Okay I just made a merge of WinFsp and mingw-w64.
Then I executed the command, output:
'{"id": 2, "op": "getattr", "path": "/"}
The disk did not appear, after a while the execution stopped:
[process terminated with code 5]

@AlexRMU
Copy link

AlexRMU commented Jan 17, 2021

This is where things currently stop working

As I understand it, nothing is working at the moment? Can @osnr help?

@nightlark
Copy link

nightlark commented Jan 17, 2021

Depending on if you open it in a MinGW, MSYS, or Windows Command Prompt shell the result may vary slightly, but none of them seem to mount it correctly.

From here I think the thing to do is check if a minimal example using winfsp/fuse works with MinGW. If it doesn't, there are two ways I see to proceed are:

  1. Get tabfs.c compiling with MSVC instead. Depending on the POSIX features used, this could be close to a full rewrite.
  2. Try cgofuse (made by the maintainer of winfsp) and see if it can mount a drive. May be faster than rewriting for MSVC and easier to build/maintain for Windows support.

@huglovefan
Copy link
Contributor

i've gotten this to work with cygwin in #67 if there's still interest in this

there are build instructions in the pull request for anyone willing to test it

@osnr
Copy link
Owner

osnr commented May 22, 2021

awesome! I will hopefully merge it sometime in the next few days.

I don't have a Windows machine atm -- would be great if someone on here could test it first. @nightlark ?

@nightlark
Copy link

nightlark commented Jul 20, 2021

I don't have cygwin installed at the moment -- I'll probably have some time to test it early August, and maybe also finish the CI builds.

@osnr
Copy link
Owner

osnr commented Jul 20, 2021

(do we want to depend on Cygwin? I feel like WSL [or whatever they call it now] is probably ascendant among Windows users?)

@nightlark
Copy link

I think it would be preferable not to depend on Cygwin. WSL doesn't support fuse but it looks like winfuse/winfsp may have WSL support -- so that could be easier than trying to replace POSIX calls with the Win32 equivalents (I don't think that would be as much work as I first thought, but still..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
port ports to other browsers/OSes
Projects
None yet
Development

No branches or pull requests

8 participants