From 08f0cf5bd524e647c0e3d9b4c12f2a43f0f97bd3 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Jan 2025 15:19:09 -0500 Subject: [PATCH 1/9] Fixes for using system readline --- configure | 19 ++++++++++--------- src/ReadLine.cpp | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 5b30d9c218..245890a25c 100755 --- a/configure +++ b/configure @@ -318,9 +318,9 @@ LIB_D_ON[$LFFTW3]='-DFFTW_FFT' LIB_DOFF[$LFFTW3]='' LIB_TYPE[$LFFTW3]='cpp' -LIB_STAT[$LREADLINE]='bundled' +LIB_STAT[$LREADLINE]='enabled' LIB_CKEY[$LREADLINE]='readline' -LIB_HOME[$LREADLINE]='readline' +LIB_HOME[$LREADLINE]='' LIB_FLAG[$LREADLINE]='-lreadline' LIB_STTC[$LREADLINE]='libreadline.a' LIB_D_ON[$LREADLINE]='' @@ -1073,7 +1073,7 @@ EOF TestReadline() { cat > testp.cpp < -#include +#include static char *line_read = (char *)NULL; // Do not want to actually run this so leave outside main void Unused() { line_read = readline(""); } @@ -1503,23 +1503,24 @@ SetupLibraries() { lflag="-L$lhdir ${LIB_FLAG[$i]}" fi # Library-specific CPPTRAJ_INC fixes when home specified. - if [ $i -eq $LREADLINE ] ; then - linc="$linc/readline" - fi + #if [ $i -eq $LREADLINE ] ; then + # linc="$linc/readline" + #fi if [ $i -eq $LXDRFILE ] ; then linc="$linc/xdrfile" fi fi # Library-specific flag fixes - if [ $i -eq $LREADLINE ] ; then +# if [ $i -eq $LREADLINE ] ; then # For external readline, we need to link libtermcap for windows # and libncurses for Linux #if [ $USE_WINDOWS -eq 1 ]; then - lflag="$lflag -ltermcap" +# lflag="$lflag -ltermcap" #else # lflag="$lflag -lncurses" #fi - elif [ $i -eq $LSANDER ] ; then +# elif [ $i -eq $LSANDER ] ; then + if [ $i -eq $LSANDER ] ; then # Always specify libsander location to prevent pulling in # other amber libraries. if [ ! -f "${LIB_FLAG[$LSANDER]}" ] ; then diff --git a/src/ReadLine.cpp b/src/ReadLine.cpp index 73e11a74e8..04d62a8a44 100644 --- a/src/ReadLine.cpp +++ b/src/ReadLine.cpp @@ -8,8 +8,8 @@ # include #else # define READLINE_LIBRARY -# include -# include +# include +# include #endif #include "ReadLine.h" #include "Command.h" From 2422d4bc1a688a5222a104997a58df32e0c9732c Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Fri, 3 Jan 2025 16:08:19 -0500 Subject: [PATCH 2/9] Go back to bundled readline if no system readline present --- configure | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 245890a25c..57782d5fd0 100755 --- a/configure +++ b/configure @@ -1079,7 +1079,18 @@ static char *line_read = (char *)NULL; void Unused() { line_read = readline(""); } int main() { return 0; } EOF - TestProgram " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + + if [ "${LIB_STAT[$LREADLINE]}" = 'specified' ] ; then + TestProgram " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + else + TestProgram silent " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" + if [ $? -ne 0 ] ; then + echo "No readline available; using bundled readline." + LIB_STAT[$LREADLINE]='bundled' + LIB_FLAG[$LREADLINE]='readline/libreadline.a' + LIB_INCL[$LREADLINE]='-I.' + fi + fi } TestXdrfile() { From 53847ede130ec1991683c023f3addca3ca55f847 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Mon, 6 Jan 2025 11:03:45 -0500 Subject: [PATCH 3/9] Add checks for testing whether -ltermcap or -lncurses are needed for linking to system readline --- configure | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 57782d5fd0..c05e1d3be8 100755 --- a/configure +++ b/configure @@ -1083,8 +1083,26 @@ EOF if [ "${LIB_STAT[$LREADLINE]}" = 'specified' ] ; then TestProgram " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" else + # Test with just -lreadline TestProgram silent " Checking Readline" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]}" - if [ $? -ne 0 ] ; then + lreadline_err=$? + if [ $lreadline_err -ne 0 ] ; then + # Try -ltermcap + TestProgram silent " Checking Readline with termcap" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]} -ltermcap" + lreadline_err=$? + if [ $lreadline_err -eq 0 ] ; then + LIB_FLAG[$LREADLINE]="${LIB_FLAG[$LREADLINE]} -ltermcap" + fi + fi + if [ $lreadline_err -ne 0 ] ; then + # Try -lncurses + TestProgram silent " Checking Readline with ncurses" "$CXX" "$CXXFLAGS ${LIB_INCL[$LREADLINE]}" testp.cpp "${LIB_FLAG[$LREADLINE]} -lncurses" + lreadline_err=$? + if [ $lreadline_err -eq 0 ] ; then + LIB_FLAG[$LREADLINE]="${LIB_FLAG[$LREADLINE]} -lncurses" + fi + fi + if [ $lreadline_err -ne 0 ] ; then echo "No readline available; using bundled readline." LIB_STAT[$LREADLINE]='bundled' LIB_FLAG[$LREADLINE]='readline/libreadline.a' From efc34103f8bd52c25b237da6fb50c3459c99c097 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 12:24:39 -0500 Subject: [PATCH 4/9] Change readline include path for CMAKE --- src/readline/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/readline/CMakeLists.txt b/src/readline/CMakeLists.txt index 556e6f6be7..69a5da36cd 100644 --- a/src/readline/CMakeLists.txt +++ b/src/readline/CMakeLists.txt @@ -43,4 +43,4 @@ add_compile_options(${OPT_CFLAGS}) add_library(readline STATIC ${CPPTRAJ_READLINE_SOURCES}) target_compile_definitions(readline PRIVATE HAVE_CONFIG_H=1) # make sure the code uses the premade config.h make_pic_if_needed(readline) -target_include_directories(readline PUBLIC .) +target_include_directories(readline PUBLIC ../) From ff293eb5e185202143d4ded9ff349c89636815e6 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 12:50:36 -0500 Subject: [PATCH 5/9] Add the '.' include back for the bundled readline library itself. --- src/readline/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/readline/CMakeLists.txt b/src/readline/CMakeLists.txt index 69a5da36cd..d4de3f58e2 100644 --- a/src/readline/CMakeLists.txt +++ b/src/readline/CMakeLists.txt @@ -43,4 +43,5 @@ add_compile_options(${OPT_CFLAGS}) add_library(readline STATIC ${CPPTRAJ_READLINE_SOURCES}) target_compile_definitions(readline PRIVATE HAVE_CONFIG_H=1) # make sure the code uses the premade config.h make_pic_if_needed(readline) +target_include_directories(readline PUBLIC .) target_include_directories(readline PUBLIC ../) From 81df7497186268f1548cbbf40df617e60f68018e Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 13:09:16 -0500 Subject: [PATCH 6/9] Try to fix the clang compile. I thought this was based on the gcc version but maybe not? --- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index c05e1d3be8..ae78a60ec8 100755 --- a/configure +++ b/configure @@ -1701,8 +1701,8 @@ SetupCompilers() { # Check the GNU compiler version CheckCompilerVersion gcc # Set version-specific flags - if [ $cc_version_major -ge 14 ] ; then - # Needed for readline with gcc >= 14 + if [ $cc_version_major -ge 13 ] ; then + # Needed for readline with gcc >= 13 CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_XOPEN_SOURCE" fi ;; From 7e68697d82020d59fae05b5146c42c95269e3370 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 13:46:49 -0500 Subject: [PATCH 7/9] Try to upgrade to python 3.11 for pytraj to get CI working again. --- .github/workflows/merge-gate.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 2cf3514bec..979458cecd 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -138,10 +138,10 @@ jobs: sudo apt-get install clang sudo apt-get install cmake-data cmake - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Add conda to system path run: | # $CONDA is an environment variable pointing to the root of the miniconda directory @@ -149,7 +149,7 @@ jobs: - name: Install conda packages run: | which conda - conda install conda=23.11.0 python=3.10 + conda install conda=23.11.0 python=3.11 conda --version conda env update --file devtools/ci/environment.yml --name base - name: Install cpptraj From 9efa313d0b24220b221fb976e927668b6bb8122b Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 13:49:44 -0500 Subject: [PATCH 8/9] Try conda 24.11.0. --- .github/workflows/merge-gate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 979458cecd..684f27429d 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -149,7 +149,7 @@ jobs: - name: Install conda packages run: | which conda - conda install conda=23.11.0 python=3.11 + conda install conda=24.11.0 python=3.10 conda --version conda env update --file devtools/ci/environment.yml --name base - name: Install cpptraj From 0145be7fae7318ba21532e1c9bdd2346ba222c32 Mon Sep 17 00:00:00 2001 From: "Daniel R. Roe" Date: Wed, 8 Jan 2025 13:50:25 -0500 Subject: [PATCH 9/9] Forgot to revert python. I do not like python. --- .github/workflows/merge-gate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index 684f27429d..fa24a95404 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -138,10 +138,10 @@ jobs: sudo apt-get install clang sudo apt-get install cmake-data cmake - uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.10' - name: Add conda to system path run: | # $CONDA is an environment variable pointing to the root of the miniconda directory