charm icon indicating copy to clipboard operation
charm copied to clipboard

Charm++ cannot configure due to faulty ${PYTHON_VERSION}

Open chemsh opened this issue 4 years ago • 3 comments

Dear Charm++ Developers,

Please ignore this if it duplicates a previous Issue or it was already fixed. My Charm++ version is 61002 which comes from the latest stable release of NAMD 2.14.

I find Charm++ failing at the configure stage around line 5415 of configure:

cat >>confdefs.h <<_ACEOF
#define CMK_PYTHON_VERSION ${PYTHON_VERSION}
_ACEOF

because it writes

#define CMK_PYTHON_VERSION 3.9
.
#define CMK_HAS_SYNC 1

into confdefs.h. The extra new line of only "." arises from the previous definition of ${PYTHON_VERSION} in configure (~line 5394):

PYTHON_VERSION=`python -V 2>&1 | awk {'print $2'} | awk -F. {'print $1"."$2'}`

Because awk after the first pipe by default inserts a new line then the second awk produces a result of two lines with the second of no result from -F. A fix could be:

PYTHON_VERSION=`python -V 2>&1 | awk -v ORS= {'print $2'} | awk -F. {'print $1"."$2'}`

to suppress the insertion of new line.

My system information is: bash: 5.0.17 mawk 1.3.4

Thank you very much in advance for taking care of issue.

Kind regards,

You

chemsh avatar Jan 05 '22 02:01 chemsh

Thanks for creating this issue. Can you paste the command you used to build?

ZwFink avatar Jan 13 '22 21:01 ZwFink

Hi, sorry for not getting back sooner. My build command is: bash my_path_to_charm++/src/build charm++ mpi-linux-x86_64 mpicxx ifort --with-production It is invoked by CMake in our software which uses NAMD as a driver. Thank you very much.

chemsh avatar Jan 26 '22 12:01 chemsh

Sorry for the late response @chemsh, but I can't reproduce this error. Could you please check if using

PYTHON_VERSION=`python -V 2>&1 | awk '{print $2}' | cut -f1,2 -d.`

fixes this issue for you?

matthiasdiener avatar Mar 03 '22 21:03 matthiasdiener