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

Question - cmake runs examples fine but not after I copy them to ~/shared #15

Open
yw5aj opened this issue Mar 22, 2018 · 9 comments
Open

Comments

@yw5aj
Copy link

yw5aj commented Mar 22, 2018

Short summary: cmake runs examples fine when I run it in the pre-installed src example folder, but not after I copied it to ~/shared. Could you please help see why?

Full story: first, when I run it in the pre-installed src example folder, it works:

E:\dealii>docker pull dealii/dealii:v8.5.1-gcc-mpi-fulldepscandi-debugrelease
v8.5.1-gcc-mpi-fulldepscandi-debugrelease: Pulling from dealii/dealii
Digest: sha256:5c6ed25801292f715136bdad411e7dcda1d8f647f60c31be10533aa2697582ac
Status: Image is up to date for dealii/dealii:v8.5.1-gcc-mpi-fulldepscandi-debugrelease

E:\dealii>docker run -i -t -v E:\dealii:/home/dealii/shared dealii/dealii:v8.5.1-gcc-mpi-fulldepscandi-debugrelease
dealii@d0e24c0315a5:~$ cd dealii-v8.5.1-src/examples/step-1
dealii@d0e24c0315a5:~/dealii-v8.5.1-src/examples/step-1$ cmake CMakeLists.txt
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /usr/bin/mpicc
-- Check for working C compiler: /usr/bin/mpicc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/mpicxx
-- Check for working CXX compiler: /usr/bin/mpicxx -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Autopilot invoked
###
#
#  Project  step-1  set up with  deal.II-8.5.1  found at
#      /home/dealii/dealii-v8.5.1
#
#  CMAKE_BUILD_TYPE:          Debug
#
#  You can now run
#       $ make                - to compile and link the program
#       $ make run            - to (compile, link and) run the program
#
#       $ make debug          - to switch the build type to 'Debug'
#       $ make release        - to switch the build type to 'Release'
#
#       $ make edit_cache     - to change (cached) configuration variables
#                               and rerun the configure and generate phases of CMake
#
#       $ make strip_comments - to strip the source files in this
#                               directory off the documentation comments
#       $ make clean          - to remove the generated executable as well as
#                               all intermediate compilation files
#       $ make runclean       - to remove all output generated by the program
#       $ make distclean      - to clean the directory from _all_ generated
#                               files (includes clean, runclean and the removal
#                               of the generated build system)
#       $ make info           - to view this message again
#
#  Have a nice day!
#
###
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dealii/dealii-v8.5.1-src/examples/step-1
dealii@d0e24c0315a5:~/dealii-v8.5.1-src/examples/step-1$ make run
Scanning dependencies of target step-1
[ 33%] Building CXX object CMakeFiles/step-1.dir/step-1.cc.o
[ 66%] Linking CXX executable step-1
[ 66%] Built target step-1
Scanning dependencies of target run
[100%] Run step-1 with Debug configuration
Grid written to grid-1.eps
Grid written to grid-2.eps
[100%] Built target run

However, if I copy the examples to my local folder, it wouldn't work. (Edit on 3/23 - removed the confusion parts of the code where I forgot to clean the old cmake file first)

(I cleaned the folder and then copied the examples to ~/shared/examples)

dealii@d0e24c0315a5:~/shared/examples/step-1$ ls
CMakeLists.txt  step-1.cc
dealii@d0e24c0315a5:~/shared/examples/step-1$ cmake CMakeLists.txt
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /usr/bin/mpicc
-- Check for working C compiler: /usr/bin/mpicc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/mpicc" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /home/dealii/shared/examples/step-1/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/bin/make" "cmTC_f6b04/fast"

  make: *** No rule to make target 'cmTC_f6b04/fast'.  Stop.





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


-- Configuring incomplete, errors occurred!
See also "/home/dealii/shared/examples/step-1/CMakeFiles/CMakeOutput.log".
See also "/home/dealii/shared/examples/step-1/CMakeFiles/CMakeError.log".

Could you please help?

Thank you,
Shawn

@Rombur
Copy link
Member

Rombur commented Mar 23, 2018

Remove the CMakeCache.txt file. You have a problem because you first configured the test and then moved the directory. Because of that all the paths are wrong. You need to remove CMakeCache.txt in order to do a clean configure.

@yw5aj
Copy link
Author

yw5aj commented Mar 23, 2018

