wmww/Pinecone

Add Windows support

mdeilman opened this issue · 15 comments

Hi,

two small issues on Windows with gcc (gcc version 6.3.0 (GCC)). Both report missing headers which are typically not found on windows. I haven't looked at the implementation but I guess it is possible to work around these kind of issues. Not sure if you want support windows as platform at all.

First one - msys2 (bash environment)

[ome/src/github/Pinecone]>make
g++ -Wall -std=c++11 -O2 src/.cpp src/Actions/.cpp -o pinecone
src/msclStringFuncs.cpp:8:21: fatal error: termcap.h: No such file or directory

                 ^

compilation terminated.
make: *** [Makefile:6: build] Error 1

Second one Mingw and Windows console

c:\home\src\github\Pinecone>make
g++ -Wall -std=c++11 -O2 src/.cpp src/Actions/.cpp -o pinecone
src/msclStringFuncs.cpp:5:54: fatal error: sys/ioctl.h: No such file or directory
#include <sys/ioctl.h> // for terminal size detection
^
compilation terminated.
src/Actions/FunctionAction.cpp: In member function 'virtual void FunctionAction::addToProg(Action, Action, CppProgram*)'
:
src/Actions/FunctionAction.cpp:100:36: error: cast from 'ActionData*' to 'long int' loses precision [-fpermissive]
name="^func_"+to_string((long)&*action);
^~~~~~
make: *** [Makefile:6: build] Error 1

wmww commented

These problems shouldn't be terribly difficult to fix, but I believe there will be a number of more troublesome issues on windows even if it does compile. I will update the install tutorial to say that it does not currently work on windows so people don't waist their time. I do want to support windows soon, and it shouldn't be that big a job.

wmww commented

This will be the hub for updates on Windows support.

Just out of curiosity, what are the more troublesome issues you expect ? I agree the other ones should be easy to fix ... if I have time I can look into it ...

wmww commented

The two things I can think of are newline characters being two bytes on Windows and folder paths having backslashes. Idk how/if these will affect anything. I have't programmed on windows in a while, so I'm not sure what other issues there will be.

wmww commented

I think I have fixed the compile-time issues you were having (both those headers were used in determining terminal width, which is now just assumed to be 80 on windows). The changes are pushed to the develop branch. Let me know if it compiles, and, if so, what is broken when you run it.

Hello,

Not sure if I can be of a little help here for a temporary fix. If you are on Windows 10, there is a linux shell built in now by the Ubuntu developers, and simply requires activating in settings. This makes running Pinecone on Windows as easy as Linux. (This is obviously a temporary fix as not all Windows user will want to use WSL).

Link: https://msdn.microsoft.com/en-gb/commandline/wsl/install_guide

I will also attach a picture of the process I went through from start to finish of running Pinecone on WSL. Let me know if this is of any help.

pinecone

wmww commented

Thanks, this shouldn't be required for long though. I will try to get native windows support working this weekend.

wmww commented

You can now try and use the windows_support branch. I got it to build and run at one point, and since then I have added windows support to the test system, but I couldn't test because my tool chain got screwed up or something. If anyone wants to help out, build Pinecone on Windows (from the windows_support branch), run pinecone other/run_tests.pn and let me know what the output is. I will try to fix my build system tomorrow.

Thanks for the quick fix. Builds after commenting out termcap.h in src/msclStringFuncs.cpp

(Windows 7, msys2, gcc 6.3.0)

here is the output you asked for:

pinecone v0.4.0

unit tests:

unit:
. conditionals passed
. constants passed
. funcs passed
. loops passed
. operators passed
. order_of_ops passed
. strings passed
. vars passed

regression:
. multiple_left_inputs passed
. no_newline_at_end passed

integration:
X brainfuck failed


output:
enter your brainfuck code: Hello World!

instead of:
enter your brainfuck code: Hello World!


. morse passed
. queue passed

unfixed:
X backslash_in_block_comment failed
X bool_short_circuit failed
X cpp_bad_escape_seq failed
X cpp_global_and_local_same_name failed
X crash_on_error_in_import failed
X error_on_nonexistant_file failed
X function_with_one_named_arg failed
X if_as_ternary failed

tests done

short update everything in examples seems to work except snake (as I expected)

wmww commented

Cool. I'm sure Windows specific bugs will crop up now and then, but it should work for the most part.

You can use Visual Studio IDE to develop it.
By install it, Windows SDK will install and you can use Windows.h to get console size, And you can use #include on c++17 for a cross-platform path resolving.
Visual Studio also supports linux target upon SSH, I have connected it to my WSL environment to compile my linux apps.

bitmoji 2020: Still waitin

wmww commented

I'm not sure what you're waiting for. Last I remember it compiled and ran on Windows. Regardless, this project is unmaintained so don't expect any updates from me (or anyone else as far as I know).

@IbrahimTGD take a look at this. https://github.com/mmdmine/Winecone