a740122 / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

cygwin and mingw #193

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
cygwin is indeed more usable than mingw
cugwin requires an extra dll file
while mingw goes directly with a msvc runtime

with cygwin you can cross-compile to mingw
which is actually more usable than using mingw directly

I'm not an expert on it or anything
But I have played a bit with it :)

Original issue reported on code.google.com by bleukous...@gmail.com on 15 Jul 2013 at 1:05

GoogleCodeExporter commented 8 years ago
when can you start..? :-)

Original comment by mark.duf...@gmail.com on 15 Jul 2013 at 3:08

GoogleCodeExporter commented 8 years ago
i'll see what I can do
but I'm giving more priorty to other stuff right now

Original comment by bleukous...@gmail.com on 16 Jul 2013 at 4:07

GoogleCodeExporter commented 8 years ago
I'll try the cygwin only way
because it's the most usable setup

Original comment by bleukous...@gmail.com on 17 Jul 2013 at 10:07

GoogleCodeExporter commented 8 years ago
that sounds better yes. so I guess something like a 'hello, world' example 
would be nice to start with..?

Original comment by mark.duf...@gmail.com on 17 Jul 2013 at 7:23

GoogleCodeExporter commented 8 years ago
i'm still looking in the build environment part
it's possible to port python to cygwin
maybe not needed but i'll continue my research :)

Original comment by bleukous...@gmail.com on 18 Jul 2013 at 9:48

GoogleCodeExporter commented 8 years ago
I have some questions:

when building shedskin for windows which compiler do you use?

What do you use to compile your shedskin apps?

Some background info of which makes it hard to use mingw
(except from the fact that mingw changes version to much)

Original comment by bleukous...@gmail.com on 19 Jul 2013 at 1:17

GoogleCodeExporter commented 8 years ago
you can mail me, about things you want to keep personal :)

Original comment by bleukous...@gmail.com on 19 Jul 2013 at 1:19

GoogleCodeExporter commented 8 years ago
http://stackoverflow.com/questions/909092/why-is-the-compiler-package-discontinu
ed-in-python-3

I see you use this package

"To expand on this answer: the compiler package was an absolute pain to 
maintain and almost always either slightly out of date or subtly different from 
the "real" compiler. Making it easier to work with the real compiler via the 
ast module made maintenance a lot easier while still providing similar 
functionality."

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 10:03

GoogleCodeExporter commented 8 years ago
so instead of using compiler.ast (compiler module)
you should use ast module

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 10:07

GoogleCodeExporter commented 8 years ago
found in cpp.py

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 10:07

GoogleCodeExporter commented 8 years ago
it is true however for python 2.6 and up

python 2.5 has limited support via _ast

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 10:10

GoogleCodeExporter commented 8 years ago
i'm reviewing the code further :)

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 10:32

GoogleCodeExporter commented 8 years ago
Succesfully compiled hello world example :)

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 6:24

Attachments:

GoogleCodeExporter commented 8 years ago
it's only the begin though, but it is something :)

Original comment by bleukous...@gmail.com on 22 Jul 2013 at 6:26

GoogleCodeExporter commented 8 years ago
sorry for not being very responsive atm. but it's great you got this far! did 
you also manage to compile/use the garbage collector..?

I guess the more interesting question is, using cygwin can we get rid of all or 
most of the '#ifdef WIN32' crap that we now have to maintain..? for example, 
time.time() calls 'gettimeofday' but this is not supported under windows/mingw, 
so we have to roll our own.

Original comment by mark.duf...@gmail.com on 23 Jul 2013 at 6:25

GoogleCodeExporter commented 8 years ago
oh, I have no real interest in python 3, but I'm hoping the new ast module is 
backward compatible with the old one..?

Original comment by mark.duf...@gmail.com on 23 Jul 2013 at 6:26

GoogleCodeExporter commented 8 years ago
the ast module is probably mostly the same
I can't be sure yet but i can look into the changes
although it's not that important as I claimed in previous post
It should be a bit better though

for the new ast module you need at least python 2.6
that can be a drawback
It means you can't use python 2.5 and under anymore

I did compile a garbage collector called boehm with cygwin :)

1.)c++ needs to know what machine it's using when
the code only applies to one platform

2.)python works like an all-around for all platforms
for example:

os.sys works in linux and windows
while the code looks the same in python code,
python actually has different code for each platform
which isn't shown to the programmer

