sshfs-win icon indicating copy to clipboard operation
sshfs-win copied to clipboard

Build sshfs

Open sganis opened this issue 7 years ago • 9 comments

@billziss-gh I was wondering if you could include some documentation to build sshfs in windows, similar to the passthrough tutorial in winfsp, which is excellent. Thank you.

sganis avatar Jul 28 '18 12:07 sganis

  1. Install WIX toolkit 3.10
  2. Run cygwin terminal, ensure that standard build tools are installed
  3. copy fuse module from winfsp installation as instructed on its website
  4. Run make in sshfs-win project directory

On 28 Jul 2018 14:13, "Santiago Ganis" [email protected] wrote:

@billziss-gh https://github.com/billziss-gh I was wondering if you could include some documentation to build sshfs in windows, similar to the passthrough tutorial in winfsp, which is excellent. Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/billziss-gh/sshfs-win/issues/41, or mute the thread https://github.com/notifications/unsubscribe-auth/AEE6AyWQlhWVvEoVo10IIoK_qD7Dsg-dks5uLFVsgaJpZM4VlBZu .

4O4 avatar Jul 28 '18 12:07 4O4

Thanks @4O4 . Fair enough. It didn't work for me as easy as you mention, there was something wrong in my setup, but I understand the process a little more now. I just needed to debug something in the sshfs-win.exe and it builds with a simple "gcc sshfs-win.c" invocation.

Here is my building experience, just for documentation purposes:

  1. Install SSHFS-Win, WinFsp, and WIX Toolset. Versions that I used in this test: SSHFS-Win 3.2 BETA, WinFsp 2018.2 B2, WIX Toolset 3.11.

  2. Install cygwin Download from https://www.cygwin.com/setup-x86_64.exe Run installer and follow default settings

  3. Install development tools, minimum packages: gcc-g++,make,automake,patch,vim,git,libglib2.0-devel,cygport,meson. An simple way to do it is this: Copy setup-x86_64.exe to c:\cygwin64, then from a cygwin terminal run: $ /setup-x86_64.exe -q -B -P gcc-g++,make,automake,patch,vim,git,libglib2.0-devel,cygport,meson

  4. Install cygfuse by running: $ /cygdrive/c/Program\ Files\ (x86)/WinFsp/opt/cygfuse/install.sh

  5. Clone the sshfs-win repository $ git clone https://github.com/billziss-gh/sshfs-win.git

  6. Update the sshfs submodule Go to the sshfs-win project directory, then run: $ git submodule init $ git submodule update

  7. Run make in parallel mode $ make -j8

  8. An msi file installer will be saved in .build/x64/dist folder. It builds with some warnings that I coundn't get rid of, such as missing rst2man package.

Thanks to @billziss-gh for the latest release.

sganis avatar Aug 03 '18 07:08 sganis

@sganis thank you for the instructions. I will adapt them and add them to the README.

billziss-gh avatar Aug 03 '18 17:08 billziss-gh

Does anyone know how to make a proper debug build? Seems that the problem lays within the 'ninja' config but it's impossible to edit it since it's pretty much 'make clean & make' to build the stuff. And 'clean' erases the ninja config so therefore you cannot edit it when it's building the application immediately after downloading the code (again?) from git. I used the instructions from @sganis to perform the compilation.

I need to debug the sshfs process itself and the default config doesn't generate the symbols. It would also be really nice to get this whole thing working on Visual Studio because debugging (and compiling + starting the app) via GDB is painful.

darkcharmander avatar Apr 08 '20 21:04 darkcharmander

I think @sganis had a Visual Studio build at some point.

To produce debug builds with meson I think you need to use --buildtype=debug. See here.

billziss-gh avatar Apr 08 '20 21:04 billziss-gh

After messing around I got it to work, I will post here what I did:

  • Edit the Makefile in the root folder to call meson with --buildtype=debug (I think this doesn't do anything), execute make to build everything.
  • Go to this temp build folder '.build/x64/src/sshfs' and edit the meson script to include debug options for GCC by hand. (-g).
  • Navigate to another build folder: '.build/x64/src/sshfs/build'
  • Execute some commands to build sshfs: $ meson setup --wipe; meson ..; ninja
  • Copy the compiled sshfs.exe ('.build/x64/src/sshf/build/sshfs.exe') to the main temp build folder which also contains the other executables: '.build/x64/root/bin'
  • Run sshfs-win.exe (Which calls sshfs.exe by itself) as usual. Don't know yet how to generate an installer based on this however.

So that's what I did, and it works somewhat since sshfs.exe now contains debug symbols. (I did not attempt actual debugging itself since I've spent a lot of time on this and it's night time already!) It is extremely painful to do this: I can't really believe that it's supposed to be done this way so I am probably doing something wrong. The real problem is I think that 'make' is cloning this git repo with it's own config file which makes you lose your changes when you execute 'make clean'. Are there simple commands to do this for me? Compiling + debugging is pretty awkward like this. I also would like to know whether I am indeed supposed to edit the .c files in the cloned git repo, or in the main folder.

darkcharmander avatar Apr 08 '20 23:04 darkcharmander

@darkcharmander if you need to debug sshfs the best approach is to work against the upstream sshfs project directly. I use the SSHFS-Win Makefile only when I want to package it for distribution.

This project's goal was to provide patches for sshfs to build on Cygwin, and a Makefile/script to package all necessary files for deployment and easy use on Windows. It was never meant to facilitate debugging or development of sshfs.

Most sshfs-win patches have been upstreamed to the sshfs project, which should now build against a Cygwin with FUSE installed (available from the WinFsp installer).

billziss-gh avatar Apr 09 '20 18:04 billziss-gh

Thanks for clearing that up, I see that it is indeed a separate project. I will take a look at that one.

darkcharmander avatar Apr 10 '20 08:04 darkcharmander

Thanks @4O4 . Fair enough. It didn't work for me as easy as you mention, there was something wrong in my setup, but I understand the process a little more now. I just needed to debug something in the sshfs-win.exe and it builds with a simple "gcc sshfs-win.c" invocation.

Here is my building experience, just for documentation purposes:

  1. Install SSHFS-Win, WinFsp, and WIX Toolset. Versions that I used in this test: SSHFS-Win 3.2 BETA, WinFsp 2018.2 B2, WIX Toolset 3.11.
  2. Install cygwin Download from https://www.cygwin.com/setup-x86_64.exe Run installer and follow default settings
  3. Install development tools, minimum packages: gcc-g++,make,automake,patch,vim,git,libglib2.0-devel,cygport,meson. An simple way to do it is this: Copy setup-x86_64.exe to c:\cygwin64, then from a cygwin terminal run: $ /setup-x86_64.exe -q -B -P gcc-g++,make,automake,patch,vim,git,libglib2.0-devel,cygport,meson
  4. Install cygfuse by running: $ /cygdrive/c/Program\ Files\ (x86)/WinFsp/opt/cygfuse/install.sh
  5. Clone the sshfs-win repository $ git clone https://github.com/billziss-gh/sshfs-win.git
  6. Update the sshfs submodule Go to the sshfs-win project directory, then run: $ git submodule init $ git submodule update
  7. Run make in parallel mode $ make -j8
  8. An msi file installer will be saved in .build/x64/dist folder. It builds with some warnings that I coundn't get rid of, such as missing rst2man package.

Thanks to @billziss-gh for the latest release.

This helped me A LOT! But I also had to install cc and ccache separately for some reason

zejjnt avatar Sep 23 '25 03:09 zejjnt