usnistgov/REFPROP-cmake

Docker ubuntu-18.04 fails on missing CMakeLists.txt

alfred-stokespace opened this issue · 16 comments

Specific error I get in container

CMake Error: The source directory "/REFPROP-cmake/build" does not appear to contain CMakeLists.txt.

Setup

Host: Dell Precision i7-10850H CPU
Windows: 10 ( HOST OS)
Building on VMWARE: Ubuntu VM ( GUEST OS)

Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal

Build directory in Guest OS

tree -L 1
.
├── Dockerfile
├── Makefile
├── RP10src
└── run-me-inside-container.sh

1 directory, 3 files

My Makefile is just convenience wrapper.

build:
	docker build -t rpub18 .

run:
	docker run -it -v "$$(pwd)":/shared  -t rpub18 bash

I put your readme command into the run-me-inside-container.sh and COPY that into the container in Dockerfile

cd /REFPROP-cmake/build
cmake -DREFPROP_FORTRAN_PATH=/shared/RP10src
cmake --build .

My Dockerfile ...

FROM ubuntu:18.04

RUN apt-get -y -m update && \
    apt-get install -y git cmake g++ gfortran python3 python3-pip

# This ADD block forces a build (invalidates the cache) if the git repo contents have changed, otherwise leaves it untouched.
ADD https://api.github.com/repos/usnistgov/REFPROP-cmake/git/refs/heads/master RPcmake-version.json
RUN git clone --recursive https://github.com/usnistgov/REFPROP-cmake && \
    cd REFPROP-cmake/ && \
    mkdir build && \
    cd build/

# Soft-link pip3->pip and same for python
RUN ln -s /usr/bin/pip3 /usr/bin/pip && \
    ln -s /usr/bin/python3 /usr/bin/python

# Install numpy from pip
RUN pip install numpy && python -c "import numpy; print(numpy.__version__)"