3.)not all python parts work on every platform
some are left out on purpose when there isn't an alternative for the function 
in that current platform.
even sometimes it is removed when the python chiefs decide it,
for reason they explain

to do something like that I do think you need ifdef
there could be a workaround though 

Original comment by bleukous...@gmail.com on 23 Jul 2013 at 8:24

GoogleCodeExporter commented 8 years ago
you can maybe split python in two with a windows and a linux version as a 
workaround
or more interesting,
You can program something :)
in example give every part a "tag"
like a number for more readable code
1:windows
2:linux
3:windows and linux
make a readable list of it :)

it's just an idea :p
I don't know it is possible

Original comment by bleukous...@gmail.com on 23 Jul 2013 at 8:38

GoogleCodeExporter commented 8 years ago
I have another question
How do you generate c++ files
I don't get it yet :p

is python generating bytecode when using ast?
or do you skip this step?

Also, how are you adding the cpp files in the lib directory to Python?

Original comment by bleukous...@gmail.com on 5 Aug 2013 at 10:42

GoogleCodeExporter commented 8 years ago
FYI it's still going to take awhile
But I'm still working on it :)

Original comment by bleukous...@gmail.com on 8 Aug 2013 at 3:56

GoogleCodeExporter commented 8 years ago
Hi bleukousuke,

I'll try to give you a quick answer to your questions.

* How do you generate c++ files?
This is really long to explain, but Shedskin is no different from any other 
compiler really. In general they way it goes is: You have some text that 
contains your code (remember, it's only text). In order to make sense out of 
that text, you will need something that completely defines the syntax of the 
language. For example, for Python you can find that here: 
http://docs.python.org/2/reference/expressions.html.
Shedskin is using a subset of that. Keep in mind that that link only shows you 
the syntax of the language, not the semantics of it.

After parsing the code (which is just text), you end up with something that you 
can work with and analyze. That something is the Abstract Syntax Tree 
(http://en.wikipedia.org/wiki/Abstract_syntax_tree), or ast.
And once you have that, you have something to work with and you can generate 
code in another language.
I would suggest you to read how a compiler works and you'll get the idea. 
(http://en.wikipedia.org/wiki/Compiler)

* Is python generating bytecode when using ast?
I'm not 100% what you mean here, but I'll give it a shot anyway. The only thing 
that you need in order to generate an ast is the language syntax definition, 
the code itself and a parser. In the case of Python, the final bytecode (which 
has nothing to do with Shedskin), is something that can only be produced after 
parsing the code and building an ast.

* Also, how are you adding the cpp files in the lib directory to Python?
Once again, I'm not sure what you mean (sorry about that). Shedskin does not 
use the standard library that is shipped with Python. Instead, it has its own 
implementation of part of the std library. This is written in C++. You can find 
that in the repository.

I hope this helps. There are a lot of minor "buts" in my answer and small 
details, but a more detailed answer would be too long and I don't know what is 
your background or how much do you know.

Regards,

Ernesto 

Original comment by ernestof...@gmail.com on 9 Aug 2013 at 5:00

GoogleCodeExporter commented 8 years ago
Thanks for the info :)

I'll read some more about it
with those questions I tried to get a better picture of the program
Sorry for making the questions too complicated :p

bytecode is actually not needed :p
with bytecode I meant *.pyc files
which are created when running python code
It's a binary version of your python file
(to keep it short, my explanation is probably to simple)
you can use this file instead of the python source code to run your code
you can only distribute it if you have the right python version installed

But I think I get the second and third question now
It probably done by pyhon
If you only used the ast module

I actually didn't learn for programming at school
I'm just an enthousiast :p
Some basic knowledge I can be missing
(I'm modest in that really)
but I already tried some more advanced stuff
I have experience with creating an installer with nsis
and I'm actually compiling programs without much c++ knowledge
or not that much like a typical programmer anyway
I've programmed some small python programs

Original comment by bleukous...@gmail.com on 11 Aug 2013 at 8:07

GoogleCodeExporter commented 8 years ago
I think it doesn't need much tweaking but it doesn't work atm
about my effort:

time.cpp:
localtime is in the wrong format
it needs to be the linux time without the milliseconds

memory access violation:
probably caused by the wrong type of an object
somewhere in your c++ code
for example(string String)
(it's only wrong for cygwin)

another possible problem is the use of win32 python instead on cygwin python
wich uses different line breaks (that's solvable too)

that's my current progress :)

I thought of making a preview build with my adjusted code
I don't know how to use git correctly :p

Original comment by bleukous...@gmail.com on 9 Sep 2013 at 11:19

GoogleCodeExporter commented 8 years ago
thanks!! :D you could send me a tarball as well.. I'd be very interested to 
check out your current setup.

Original comment by mark.duf...@gmail.com on 14 Sep 2013 at 3:41

GoogleCodeExporter commented 8 years ago
ok a source tarball will come
the code is not changed
my build environment is just set up
so it will take a while
Should I make a build without modifications?

Original comment by bleukous...@gmail.com on 16 Sep 2013 at 6:17

GoogleCodeExporter commented 8 years ago
nvm. I think I should. 
So other people can test it and work on it :)
(i'll work on changes to the code to :) )

Original comment by bleukous...@gmail.com on 16 Sep 2013 at 6:23

GoogleCodeExporter commented 8 years ago
I'm not used to do bugfixes
but making a build is no problem for me
that's why I'll first make a build :)

Original comment by bleukous...@gmail.com on 18 Sep 2013 at 11:38

GoogleCodeExporter commented 8 years ago
The plan now is to automate the building process of shedskin with minimum 
output from the user
the build will be portable but an internet connection is required for 
downloading cygwin programs and dependencies
All with just batch and shell scripts :)

It's currently half-way :)

Original comment by bleukous...@gmail.com on 11 Oct 2013 at 1:21

GoogleCodeExporter commented 8 years ago
Just to confirm
I'm still working on it
:)

Original comment by bleukous...@gmail.com on 9 Dec 2013 at 8:59

GoogleCodeExporter commented 8 years ago
almost done
here is a preview that compiles test.py:

how to install: check shedinstall.txt

although test.py compiles
many examples do not (not yet :) )

shedskin cygwin:
https://www.mediafire.com/?4397n1cnw471irt

shedskin only source:
https://www.mediafire.com/?2weca81qtzietdb

installation instructions:
https://www.mediafire.com/?2weca81qtzietdb

feel free to comment :)

Original comment by bleukous...@gmail.com on 17 Dec 2013 at 12:19

GoogleCodeExporter commented 8 years ago
when installing cygwin just click next

Original comment by bleukous...@gmail.com on 17 Dec 2013 at 12:30

GoogleCodeExporter commented 8 years ago
http://kousuke-myblog.blogspot.com
my site is also open for comments on this release

Original comment by bleukous...@gmail.com on 18 Dec 2013 at 12:13

GoogleCodeExporter commented 8 years ago
thanks a lot for your effort and perseverence! please let me know which name to 
add to the 'contributors section' of the shedskin homepage.

I'm going through the installation steps and will have a look at your work 
today, and let you know how this went.. first let's dig up a windows 
installation somewhere..

Original comment by mark.duf...@gmail.com on 18 Dec 2013 at 1:29

GoogleCodeExporter commented 8 years ago
it works, great! :-) at first I tried in a directory with a space inside its 
name ("Documents and Settings") and it didn't work (replace cd %CD% and such 
with cd "%CD%" to make this work). after getting it to work, I tried just a few 
things, but it looks good so far. great to see!

did you have to make any changes to the shedskin source code we might 
incorporate into git..? 

Original comment by mark.duf...@gmail.com on 18 Dec 2013 at 4:12

GoogleCodeExporter commented 8 years ago
Thanks :)

I did some small changes
only added macro's for cygwin
but there are some important changes to the c++ source needed
and don't know yet how to do it :p

I will first get the command line working
then I will check how to program c++ again :p
It has been awhile

Original comment by bleukous...@gmail.com on 18 Dec 2013 at 8:22

GoogleCodeExporter commented 8 years ago
Here are the changed files
I commented te places where I added lines

Original comment by bleukous...@gmail.com on 19 Dec 2013 at 8:03

Attachments:

GoogleCodeExporter commented 8 years ago
Add me by my nickname:
Kousuke

Original comment by bleukous...@gmail.com on 19 Dec 2013 at 8:09

GoogleCodeExporter commented 8 years ago
First shedskin windows build:
shedskin-kon1
https://www.mediafire.com/?3o7fxoulrnf50nq

Original comment by bleukous...@gmail.com on 6 Jan 2014 at 4:15

