njoy / NJOY2016

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

Make not working on Cygwin #285

Closed suhailak closed 1 year ago

suhailak commented 1 year ago

I am trying to install NJOY2016.69 on windows machine under Cygwin environment. I am able to build the files successfully. However, the make command is giving problem. Following is the output on the screen for ready reference:

-bash-4.4$ cmake -D CMAKE_BUILD_TYPE=Release ../ -- Building for: NMake Makefiles -- Found Python3: C:/Program Files/Python310/python.exe (found suitable version "3.10.10", minimum required is "3.5") found components: Interpreter -- The Fortran compiler identification is GNU 10.3.0 -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Check for working Fortran compiler: C:/gcc/bin/gfortran.exe - skipped CMake Warning (dev) at CMakeLists.txt:104 (list): Policy CMP0121 is not set: The list() command now validates parsing of index arguments. Run "cmake --help-policy CMP0121" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Invalid list index "CMAKE_INSTALL_RPATH". This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.2.windows.1") fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git


-- -- njoy -- Git current branch: -- Git commit hash:


-- Configuring done -- Generating done -- Build files have been written to: D:/NJOY2016/build -bash-4.4$ make -j8 makefile:32: missing separator. Stop. -bash-4.4$ make -j makefile:32: missing separator. Stop. -bash-4.4$ make makefile:32: missing separator. Stop. -bash-4.4$ make install makefile:32: missing separator. Stop. -bash-4.4$ make test makefile:32: missing separator. Stop. -bash-4.4$ make makefile:32: missing separator. Stop.

Kindly help. Thanks

whaeck commented 1 year ago

We currently do not support Cygwin on Windows and actually suggest using WSL (Windows Subsystem for Linux) instead. That being said, I know people have used Cygwin in the past so it should actually work.

The error you are getting here might indicate an issue with your local NJOY2016 repository (each repository has a .git folder inside it and it has to be present for git to work properly). The permissions on the .git folder may also cause this error (tampering with the .git folder or its permission can cause this error as well). You are definitely pointing to the CMakeLists.txt file so you are inside the repository folder.

Do basic git commands like "git status" and "git pull" work properly when you are inside the repository folder? If not, you should verify the presence of the .git folder, its permissions, or try cloning the repository again.

suhailak commented 1 year ago

Thanks for your reply. The git related error was resolved after cloning the repository again as can be seen in the screen output below: git clone https://github.com/njoy/NJOY2016.git Cloning into 'NJOY2016'... remote: Enumerating objects: 5739, done. remote: Counting objects: 100% (404/404), done. remote: Compressing objects: 100% (201/201), done. remote: Total 5739 (delta 228), reused 361 (delta 201), pack-reused 5335 Receiving objects: 100% (5739/5739), 417.92 MiB | 1.84 MiB/s, done. Resolving deltas: 100% (3706/3706), done. Updating files: 100% (517/517), done. -bash-4.4$ cd NJOY2016 -bash-4.4$ cd build -bash-4.4$ cmake -D CMAKE_BUILD_TYPE=Release .. -- Building for: NMake Makefiles -- Found Python3: C:/Program Files/Python310/python.exe (found suitable version "3.10.10", minimum required is "3.5") found components: Interpreter -- The Fortran compiler identification is GNU 10.3.0 -- Detecting Fortran compiler ABI info -- Detecting Fortran compiler ABI info - done -- Check for working Fortran compiler: C:/gcc/bin/gfortran.exe - skipped CMake Warning (dev) at CMakeLists.txt:104 (list): Policy CMP0121 is not set: The list() command now validates parsing of index arguments. Run "cmake --help-policy CMP0121" for policy details. Use the cmake_policy command to set the policy and suppress this warning. Invalid list index "CMAKE_INSTALL_RPATH". This warning is for project developers. Use -Wno-dev to suppress it.

-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.39.2.windows.1")


-- -- njoy -- Git current branch: master -- Git commit hash: a3a2d7fa2f9f3aa3a543467084e080fa4bc5b587


-- Configuring done -- Generating done -- Build files have been written to: D:/NJOY2016/build -bash-4.4$ make makefile:32: missing separator. Stop. -bash-4.4$ make -j8 makefile:32: missing separator. Stop.

But make error still persists.

sudheerkmuhammed commented 1 year ago

missing separator error comes because

tab character is needed to start any recipe in make

every rule should prefixed by tab character

pls check

sudheerkmuhammed commented 1 year ago

somebody compiled it correctly with some workarounds in CYGWin i am posting his way -- may be helpful


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...

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.

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.

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 https://github.com/njoy/NJOY2016/issues/10 you listed. My tests all passed successfully.

suhailak commented 1 year ago

lkj

suhailak commented 1 year ago

This issue has been resolved. The issue was apparently due to unclean installation of Cygwin64 on Windows 10 machine. The path of cygwin installation was not working through the bash command line window as the environment variables were not set. This was pointed out by sudheerkmuhammed during his personal visit. The Cygwin installation paths usr/local/bin and usr/bin were added to .bashsrc and bash_profile files using export command as follows: export PATH=$PATH:/usr/local/bin export PATH=$PATH:/usr/bin After setting the environment variables, njoy exe file was successfully built. The NJOY version, however, is seen as 2016.21 and not 2016.65 n the output file. Is update still needed? I have cloned the latest repository i believe.