COPY ./run-me-inside-container.sh ./build.sh 
  1. I build the Image make build (that's fine)

  2. I issue make run

  3.    docker run -it -v "$(pwd)":/shared  -t rpub18 bash
    
       root@2f96fd1a1974:/# ./build.sh 
       CMake Error: The source directory "/REFPROP-cmake/build" does not appear to contain CMakeLists.txt.
       Specify --help for usage, or press the help button on the CMake GUI.
       Error: could not load cache
       root@2f96fd1a1974:/# 
    
  4. I confirm the contents of /shared/RP10src/

       root@3e95db2a941f:/# ls /shared/RP10src/
       COMAGA8.INC  COMTRN.INC    DLLFILES      SAT_SUB.FOR   UTILITY.FOR
       COMANC.INC   CONSTS.INC    FLSH_SUB.FOR  SETUP.FOR
       COMFEQ.INC   CORE_ANC.FOR  MIX_HMX.FOR   TRNSP.FOR
       COMMONS.INC  CORE_FEQ.FOR  PROP_SUB.FOR  TRNS_TCX.FOR
       COMREFP.INC  CORE_PR.FOR   REFPROP.FOR   TRNS_VIS.FOR
    
  5. I confirm the contents of /REFPROP-cmake/build/

       root@3e95db2a941f:/# ls -ltra  /REFPROP-cmake/build/
       total 8
       drwxr-xr-x 6 root root 4096 Jun 16 13:14 ..
       drwxr-xr-x 2 root root 4096 Jun 16 13:14 .
       root@3e95db2a941f:/# 
    

Commentary

I first tried this in a WSL Ubuntu 20.04 and didn't have all the Makefile business and just copy pasted your commands. Same error as the above VMWare attempt.

You're using cmake wrong. Your commands should read:

cd /REFPROP-cmake/build
cmake .. -DREFPROP_FORTRAN_PATH=/shared/RP10src
cmake --build .

Note the missing .. in the second command

thanks @ianhbell I'll try that.
your docs suggest the .. isn't necessary
image

What README are you referring to?

Otherwise I think I'm in business

-- DEFSYM_FLAG: --using-defsym
-- linux
Missing from PASS_CMN_tokens:  ['ABFLASHdll', 'VIRBCD12dll', 'VIRTAUdll']
Missing from REFPROP_lib.h: []

-- Configuring done
-- Generating done
-- Build files have been written to: /REFPROP-cmake/build
Scanning dependencies of target refprop
[  6%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_ANC.FOR.o
[ 12%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_FEQ.FOR.o
[ 18%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_PR.FOR.o
[ 25%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/FLSH_SUB.FOR.o
[ 31%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/MIX_HMX.FOR.o
[ 37%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/PROP_SUB.FOR.o
[ 43%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/REFPROP.FOR.o
/shared/RP10src/REFPROP.FOR:5589:72:

          if (ABS(iErrPrnt).eq.3) pause           !If your compiler complains about this line, just delete it.
                                                                        1
Warning: Deleted feature: PAUSE statement at (1)
[ 50%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/SAT_SUB.FOR.o
[ 56%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/SETUP.FOR.o
[ 62%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNSP.FOR.o
[ 68%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNS_TCX.FOR.o
[ 75%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNS_VIS.FOR.o
[ 81%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/UTILITY.FOR.o
[ 87%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/DLLFILES/PASS_FTN.FOR.o
[ 93%] Linking Fortran shared library librefprop.so
[ 93%] Built target refprop
Scanning dependencies of target REFPROP_H
[100%] About to build the REFPROP.h header file w/ /usr/bin/python;-u;/REFPROP-cmake/externals/REFPROP-headers/generate_header.py;--FORTRAN-path;/shared/RP10src/DLLFILES;--python-exe;/usr/bin/python
Writing the .pyf file with numpy.f2py, please be patient...
About to run: /usr/bin/python -m numpy.f2py --quiet --no-lower -h REFPROP.pyf /shared/RP10src/DLLFILES/PASS_FTN.FOR
numpy version: 1.19.5
Deleting REFPROP.pyf
[100%] Built target REFPROP_H
root@9345bffc20f1:/# 

Fixed README. You should be using 20.04, or 22.04

Yes, seems so

@ianhbell when you say I should using 20.04, or 22.04
were you referring to you example Dockerfile https://github.com/usnistgov/REFPROP-cmake/blob/master/docker/ubuntu-18.04/Dockerfile#L1 ?

Or the host os running docker system?

I mean the base image, 18.04 is quite old now, and better to stay up to date since that gives you more modern python versions, etc.

cool I'll try that now.

so far one snag I hit w/20.04 as the base image was the build asks for tzdata region selection and prompts for input.
Still trying to figure out how to avoid that prompt... also making a selection upon prompt seems to freeze the build process.

you can set the DEBIAN_NONINTERACTIVE environment variable to avoid that problem

That was helpful, thanks. Can you confirm a few things for me...

my Dockerfile

FROM ubuntu:20.04

RUN apt-get -y -m update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y git cmake g++ gfortran python3 python3-pip python3-six

# This ADD block forces a build (invalidates the cache) if the git repo contents have changed, otherwise leaves it untouched.
ADD https://api.github.com/repos/usnistgov/REFPROP-cmake/git/refs/heads/master RPcmake-version.json
RUN git clone --recursive https://github.com/usnistgov/REFPROP-cmake && \
    cd REFPROP-cmake/ && \
    mkdir build && \
    cd build/

# Soft-link pip3->pip and same for python
RUN  ln -s /usr/bin/python3 /usr/bin/python


# Install numpy from pip
RUN pip install numpy && python -c "import numpy; print(numpy.__version__)"

COPY ./run-me-inside-container.sh ./build.sh

and my build output (since i'm not familiar with FORTRAN or refprop) I see some Warning's

root@95d6d241db0f:/# ./build.sh 
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The Fortran compiler identification is GNU 9.4.0
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Found PythonInterp: /usr/bin/python (found version "3.8.10") 
-- DEFSYM_FLAG: --using-defsym
-- linux
Missing from PASS_CMN_tokens:  ['ABFLASHdll', 'VIRBCD12dll', 'VIRTAUdll']
Missing from REFPROP_lib.h: []

-- Configuring done
-- Generating done
-- Build files have been written to: /REFPROP-cmake/build
Scanning dependencies of target REFPROP_H
[  6%] About to build the REFPROP.h header file w/ /usr/bin/python;-u;/REFPROP-cmake/externals/REFPROP-headers/generate_header.py;--FORTRAN-path;/shared/RP10src/DLLFILES;--python-exe;/usr/bin/python
Writing the .pyf file with numpy.f2py, please be patient...
About to run: /usr/bin/python -m numpy.f2py --quiet --no-lower -h REFPROP.pyf /shared/RP10src/DLLFILES/PASS_FTN.FOR
numpy version: 1.22.4
Deleting REFPROP.pyf
[  6%] Built target REFPROP_H
Scanning dependencies of target refprop
[ 12%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_ANC.FOR.o
[ 18%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_FEQ.FOR.o
[ 25%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/CORE_PR.FOR.o
[ 31%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/FLSH_SUB.FOR.o
[ 37%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/MIX_HMX.FOR.o
[ 43%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/PROP_SUB.FOR.o
[ 50%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/REFPROP.FOR.o
/shared/RP10src/REFPROP.FOR:5589:72:

 5589 |         if (ABS(iErrPrnt).eq.3) pause           !If your compiler complains about this line, just delete it.
      |                                                                       1

Warning: Deleted feature: PAUSE statement at (1)
/shared/RP10src/REFPROP.FOR:3108:0:

 3108 |       if (iUCode.eq.1000) hun=hUnt(4)(2:ispc(4)-1)         !Remove parenthesis if output units is only J/mol or kJ/kg.
      | 
Warning: '__builtin_memcpy' reading 255 bytes from a region of size 39 [-Wstringop-overflow=]
/shared/RP10src/REFPROP.FOR:3109:0:

 3109 |       if (iUCode.eq.0100) hun=hUnt(3)(2:ispc(3)-1)         !Same for density (mol/dm^3 or kg/m^3).
      | 
Warning: '__builtin_memcpy' reading 255 bytes from a region of size 59 [-Wstringop-overflow=]
/shared/RP10src/REFPROP.FOR:3110:0:

 3110 |       if (iUCode.eq.0900) hun=hUnt(0)(2:ispc(0)-1)         !Same for volume.
      | 
Warning: '__builtin_memcpy' reading 255 bytes from a region of size 119 [-Wstringop-overflow=]
[ 56%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/SAT_SUB.FOR.o
[ 62%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/SETUP.FOR.o
[ 68%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNSP.FOR.o
[ 75%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNS_TCX.FOR.o
[ 81%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/TRNS_VIS.FOR.o
[ 87%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/UTILITY.FOR.o
[ 93%] Building Fortran object CMakeFiles/refprop.dir/shared/RP10src/DLLFILES/PASS_FTN.FOR.o
[100%] Linking Fortran shared library librefprop.so
[100%] Built target refprop

That all seems ok with me

Cool, thanks. I'll close the issue.