Coder Social home page Coder Social logo

Building problem on Linux about njoy21 HOT 15 CLOSED

njoy avatar njoy commented on July 29, 2024
Building problem on Linux

from njoy21.

Comments (15)

jlconlin avatar jlconlin commented on July 29, 2024

@ATM-Jahid Can you tell me what versions of git, python, and cmake you are using?

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

I am using the following versions.
git version 2.22.0
python version 3.7.3
cmake version 3.14.5

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024

Hello @ATM-Jahid

NJOY21 expresses its dependencies through git submodules. When the submodule initialization fails, git has the nasty habit of deleting the directory corresponding to the submodule from the parent repository. I suspect that when you quit while running fetch_dependencies.py that is what happened. In this case, NJOY is a dependency of the njoy_c_bindings library. You can confirm by running the following command:

cd dependencies/njoy_c_bindings
git status

which should show the dependencies/njoy folder has been deleted.

Assuming you haven't made any changes you need to keep around, the most straight forward resolution (imo) is just to reset the repository and rerun the command. From the highest level directory of your NJOY21 clone, run

git submodule deinit --force --all
git clean -df

or alternately, you could reclone the repository.

You're note the first person this behavior has caused issues for and I hope it didn't cause you to lose too much time. In the near future, the configuration will be done differently and this sort of problem will not be possible.

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

I followed your procedure. Now, it worked. But, I am very much at dark about the cause of this issue.

Anyway, when I ran make, I got the following warning messages. Please, let me know if they can be ignored.

/home/atomsky/Programs/NJOY21/subprojects/njoy/src/broadr.f90:1405:11:

 1405 |      em.gt.sigfig(es(is-1),ndig,-1)) go to 150
      |           1
Warning: Impure function ‘sigfig’ at (1) might not be evaluated [-Wfunction-elimination] 

/home/atomsky/Programs/NJOY21/subprojects/njoy/src/reconr.f90:2345:11:

 2345 |      xm.lt.sigfig(x(i-1),ndig,-1)) go to 135
      |           1
Warning: Impure function ‘sigfig’ at (1) might not be evaluated [-Wfunction-elimination]
/home/atomsky/Programs/NJOY21/subprojects/njoy/src/reconr.f90:2350:11:

 2350 |      xm.lt.sigfig(x(i-1),7,-1)) then
      |           1
Warning: Impure function ‘sigfig’ at (1) might not be evaluated [-Wfunction-elimination]

/usr/bin/ld: CMakeFiles/njoy21.dir/src/main.cpp.o: in function `njoy::njoy21::Driver::Factory::setupManager(njoy::njoy21::CommandLine&)':
main.cpp:(.text._ZN4njoy6njoy216Driver7Factory12setupManagerERNS0_11CommandLineE[_ZN4njoy6njoy216Driver7Factory12setupManagerERNS0_11CommandLineE]+0x80f): warning: the use of `tmpnam' is dangerous, better use `mkstemp'

