hasse69 / rar2fs

FUSE file system for reading RAR archives
https://hasse69.github.io/rar2fs/
GNU General Public License v3.0
279 stars 27 forks source link

Is compilation in Mingw for Win possible? #130

Closed derinsh0 closed 4 years ago

derinsh0 commented 4 years ago

I read the thread about compiling under cygwin, and it looks pretty straightforward. But I don't have cygwin, and didn't think I needed it, since Mingw can compile most programs natively for Windows.

I installed WinFsp, and with ./configure it complains about not finding fuse. --with-fuse= worked, but now it complains about fuse-lib, and --with-fuse-lib=/c/WinFsp/lib did not solve anything.

I'm trying to build the release, which I assume contains most dependencies like unrar?

This is my configure output, what's this 'fuse_new' it's looking for? Appreciate it

hasse69 commented 4 years ago

WinFSP comes with a pre-built FUSE library/dll. I think you need to check with the WinFSP project if mingw/64 is supported or not. The error you get is because it cannot be found in the system path so most likely it has not been installed properly.

derinsh0 commented 4 years ago

WinFSP comes with a pre-built FUSE library/dll. I think you need to check with the WinFSP project if mingw/64 is supported or not. The error you get is because it cannot be found in the system path so most likely it has not been installed properly.

Oh okay. I was somewhat confused by the library installed with Winfsp, so I installed Dokany instead, and that provided libdokanfuse1.dll, which I renamed to ldokanfuse1.dll which rar2fs picked up just fine. But it complained dokany's fuse.h is "unusable" so I let it take the working ones of each software.

Now, I get the scandir error. I googled on this, and most results come back to this github page, and I don't know what to make of that. I read an old thread, where you provided a patch for scandir, but I guess the repo has changed too much and it couldn't apply. And if I'm not mistaken, you've also tried out building it with msys2/mingw once before?

This is the latest output of my configure

checking fuse.h usability... yes checking fuse.h presence... yes checking for fuse.h... yes checking for fuse_new in -lfuse... no checking for fuse_new in -ldokanfuse1.dll... yes checking for fuse_version... yes checking for supported FUSE API version... yes checking if we need to set -DCYGFUSE... yes checking how to run the C++ preprocessor... ccache g++ -E checking rar.hpp usability... yes checking rar.hpp presence... yes checking for rar.hpp... yes checking for static linking of UnRAR library... fallback checking if unrar library needs -DRAR_SMP... yes checking for iconv... yes checking for working iconv... yes checking how to link with libiconv... -liconv checking for iconv declaration... extern size_t iconv (iconv_t cd, char inbuf, size_t inbytesleft, char outbuf, size_t outbytesleft); checking for commit hash in git repo... no checking for sched_setaffinity... no checking scandir ARG3 => const struct dirent ... not ok checking scandir ARG3 => struct dirent ... not ok configure: error: scandir unable to find a working combination

config.log

Also googled for 'alphastort' undeclared and results came back to try #define _GNU_SOURCE but don't know how to :/

hasse69 commented 4 years ago

I am sorry, but I do not think I can be of much help here.

What your are trying to do is completely unsupported and has never been tested before. First of all, you cannot mix software from two different packages like this, dokan/FUSE and WinFSP/FUSE are not compatible, Also, they are both based on Cygwin and again I must ask you to check with respective project if they ever tried building something using mingw. Secondly, you cannot just rename a library like you did!? I am surprised your configuration managed to pick something up at all? It will look for libdokanfuse1.dll, no more, no less. Renaming it should make the library discovery to fail miserably.

When it comes to the alphasort and scandir issues I can only guess it is because mingw does not provide compatible signatures for those functions. Again, if we look at the difference between cygwin and mingw they are basically

Cygwin is designed to provide a more-or-less complete POSIX environment for Windows, including
an extensive set of tools designed to provide a full-fledged Linux-like platform. In comparison, 
MinGW and MSYS provide a lightweight, minimalist POSIX-like layer, with only the more essential 
tools like gcc and bash available. Because of MinGW's more minimalist approach, it does not provide 
the degree of POSIX API coverage Cygwin offers, and therefore cannot build certain programs which 
can otherwise be compiled on Cygwin.

To build rar2fs you need a fully POSIX-compliant run-time and compile-time environment. I am not too sure mingw will give you that.

EDIT:

You also need to check with www.rarlabs.com if unrarsrc can be built using mingw. I did a quick test and installed msys and I could not get it to compile. Without a working build of unrarsrc there is no point chasing this one further.

derinsh0 commented 4 years ago

Okay. I'm not going to chase this anymore since I'm not fluent enough in compiling. Let alone cross-compiling. Thanks for trying to help though..

Just some clarification. I compiled unrar myself with make -C unrar lib it did a bunch of "redefinitions" but in the end it did successfully compile (under msys2/mingw). That's why configure said checking rar.hpp usability... yes etc

I thought rar2fs doesn't look for libdokanfuse, since it says checking for fuse_new in -ldokanfuse1.dll that's why I renamed it, Dokany provided me with libdokanfuse1.dll so I thought maybe Dokany has arbitrarily renamed their dll 'l' to 'lib', while configure is not updated. If it has the same content/library, I assumed it should technically work. Like making a symlink to a shared library but with a different name

hasse69 commented 4 years ago

We can return to this topic if you can make all the dependencies (unrar and/or dokan/winfsp) to work seamlessly using mingw/msys. Until then I can only recommend you to use cygwin which has been verified to work with all these packages, including rar2fs.