BhallaLab / moose

MOOSE simulator.
http://moose.ncbs.res.in
GNU General Public License v3.0
26 stars 19 forks source link

Windows support #176

Open subhacom opened 9 years ago

subhacom commented 9 years ago

In an earlier revision setup.py allowed building moose on cygwin. This is not up to date and creates confusion with cmake build. In stead of keeping separate build system for windows, it is desirable to update the existing build system to accommodate the same.

There are several possible approaches:

  1. Use cygwin : this may be simplest as cygwin provides an almost complete linux-like system.
  2. Use mingw/msys: moose can be made a single package with easential requirements from mingw. Git for windows takes this approach. However this may make things redundant for systems with existing python stack.
  3. Anaconda: this is a popular free python stack for scientific computing. By providing a package for conda, moose can smoothly fit into an existing installation.
dilawar commented 9 years ago

Compiles with cygwin on Windows-7

Requirements

Above packages are available in cygwin. We need matplotlib which may or may not be available in cygwin.

$ easy_install matplotlib

In addtion, one can manually install sbml.

It is possible to create a cygwin package using cmake. I need to test this first. I'll check how to make packages for conda.

dilawar commented 9 years ago

NSDFWriter does not compile with cygwin gcc. Here is a part of the error produced by the gcc.

[ 50%] Building CXX object builtins/CMakeFiles/moose_builtins.dir/NSDFWriter.cpp.o
/home/virtualuser/Work/moose/moose-core/builtins/NSDFWriter.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
 // NSDFWriter.cpp ---
 ^
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/x86intrin.h:29:0,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/x86_64-pc-cygwin/bits/opt_random.h:33,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/random:50,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/stl_algo.h:66,
                 from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/algorithm:62,
                 from /home/virtualuser/Work/moose/moose-core/basecode/../external/debug/print_function.hpp:108,
                 from /home/virtualuser/Work/moose/moose-core/basecode/header.h:14,
                 from /home/virtualuser/Work/moose/moose-core/builtins/NSDFWriter.cpp:55:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘__m64 _mm_cvtsi32_si64(int)’:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h:64:54: error: can’t convert between vector values of different size
   return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                      ^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘int _mm_cvtsi64_si32(__m64)’:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h:107:53: error: cannot convert ‘__m64 {aka int}’ to ‘__vector(2) int’ for argument ‘1’ to ‘int __builtin_ia32_vec_ext_v2si(__vector(2) int, int)’
   return __builtin_ia32_vec_ext_v2si ((__v2si)__i, 0);
                                                     ^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘__m64 _mm_packs_pi16(__m64, __m64)’:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h:146:69: error: cannot convert ‘__v4hi {aka short int}’ to ‘__vector(4) short int’ for argument ‘1’ to ‘__vector(8) char __builtin_ia32_packsswb(__vector(4) short int, __vector(4) short int)’
   return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2);
                                                                     ^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘__m64 _mm_packs_pi32(__m64, __m64)’:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h:161:69: error: cannot convert ‘__m64 {aka int}’ to ‘__vector(2) int’ for argument ‘1’ to ‘__vector(4) short int __builtin_ia32_packssdw(__vector(2) int, __vector(2) int)’
   return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2);
                                                                     ^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘__m64 _mm_packs_pu16(__m64, __m64)’:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h:176:69: error: cannot convert ‘__v4hi {aka short int}’ to ‘__vector(4) short int’ for argument ‘1’ to ‘__vector(8) char __builtin_ia32_packuswb(__vector(4) short int, __vector(4) short int)’
   return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2);
                                                                     ^
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/mmintrin.h: In function ‘__m64 _mm_unpackhi_pi8(__m64, __
dilawar commented 9 years ago

Fails with clang as well:

[ 50%] Building CXX object builtins/CMakeFiles/moose_builtins.dir/NSDFWriter.cpp.o
In file included from /home/virtualuser/Work/moose/moose-core/builtins/NSDFWriter.cpp:55:
In file included from /home/virtualuser/Work/moose/moose-core/basecode/header.h:14:
In file included from /home/virtualuser/Work/moose/moose-core/basecode/../external/debug/print_function.hpp:108:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/algorithm:62:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/stl_algo.h:66:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/random:50:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/x86_64-pc-cygwin/bits/opt_random.h:33:
In file included from /usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/x86intrin.h:29:
In file included from /usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/immintrin.h:28:
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:52:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si'
      (aka 'int')
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
                                       ^~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:70:43: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                                          ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:76:43: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si'
      (aka 'int')
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                                          ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:82:43: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                                          ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:88:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:94:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:100:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si'
      (aka 'int')
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:106:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:112:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:118:44: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si'
      (aka 'int')
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                                           ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:124:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                                       ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:130:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                                       ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:136:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(2 * sizeof(int)))) int' (vector of 2 'int' values) with an rvalue of type '__v2si'
      (aka 'int')
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                                       ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:142:41: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
                                        ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:148:41: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
                                        ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:154:42: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
                                         ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:160:42: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
                                         ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:166:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(8 * sizeof(char)))) char' (vector of 8 'char' values) with an rvalue of type
      '__v8qi' (aka 'char')
    return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
                                       ^~~~~~~~~~~~
/usr/bin/../lib/clang/x86_64-pc-cygwin/3.5.2/include/mmintrin.h:172:40: error: cannot initialize a parameter of type
      '__attribute__((__vector_size__(4 * sizeof(short)))) short' (vector of 4 'short' values) with an rvalue of type
      '__v4hi' (aka 'short')
    return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
                                       ^~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
builtins/CMakeFiles/moose_builtins.dir/build.make:399: recipe for target 'builtins/CMakeFiles/moose_builtins.dir/NSDFWriter.cpp.o' failed
make[2]: *** [builtins/CMakeFiles/moose_builtins.dir/NSDFWriter.cpp.o] Error 1
CMakeFiles/Makefile2:519: recipe for target 'builtins/CMakeFiles/moose_builtins.dir/all' failed
make[1]: *** [builtins/CMakeFiles/moose_builtins.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
virtualuser@virtualuser-PC:~/Work/moose/moose-core/_build$
subhacom commented 9 years ago

It works for cygwin (64 bit) 2.871 with gcc 4.9.3 on Windows 7 after the newer files were added to moose-core/setup.py. So the problem is possibly with some flags or includes in cmake build. Also, apart from the build, there were some minor issues of bad imports and requirements which caused problem with setup.py install.

souravsingh commented 7 years ago

Creating a package for conda is not difficult. Only problem is to figure out the way to create the conda recipe for the project.

dilawar commented 7 years ago

Under bash (on Windows), moose launches fine. May be this is the way to go for Windows. Other options are conda, and docker based solution.

dilawar commented 6 years ago

Since Windows 10 supports bash; user can now install ubuntu packages in windows (at least for python scripting). Maintaining/creating cygwin package is not worth the effort anymore.

Other solution is to create a python wheel which can be installed by pip. Initial attempt to create wheel were not successful because of gsl/hdf dependencies.

dilawar commented 6 years ago

Wheels have been created for linux and OSX. Will give a try for windows as well.

dilawar commented 6 years ago

Since windows has started supporting bash and docker, we don't plan any windows specific build. I can try wheel build on windows.