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

CMake Error at config/cmake/ConfigureChecks.cmake:312 (file) #969

Closed
besoft opened this issue Aug 27, 2021 · 5 comments
Closed

CMake Error at config/cmake/ConfigureChecks.cmake:312 (file) #969

besoft opened this issue Aug 27, 2021 · 5 comments
Assignees

Comments

@besoft
Copy link

besoft commented Aug 27, 2021

CMake GUI 3.21.1 on Windows x64 with Visual Studio 16 2019 as a generator fails to configure.

The code FILE* pFile = fopen returns null, which results in TRY_RUN failure. This can be solved by running CMake GUI runs with admin rights. However, for some reason, the file is then unavailable for reading by CMAKE line 312:

file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4)

My solution for the issue is to

  1. modify the macro C_RUN in config/cmake/ConfigureChecks so that it returns also the content of the standard output:
macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)

...

#set (${RETURN_VAR} ${OUTPUT_VAR})
set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
  1. change the code so that the values are not printed into a file but into the standard output stream:
    #endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
  2. update lines 311 and 312 to process the values from the standard output stream:
C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4)
#file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4)
@jwsblokland
Copy link
Contributor

@besoft This issue reminds me of the closed issue HDF5 1.12.1: Unable to compile the parallel version using CMake that I have reported in the past. Maybe the pull request #843 mentioned in the issue solves your problem.

@adbyrne
Copy link

adbyrne commented Oct 13, 2021

This looks reasonable, however we will need to make the same change in the autoconf configure.
And we should try to extend this for the fortran configuration as well.

@byrnHDF
Copy link
Contributor

byrnHDF commented Oct 13, 2021

PR #1089 created

lrknox pushed a commit that referenced this issue Nov 18, 2021
* Use stdout instead of file for configure check

* Make change requested by #1157

* Change fortran to use stderr for configure

* Correct typo

* remove obsolete file check

* Fortran statement fix
lrknox pushed a commit that referenced this issue Nov 25, 2021
Merge Fix Fortran REGEX and newlines #1226
Merge Github #969 Use stdout instead of file for configure check #1089
Merge Consolidate VFD create list macro #1132
@byrnHDF
Copy link
Contributor

byrnHDF commented Dec 6, 2021

The solution has been merged into all branches.

@byrnHDF byrnHDF closed this as completed Dec 6, 2021
lrknox pushed a commit that referenced this issue Dec 8, 2021
* Convert SWMR shell scripts to Windows powershell.

* Use $LastExitCode instead of $? in script

* Prevent execution in a different window

* Github #969 Use stdout instead of file for configure check (#1089)

* Use stdout instead of file for configure check

* Make change requested by #1157

* Change fortran to use stderr for configure

* Correct typo

* remove obsolete file check

* Fortran statement fix

* Don't allow H5Pset(get)_all_coll_metadata_ops for DXPLs (#1201)

* Fixes const warnings in H5ES package (#1211)

* Quiets a 'set but not used' warning in h5diff_array.c (#1210)

* Convert vds swmr test script to powershell

* Enable vdsswmr powershell test

* Add configure vdsswmr statement

* Correct powershell script vars

* Convert SWMR shell scripts to Windows powershell.

* Use $LastExitCode instead of $? in script

* Prevent execution in a different window

* Github #969 Use stdout instead of file for configure check (#1089)

* Use stdout instead of file for configure check

* Make change requested by #1157

* Change fortran to use stderr for configure

* Correct typo

* remove obsolete file check

* Fortran statement fix

* Convert vds swmr test script to powershell

* Enable vdsswmr powershell test

* Add configure vdsswmr statement

* Correct powershell script vars

* Cleanup review issues

* Fix variable assignment

* Change the wait function to pass in the path

* Disable actual test execution until programs fixed

* Adjust copyright text

* Fix spelling

Co-authored-by: jhendersonHDF <[email protected]>
Co-authored-by: Dana Robinson <[email protected]>
@btknzn
Copy link

btknzn commented Dec 15, 2021

it is nice solution, thanks

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

5 participants