njoy / NJOY2016

Nuclear data processing with legacy NJOY
https://www.njoy21.io/NJOY2016
Other
98 stars 86 forks source link

Windows Binary #14

Closed brentf777 closed 7 years ago

brentf777 commented 7 years ago

There needs to be a binary installation created for Windows by the developers. I have tried to compile NJOY2016 multiple times without success. The version of gcc recommended (6.2) is too new to be standard in Cygwin. Attempts to compile gcc-6.2.0 using gcc-5.4.0 in Cygwin have failed. Attempted compilation with Intel's compilers has also failed.

apmccartney commented 7 years ago

There needs to be a binary installation created for Windows by the developers.

Sorry boss. At the moment, there isn't any plan to begin distributing a binary installation of NJOY2016 for Windows (or any other operating system) via github.

I have tried to compile NJOY2016 multiple times without success.

Attempts to compile gcc-6.2.0 using gcc-5.4.0 in Cygwin have failed.

I'm confused. Did you actually encounter a problem during the compilation of NJOY2016 or did you have a problem building a recommended compiler?

The version of gcc recommended (6.2) is too new to be standard in Cygwin. Attempts to compile gcc-6.2.0 using gcc-5.4.0 in Cygwin have failed.

Building compilers is dirty business. As an alternative to building from scratch, I believe the 6.3.0 GNU compilers (including gfortran) are available as Cygwin packages.

However, if you're just after NJOY2016, you probably don't need to bother.

We test on and explicitly support the GNU Compiler Collection version 6.2. This revision choice was related to C++14 standard conformance for our C++ projects. That said, NJOY2016 isn't a C++ project; it's written exclusively in Fortran. You should only need a Fortran 2003 compliant compiler. I would be surprised if you have any issue building with Gfortran 5.4.0 (and strongly recommend it over the ifort Intel compiler).

If you encounter a problem during the build, feel free to reopen this issue.

Be warned, at the moment, there is an issue (#10) with the python script which runs the installation tests which can incorrectly indicate failure in the Windows environments.

brentf777 commented 7 years ago

I was able to get NJOY2016 built using Cygwin (eventually) and have included my compilation steps (more detailed than those previously provided) to hopefully avoid some pain for others. Still, with as many end-users as there are for MCNP and NJOY and not all being savvy programmers, the need to compile everything from source is a bit of a put off. It doesn't seem to be a major undertaking compared to putting together a new version of NJOY itself...

1) Download and compile gcc-6.2.0 to use it along side the default gcc version (whatever this may be - in my case 5.4.0). Several packages need to be installed to be able to make gcc including: wget, make, diffutils, libmpfr-devel, libgmp-devel, libmpc-devel (assuming gcc, g++ already installed).

$ wget http://mirrors.concertpass.com/gcc/releases/gcc-6.2.0/gcc-6.2.0.tar.gz $ tar xf gcc-6.2.0.tar.gz $ mkdir build-gcc-6.2.0 $ cd build-gcc-6.2.0 $ ../gcc-6.2.0/configure --program-suffix=-6.2.0 --enable-languages=c,c++ --disable-bootstrap --disable-shared $ make -j4 (I used 4 threads to make - can be varied depending on processor threads) $ make install

It will install to /usr/local by default. I specify to only enable c and c++ languages since gfortran does not build correctly. If you try to build everything (default), make will fail. This leaves the gfortran as the same version as the system default gcc, but that is ok in this case.

2) Make sure you have Python3.4. If not install it. On my Cygwin I had python 2.7 and 3.4, but my python symbolic link went to python2.7. I had to change the link to point to 3.4 instead before running cmake below.

3) Navigate in Cygwin to where NJOY2016 has been unzipped (the directory where the CMakeLists.txt file is). Create the bin directory if it does not exist and navigate there. We have to feed CC= and CXX= options to cmake to make sure it uses our new version of gcc and not the system default.

Important: If you have attempted any other failed instances of cmake prior to this, delete the extra configuration files created by the failed attempts before proceeding.

$ cd NJOY2016_directory (wherever you unzipped NJOY) $ mkdir bin $ cd bin $ CC=gcc-6.2.0 CXX=/usr/bin/g++-6.2.0 cmake ../ $ make -j4 (again because I'm using 4 threads) $ make test

In my case, I did not run into issue #10 you listed. My tests all passed successfully.

xzhiwen commented 7 years ago

For Windows compiling using Intel Fortran, please see

https://github.com/xzhiwen/NJOY2016/releases/tag/r01

You can also download the compiled executable there, which has been verified against test problems. It should work on any Windows machines.