@Rombur Thank you Rombur for your response! Yes I tried that already and posted it in the first message, but I failed to explain it clearly enough (I did not break them up into sub paragraphs). Apologies for the confusion.

At first I did forget to remove the CMakeCache.txt:

dealii@d0e24c0315a5:~/dealii-v8.5.1-src/examples/step-1$ cp -r ~/dealii-v8.5.1-src/examples ~/shared/examples
dealii@d0e24c0315a5:~/dealii-v8.5.1-src/examples/step-1$ cd ~/shared/examples/step-1
dealii@d0e24c0315a5:~/shared/examples/step-1$ cmake CMakeLists.txt
CMake Error: The current CMakeCache.txt directory /home/dealii/shared/examples/step-1/CMakeCache.txt is different than the directory /home/dealii/dealii-v8.5.1-src/examples/step-1 where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source "/home/dealii/shared/examples/step-1/CMakeLists.txt" does not match the source "/home/dealii/dealii-v8.5.1-src/examples/step-1/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

So I removed all those files except for the step-1.cc and the CMakeLists.txt:

dealii@d0e24c0315a5:~/shared/examples/step-1$ ls | grep -v 'CMakeLists.txt\|step-1.cc' | xargs rm -rf
dealii@d0e24c0315a5:~/shared/examples/step-1$ ls
CMakeLists.txt  step-1.cc

And then I re-ran the cmake command, and encountered an issue where mpicc is not working:

dealii@d0e24c0315a5:~/shared/examples/step-1$ cmake CMakeLists.txt
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /usr/bin/mpicc
-- Check for working C compiler: /usr/bin/mpicc -- broken
CMake Error at /usr/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/bin/mpicc" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /home/dealii/shared/examples/step-1/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/bin/make" "cmTC_f6b04/fast"

  make: *** No rule to make target 'cmTC_f6b04/fast'.  Stop.





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


-- Configuring incomplete, errors occurred!
See also "/home/dealii/shared/examples/step-1/CMakeFiles/CMakeOutput.log".
See also "/home/dealii/shared/examples/step-1/CMakeFiles/CMakeError.log".

@luca-heltai
Copy link
Member

luca-heltai commented Mar 23, 2018 via email

@yw5aj
Copy link
Author

yw5aj commented Mar 23, 2018

@luca-heltai Thanks for you response! Yes I did - I only left step-1.cc and CMakeLists.txt, by running ls | grep -v 'CMakeLists.txt\|step-1.cc' | xargs rm -rf. And the mpicc still failed.

@luca-heltai
Copy link
Member

is the directory writeable by you?

@yw5aj
Copy link
Author

yw5aj commented Mar 23, 2018

@luca-heltai Thank you for the quick response.

  1. Yes I do - I tried the following:
dealii@4672ffbca33e:~/shared/examples/step-1$ touch test.txt
dealii@4672ffbca33e:~/shared/examples/step-1$ ls
CMakeLists.txt  step-1.cc  test.txt
  1. I had the same question yesterday, because in the CMakeError.log I read the following lines:
Determining if the C compiler works failed with the following output:
Change Dir: /home/dealii/shared/examples/step-1/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_a147c/fast"
make: *** No rule to make target 'cmTC_a147c/fast'.  Stop.

@luca-heltai
Copy link
Member

Mmmm... it seems like it does not create directories. Can you create directories?

@yw5aj
Copy link
Author

yw5aj commented Mar 23, 2018

@luca-heltai Yes I feel the same way - it seems like it failed to create cmTC_a147c/fast. However, it did create all the other folders like CMakeFiles, CMakeTmp. Also, I tried the following:

dealii@4672ffbca33e:~/shared/examples/step-1$ ls
CMakeLists.txt  step-1.cc
dealii@4672ffbca33e:~/shared/examples/step-1$ mkdir testdir
dealii@4672ffbca33e:~/shared/examples/step-1$ cd testdir
dealii@4672ffbca33e:~/shared/examples/step-1/testdir$ touch test.txt
dealii@4672ffbca33e:~/shared/examples/step-1/testdir$ ls
test.txt
dealii@4672ffbca33e:~/shared/examples/step-1/testdir$ cd ..
dealii@4672ffbca33e:~/shared/examples/step-1$ ls
CMakeLists.txt  step-1.cc  testdir

@satrapes
Copy link

satrapes commented Aug 1, 2020

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

4 participants