tocc icon indicating copy to clipboard operation
tocc copied to clipboard

Supporting Windows?

Open dirkarnez opened this issue 3 years ago • 18 comments

As title, thanks!

dirkarnez avatar Jan 04 '22 18:01 dirkarnez

I'm don't own a Windows machine myself. But if someone take over the task, I would happily help them.

aidin36 avatar Jan 06 '22 00:01 aidin36

I will look into this. Is the goal to compile with MSVC, with one of the ports of GCC to windows (Cygwin or MinGW), or something else?

DThiebaud avatar Jan 06 '22 04:01 DThiebaud

Thanks @DThiebaud (: I assume MSVC means less dependency (and maybe easier for other developers/users to work with). So, try that first. But, anything that works is good. I have no strong opinion here.

aidin36 avatar Jan 06 '22 09:01 aidin36

Thank you all for your attention and interest!

dirkarnez avatar Jan 08 '22 12:01 dirkarnez

I cannot build libtocc/test without errors under Linux (Ubuntu 21.10). The linker gets loads of link errors because it cannot find Catch2 library, Howevever, Catch2.a is in /usr/lib. What am I doing wrong?

DThiebaud avatar Jan 09 '22 12:01 DThiebaud

I cannot build toccfs. Configure gives an error saying that fuse is not found, hoever I have fuse installed. Where is configure looking for fuse?

DThiebaud avatar Jan 09 '22 22:01 DThiebaud

I managed to compile both on my Ubuntu 20.04.

For tests, note that it depends on version one of Catch. I compiled and run tests with v1.10.0 of Catch. (It also mentioned in the docs: https://tocc.aidinhut.com/libtocc/compile.html#test-units)

For the fuse, do you have libfuse-dev package installed? -dev packages included the header files which is necessary to compile against the library. By the way, I believe FUSE doesn't officially support Windows. You can skip that for now, and focus on libtocc and the CLI.

aidin36 avatar Jan 10 '22 03:01 aidin36

I installed libfuse-dev and now I can build toccfs successfully under Ubuntu 21.10.

However, when I download Catch v1.10.0 into /usr/local/include, ./configure for tests still says it can't find it. See the attached print file. I"m sure I'm doing something wrong, but what? I'll try under Ubuntu 20.4 and see what results I get prt.txt .

DThiebaud avatar Jan 10 '22 04:01 DThiebaud

I have successfully created MSVC projects for libtocc and CLI which build successfully. I will now turn my attention to libtocc\tests.

DThiebaud avatar Jan 10 '22 20:01 DThiebaud

jTo compile libtocc/test on Ununtu 21.10, I had to edit catch.hpp. It was looking for SIGSTKSZ which wasn't defined. I replaced SIGSTKSZ with 100000 on two lines and it built cleanly and executed with no errors.

Now to build the tests in MSVC.

DThiebaud avatar Jan 10 '22 23:01 DThiebaud

I have built the tests in MSVC, but they all fail saying the database is not initialized. Do I have to initialize the database with CLI before I run the tests? Or do I have a bug somewhere?

DThiebaud avatar Jan 11 '22 04:01 DThiebaud

However, when I download Catch v1.10.0 into /usr/local/include, ./configure for tests still says it can't find it

That's strange. The only thing I can think of is that you still have version two of Catch somewhere. And for some reason, it picks version two at the compile time. (Obviously, our current setup is not good. We should find a way to isolate this from the system files. Probably we should ship catch.hpp with the code, or use a cpp package manager or something.)

I have built the tests in MSVC, but they all fail saying the database is not initialized

That's good news that you managed to compile and run it! Thanks for the hard work. Maybe it's because I hard-coded Linux paths in tests? Like this one: https://github.com/aidin36/tocc/blob/master/libtocc/tests/engine/files_engine_tests.cpp#L34 It should dynamically find the OS temp directory and uses that, instead of a hard-coded path.

aidin36 avatar Jan 26 '22 22:01 aidin36

I have libtocc libtocctests and cli building successfully in Linux and in MSCV. Libtocctests executes with all tests passed. I have not test CLI--do you have tests for it? Are these ready to push to git? I don't think I can get toccfs to work under MSVC. There are implementations of FUSE for windows but they seem to be oriented toward cygwin. I'll try toccfs under cygwin.

DThiebaud avatar Feb 15 '22 19:02 DThiebaud

Thanks for all the effort! Yes please make a PR with your changes. Also, it would be nice to document how to compile libtocc with MSVC, for other users and for future versions.

I wouldn't spend time on FUSE. As you said, it doesn't officially support Windows. So, I imagine we would have a hard time maintaining toccfs in a way that it runs on Windows (and keeping guides and documents up-to-date about how to compile and use it under Windows.) We can come up with other ideas for an interface between Windows disk storage and tocc. That would be more user-friendly and more efficient.

aidin36 avatar Feb 16 '22 20:02 aidin36

I will include a readme on how to build with msvc. Basically, it requires opening the "solution" in MSVC gui and telling MSVC to build it. For convenience under MSVC, I have while developing included unqlite.c and unqlite.h in the tocc directory tree and I have MSVC setup to look for it there. Is this what we want to do? Do we want to include the unqlite files in the files in the TOCC git, or should the directions for MSVC say say to download them and copy them to the appropriate directory?

I cannot get Catch v.1 to work under Windows. Functions defined in the header files are compiled into multiple object files and cause link errors about multiply define entry points. This seems to work under LInux but does not work under Windows. To work under Windows, I needed to go to Catch v. 3, which consists of header file catch_amalgamated.cpp and catch_amalgamated.h. This does not require source-code changes to TOCC and works under both Linux and Windows. Again like with unqlite, I have while developing included these files in the TOCC directory tree but this is not necessary if you do not like it.

I need to research the default include and lib directories for Windows.

DThiebaud avatar Feb 22 '22 03:02 DThiebaud

There apparently aren't default include and lib directories in Windows. We need to copy unqlite and catch_amalgamated files to the TOCC directory under MSVC. It might simplify things if we do this under Linux as well and include these files in git.

DThiebaud avatar Feb 22 '22 04:02 DThiebaud

For the unqlite it's not a bad idea to include it in the source code. After this version, they made it a closed source project and ask you to pay for it. (We should migrate to Sqlite, if someone is keen to do that.)

But for the Catch, I prefer not to. Users should get the latest version which can include bug fixes and potentially vulnerabilities fixes.

Also, can you please update the documents instead of the README.md file? Each project has a guide for how to compile it: https://github.com/aidin36/tocc/blob/master/libtocc/docs/source/compile.rst https://github.com/aidin36/tocc/blob/master/toccfs/docs/source/compile.rst https://github.com/aidin36/tocc/blob/master/cli/docs/source/compile.rst

aidin36 avatar Feb 23 '22 23:02 aidin36

Any comment on the pull request?

DThiebaud avatar Mar 17 '22 01:03 DThiebaud