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

Supporting Windows? #123

Open
dirkarnez opened this issue Jan 4, 2022 · 18 comments
Open

Supporting Windows? #123

dirkarnez opened this issue Jan 4, 2022 · 18 comments

Comments

@dirkarnez
Copy link

As title, thanks!

@aidin36
Copy link
Owner

aidin36 commented Jan 6, 2022

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

@DThiebaud
Copy link
Contributor

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?

@aidin36
Copy link
Owner

aidin36 commented Jan 6, 2022

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.

@dirkarnez
Copy link
Author

Thank you all for your attention and interest!

@DThiebaud
Copy link
Contributor

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
Copy link
Contributor

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?

@aidin36
Copy link
Owner

aidin36 commented Jan 10, 2022

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.

@DThiebaud
Copy link
Contributor

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
Copy link
Contributor

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

@DThiebaud
Copy link
Contributor

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
Copy link
Contributor

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?

@aidin36
Copy link
Owner

aidin36 commented Jan 26, 2022

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.

@DThiebaud
Copy link
Contributor

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.

@aidin36
Copy link
Owner

aidin36 commented Feb 16, 2022

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.

@DThiebaud
Copy link
Contributor

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
Copy link
Contributor

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.

@aidin36
Copy link
Owner

aidin36 commented Feb 23, 2022

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

@DThiebaud
Copy link
Contributor

Any comment on the pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants