szaghi / FoBiS

FoBiS.py, Fortran projects Building System for poor people
138 stars 35 forks source link

MS Windows support #94

Open jacobwilliams opened 7 years ago

jacobwilliams commented 7 years ago

FoBiS doesn't currently work on Windows. It seems to fail pretty early with:

Traceback (most recent call last):
  File "C:\Anaconda3\Scripts\FoBiS.py", line 21, in <module>
    main()
  File "C:\Anaconda3\lib\site-packages\fobis\fobis.py", line 45, in main
    run_fobis()
  File "C:\Anaconda3\lib\site-packages\fobis\fobis.py", line 58, in run_fobis
    configuration = FoBiSConfig(fake_args=fake_args)
  File "C:\Anaconda3\lib\site-packages\fobis\FoBiSConfig.py", line 58, in __init__
    self.fobos = Fobos(cliargs=self.cliargs, print_n=self.print_b, print_w=self.print_r)
  File "C:\Anaconda3\lib\site-packages\fobis\Fobos.py", line 60, in __init__
    if cliargs.fobos:
AttributeError: 'Namespace' object has no attribute 'fobos'

Probably there are other issues as well. I can try to take a crack at this if you want. It would be great if it also worked on Windows (for poor Fortran Windows users).

szaghi commented 7 years ago

@jacobwilliams

Dear Jacob,

FoBiS doesn't currently work on Windows.

I was afraid about this... MS Windows is out of my scope.

It seems to fail pretty early with:

This sounds good, at least. Are you using Python 2 or 3? Python 3 is still in an early phase of support, namely I have not yet studied in details how correctly support also Python 3.

Probably there are other issues as well. I can try to take a crack at this if you want. It would be great if it also worked on Windows (for poor Fortran Windows users).

I would like to support all poor people, no matter the OS, but I am afraid I am not up to the task. If you can test it on MS Windows I can try to fix, but alone I will fail: my MS Windows "facility" lacks of a compiler still :smile:

I cannot say when, but I can try to install GNU gcc on my virtualized MS Windows (yes, I had to use it due to my colleagues who seem to cannot live without MS Office...).

I'll dig it deeper soon (I hope).

Thank you very much for reporting this, it is really appreciated.

Cheers

jacobwilliams commented 7 years ago

I am happy to help (but won't have time for a couple of weeks).

szaghi commented 7 years ago

@jacobwilliams

Do not worry, you are the only MS user I am aware of :smile:

f-baerenbold commented 7 years ago

Any updates? Same error here (Win7, Anaconda w python 3.6)

zimmermm commented 7 years ago

The issue could well be related to python 3. The verison I that has been merged with pull request #93 (https://github.com/zimmermm/FoBiS) works well for me under windows and with python 2.7.

zimmermm commented 7 years ago

Ok, found the issue! Argparse behaves differently in python 3 than in python 2.7 (see https://stackoverflow.com/questions/22990977/why-does-this-argparse-code-behave-differently-between-python-2-and-3). The good news, there is a simple fix for it. I'll try to fix&pull request tomorrow..

zimmermm commented 7 years ago

It seems I was a little hasty. I can't reproduce the behaviour you describe (I don't use Anaconda though).

I only had some issues with the ANSI escape sequences which I resolved in the following fork: based on FoBiS 2.2.6, https://github.com/zimmermm/FoBiS

I'll try to track down the above behaviour with @Diftin who is also using anaconda..

zimmermm commented 7 years ago

Ooh, I can reproduce the above behaviour if I don't name the specific 'subparser'.

@jacobwilliams & @Diftin: The correct command to build a project is: FoBiS.py build Tell me if this solves the problem for you.

f-baerenbold commented 7 years ago

No, still same error message.

zimmermm commented 7 years ago

I also tested FoBiS.py (my forked version) with Anaconda 4.4.0, Win7, via Windows CMD or GitBash and it works perfectly. The issue must be specific to your installation/windows machine.

szaghi commented 7 years ago

Dear @Diftin @zimmermm @jacobwilliams ,

I am very sorry for my delay, but August has been my summer holidays, I'll come back in office next Monday. Anyhow, I cannot help with MS Windows. If your forks work well, I'll be happy to merge them into the mainstream repo.

Cheers.

f-baerenbold commented 7 years ago

I uninstalled Anaconda and downloaded Python 3.62 from python.org and now it works fine with the forked version!

f-baerenbold commented 7 years ago

Also works with Anaconda for me now.

szaghi commented 7 years ago

@Diftin @zimmermm

Hi all,

I am came back. Can you make aware of your recent progresses? Recently I have disabled colors in some FoBiS "modes" because it causes some issues, maybe it was related to your issues.

Can I merge your forks?

Cheers

zimmermm commented 7 years ago

Hi Stefano Welcome back! Short summary is: your current version (2.2.6) works perfectly on windows when colors are disabled.

I couldn't reproduce the initial issue that @Diftin and @jacobwilliams reported. For @Diftin the issue was resolved 1) after uninstalling Anaconda and installing Python 3.62 from python.org and 2) also after reinstalling Anaconda; both times using the current FoBiS version on github and disabling the colors. (I am not sure if the GitHub version is the same as you find on pip?)

The colors infact cause some issues! I first thought it is only on windows cmd because it cannot handle the \033[ escape sequences. That's why I import and enable 'colorama' in my forked version when the script runs on a windows platform. However, I now realized that the colors also cause some issues on linux. I therefore completely disabled the colors when I work with FoBiS (but this is not yet online).

Maybe you can close my pull request and just disable the colors for the moment? And also update the version on pip.

Cheers

jacobwilliams commented 6 years ago

The current version works for me on Windows with intel but I have to make one change. In Compiler.py, change:

   self.modsw = '-module '

to

   self.modsw = '/module:'

Since the Windows syntax for this different from the Linux one.

Also I get various warnings like:

ifort: command line warning #10161: unrecognized source type 'bin\obj\json_value_module.o'; object file assumed

I think because on Windows, it wants the extension to be .obj.

szaghi commented 6 years ago

Hi Jacob,

as you know I have not access to a Windows PC, thus it is difficult for me to support MS Windows feature, but later today I'll try to integrate your patch.

szaghi commented 4 years ago

@zimmermm @jacobwilliams @Diftin @zbeekman

Can I close this issue?

Cheers

jacobwilliams commented 3 years ago

It would be nice to have Windows support. :)

The first issue is easily fixed I think like this:

    if platform.system()=='Windows':
      self.modsw = '/module:'
    else:
      self.modsw = '-module '

but the .o assumption is made in many parts of the code. It would need to be compiler/platform specific, then we could set .obj for Windows+Intel.