GoogleCodeExporter commented 8 years ago
I apperrently I have to fix something about it :p
A rerelease is coming :)

Original comment by bleukous...@gmail.com on 6 Jan 2014 at 10:13

GoogleCodeExporter commented 8 years ago
status update:
still working on it :)
It's going to take awhile before I do a rerelease
Since I found Some nasty bugs :p

Original comment by bleukous...@gmail.com on 6 Mar 2014 at 8:54

GoogleCodeExporter commented 8 years ago
New release:

The command line is fixed
cleans up temp files
cleans up files for recompiling
http://www.mediafire.com/download/6fhc64y8zolr8vo/shedskin-kon-1.1.7z

Original comment by bleukous...@gmail.com on 2 Apr 2014 at 4:23

GoogleCodeExporter commented 8 years ago
the next thing is extending the os module
this way the unit test can be run for checking the support

Original comment by bleukous...@gmail.com on 2 Apr 2014 at 5:56

GoogleCodeExporter commented 8 years ago
I also learn git so i can send patches :)
btw can the release be added to google code ?

Original comment by bleukous...@gmail.com on 3 Apr 2014 at 7:10

GoogleCodeExporter commented 8 years ago
sorry for being a bit slow to react. this time I just became father for the 
second time.. :S :D

okay, I just tried your release and was able to compile and run test.py. good 
work!

do you think it would be possible to pre-install cygwin and shedskin in the 
downloaded package? ideally of course you just install it, run a single batch 
file or put 'shedskin.bat' in your path and it works. 

not sure I like the extra 'project' argument added..

please do send in (git) patches needed to improve the situation for you/cygwin. 

so I think things are still a bit too experimental to offer as a download on 
the homepage. I'd also like to see what happens when we try to support all the 
currently supported builtins.. because my hope for using Cygwin was that we 
could get rid of much of the #ifdef WIN32 crap.. 

Original comment by mark.duf...@gmail.com on 18 Apr 2014 at 12:06

GoogleCodeExporter commented 8 years ago
congrats :)

Not sure how you like to install it
I can make an installer though
But I can't install in program files
since the dependency checker for cygwin doesn't work with spaces
maybe I can do something about it but it was complicated to make it work 
already :p
A problem archiving the installed version is it's 200-300 meg large

My idea with the project argument was to avoid that you constantly have to fill 
in long paths in the commandline
I can think of other ways to do it though :)

I'll take I look at git :)
but I'm going to wait with patches until I do more research

I think I found a way to make the Ifdef dissapear
It may be possible by extending cygwin and cygwin python with the missing c++ 
and python files
I'll make it a priority :)

Original comment by bleukous...@gmail.com on 23 Apr 2014 at 7:16

GoogleCodeExporter commented 8 years ago
i'll do the project argument away later
first I'm going to review the ifdef macro's

Original comment by bleukous...@gmail.com on 24 Apr 2014 at 7:32

GoogleCodeExporter commented 8 years ago
for clarifacation

To avoid using ifdefs for cygwin I can use other packages to replace the 
missing files
(with gnulib this is possible) http://www.gnu.org/software/gnulib/

I have already seen how I can make an OS.py for cygwin python (not that I can 
do it already :p )

this doesn't change shedskin so I'm not sending git patches

I will remove the project argument
and you will use a relative path for choosing your python file

then I'm planning to fix bugs in shedskin for cygwin (i can do linux too :) )

But since this is a working on it/not working on it project
(I like to take long pauses)

this all takes much time to do on my own :p

If you have comments on this approach feel free to ask :)

Original comment by bleukous...@gmail.com on 5 May 2014 at 7:49

GoogleCodeExporter commented 8 years ago
I'm currently checking on using autotools to create c++ makefiles for shedskin
Which will take much work and time probably :p
I mean I'm checking if it is possible and not too hard to use

This is needed for gnulib, because gnulib works best with autotools makefiles

Original comment by bleukous...@gmail.com on 29 May 2014 at 11:39

GoogleCodeExporter commented 8 years ago
I'm going resume work soon :)

greets kousuke

Original comment by bleukous...@gmail.com on 21 Aug 2014 at 10:51

GoogleCodeExporter commented 8 years ago
the problem is I know what can be done
but at the moment I can't do it yet with my lack of experience in programming
I'm hoping though to work with you on this project in the future :)

Original comment by bleukous...@gmail.com on 11 Sep 2014 at 9:59