Also, make test was successful, if that helps.

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024
/usr/bin/ld: CMakeFiles/njoy21.dir/src/main.cpp.o: in function njoy::njoy21::Driver::Factory::setupManager(njoy::njoy21::CommandLine&)': main.cpp:(.text._ZN4njoy6njoy216Driver7Factory12setupManagerERNS0_11CommandLineE[_ZN4njoy6njoy216Driver7Factory12setupManagerERNS0_11CommandLineE]+0x80f): warning: the use of tmpnam' is dangerous, better use `mkstemp'

This warning is expected.

I've not encountered the function elimination warning, but knowing the use of the function in question, sigfig, given the tests passed, I am confident the code is working as expected.

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

:(
I don't see any program after installation. Am I doing something wrong?
There is no command like njoy, njoy21 in my shell. Simple things, such as njoy21 --version, njoy21 --signature also does not work.

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024

It appears that NJOY21 was not installed to a directory in your PATH.

To clarify, you have run make install, correct? If not, that is the next step for you to do.

Otherwise, in your highest-level build tree directory, there is a file called CMakeCache.txt. This file contains information about (among many things) the destination for installation. Please attach that file to the next comment.

I gather from the paths in your earlier comments, you're on a Linux computer, so in which case, please include the output of the following:

echo $PATH

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

No, I did not run make install at first. I only followed what's written on http://www.njoy21.io/Build/index.html.
After you posted the above comment, I ran make install in the bin directory of NJOY21. I get the following error.

CMake Error at CMakeLists.txt:255 (add_subdirectory):
  The source directory

    /home/atomsky/Programs/NJOY21/subprojects/njoy

  does not contain a CMakeLists.txt file.


CMake Error at subprojects/njoy_c_bindings/CMakeLists.txt:126 (add_subdirectory):
  add_subdirectory not given a binary directory but the given source
  directory "/home/atomsky/Programs/NJOY21/subprojects/njoy" is not a
  subdirectory of
  "/home/atomsky/Programs/NJOY21/subprojects/njoy_c_bindings".  When
  specifying an out-of-tree source a binary directory must be explicitly
  specified.


Configuring incomplete, errors occurred!
See also "/home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeOutput.log".
make: *** [Makefile:377: cmake_check_build_system] Error 1

Output of echo $PATH:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

CMakeCache.txt

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

I re-did the entire process again. This time, after I ran make install, the following error appears.

~/Programs/NJOY21/bin  ‹master*› $ make install
[ 57%] Built target njoy
[ 61%] Built target njoy_c_bindings
[ 82%] Built target utility
[ 85%] Built target njoy21
[ 88%] Built target njoy21_executable
[ 91%] Built target njoy21.CommandLine.test
[ 94%] Built target njoy21.Driver.test
[ 97%] Built target njoy21.io.Manager.test
[100%] Built target njoy21.legacy.Sequence.test
Install the project...
-- Install configuration: "release"
-- Installing: /usr/local/lib/libnjoy21.so
CMake Error at cmake_install.cmake:47 (file):
  file INSTALL cannot copy file
  "/home/atomsky/Programs/NJOY21/bin/libnjoy21.so" to
  "/usr/local/lib/libnjoy21.so".


make: *** [Makefile:86: install] Error 1

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024

You very likely to not have write permissions for the /usr/local directory with your user account.

We can do one of two things:

  • install as the system administrator
  • install to another location and add that location to your PATH

If you're working on your own personal computer, the former is probably fine. On many Linux distributions, you can install as an administrator using

sudo make install

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

I hope I'm not being burdensome. :(
I've rerun the make, make test and make install commands using root privilege. (that is, using sudo)
The installation seems fine. But, if I try to use any command using njoy21, the following error appears.

njoy21: error while loading shared libraries: libnjoy21.so: cannot open shared object file: No such file or directory

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024

In the output of make install it should have some output regarding where libnjoy21.so was installed. Could you post the output of that command?

What do you see when you run

ls /usr/local/lib/*njoy*

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

The output for ls /usr/local/lib/*njoy* is
/usr/local/lib/libnjoy21.so /usr/local/lib/libnjoy.so

from njoy21.

ATM-Jahid avatar ATM-Jahid commented on July 29, 2024

I think I broke my system! I was trying to remove the package and reinstall it.
First, pacman couldn't find this njoy21 package. So, I manually removed it from usr/local/bin/.
Then, I tried to redo the process. However, another problem arose. I ran cmake -D fetched_subprojects=true -D CMAKE_BUILD_TYPE=release ../. The shell returned the following error.

-- Found Git: /usr/bin/git (found suitable version "2.22.0", minimum required is "2.1") 
-- Found PythonInterp: /usr/bin/python (found version "3.7.3") 
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- broken
CMake Error at /usr/share/cmake-3.14/Modules/CMakeTestCXXCompiler.cmake:53 (message):
  The C++ compiler

    "/usr/bin/c++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make cmTC_879ef/fast 
    /usr/bin/make -f CMakeFiles/cmTC_879ef.dir/build.make CMakeFiles/cmTC_879ef.dir/build
    make[1]: Entering directory '/home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_879ef.dir/testCXXCompiler.cxx.o
    /usr/bin/c++     -o CMakeFiles/cmTC_879ef.dir/testCXXCompiler.cxx.o -c /home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    cc1plus: fatal error: /usr/local/include/stdc-predef.h: Permission denied
    compilation terminated.
    make[1]: *** [CMakeFiles/cmTC_879ef.dir/build.make:66: CMakeFiles/cmTC_879ef.dir/testCXXCompiler.cxx.o] Error 1
    make[1]: Leaving directory '/home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_879ef/fast] Error 2
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:48 (project)


-- Configuring incomplete, errors occurred!
See also "/home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeOutput.log".
See also "/home/atomsky/Programs/NJOY21/bin/CMakeFiles/CMakeError.log".

from njoy21.

apmccartney avatar apmccartney commented on July 29, 2024

Oof

Okay, so pacman (like apt, yum, or dnf) is a package manager. They will not be aware of software you've installed manually.

From the output you posted, it appears the permissions on one or more files in /usr/local/include have been set without read permissions. Have you attempted to install a C or C++ compiler since my last message?

The issue with permissions can be confirmed by running

ls -l /usr/local/include

or in the particular case

ls -l /usr/local/include/stdc-predef.h

You'll see several columns of output. In the first column of output, you'll see a string describing the permissions, like -rw-r--r--, and in the third and fourth columns, you'll see the file owner and group associated with each file. The permission string is organized into a tuple of triples with a leading directory flag, where the first is the permissions for the file owner, the second is the permissions for members of the files group, and the the third is the permissions for everyone else. Unpacking the example permission string

-rw-r--r--
 
# owner permissions are 'rw-' meaning read and writing, but not execute.
# group permissions are 'r--' meaning read, but not write or execute.
# global permissions are 'r--' meaning read, but not write or execute.

I suspect you'll see these files belong to root and that there is no global read permission. If you can confirm that, I'm happy to help you get things straightened out.

chmod

from njoy21.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.