Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building problem on Linux #91

Closed
ATM-Jahid opened this issue Jul 8, 2019 · 15 comments
Closed

Building problem on Linux #91

ATM-Jahid opened this issue Jul 8, 2019 · 15 comments

Comments

@ATM-Jahid
Copy link

ATM-Jahid commented Jul 8, 2019

After I execute the command ./metaconfigure/fetch_subprojects.py ../1.0.1-NJOY21.json in the NJOY21 directory, the process gets stuck at Fetching njoy....

If I quit the process and re-execute it again, the following problem arises:

fatal: Needed a single revision
Unable to find current revision in submodule path 'njoy'
Checking out revision 9e3f11b4d29102567d417fc78e664823d2ef862f...

error: Server does not allow request for unadvertised object 9e3f11b4d29102567d417fc78e664823d2ef862f
@jlconlin
Copy link
Member

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

@ATM-Jahid
Copy link
Author

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

@apmccartney
Copy link
Member

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.

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 17, 2019

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.

@apmccartney
Copy link
Member

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

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 18, 2019

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

@apmccartney
Copy link
Member

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

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 20, 2019

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

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 20, 2019

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

@apmccartney
Copy link
Member

apmccartney commented Jul 20, 2019

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

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 20, 2019

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

@apmccartney
Copy link
Member

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*

@ATM-Jahid
Copy link
Author

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

@ATM-Jahid
Copy link
Author

ATM-Jahid commented Jul 22, 2019

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

@apmccartney
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants