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

Should prefer python3 over python2 #1221

Open
diederikdehaas opened this issue Apr 4, 2023 · 2 comments
Open

Should prefer python3 over python2 #1221

diederikdehaas opened this issue Apr 4, 2023 · 2 comments

Comments

@diederikdehaas
Copy link
Contributor

Describe the bug
Apparently I still have python2 installed on my (amd64) system and when running ./configure it selected that to build bindings for. I (ofc) also have python3 installed (and python3-dev), but it didn't select that.
Given that python2 is EOL, I think it should use python3 if that's available.

To Reproduce
Steps to reproduce the behavior:

  1. Have both python2 and python3 installed
  2. Clone this repo and install build dependencies
  3. cd into the directory containing the project (rrdtool-1.x)
  4. Run ./bootstrap and then ./configure
  5. See that it will use python2 instead of python3

Expected behavior
If python3 is installed, it should use/prefer that over python2

Screenshots
If applicable, add screenshots to help explain your problem.

Prep for Building Language Bindings
checking for perl... /usr/bin/perl
...
checking for a Python interpreter with version >= 2.3... python2
checking for python2... /usr/bin/python2
checking for python2 version... 2.7
checking for python2 platform... linux2
checking for GNU default python2 prefix... ${prefix}
checking for GNU default python2 exec_prefix... ${exec_prefix}
checking for python2 script directory (pythondir)... ${PYTHON_PREFIX}/lib/python2.7/site-packages
checking for python2 extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python2.7/site-packages
checking for headers required to compile python extensions... not found
configure: WARNING: could not find Python headers
...
config.status: executing po-directories commands

Apply Configuration Information
checking that generated files are newer than configure... done
configure: creating ./config.status
...
ordering CD from https://tobi.oetiker.ch/wish .... just kidding ;-)

----------------------------------------------------------------
Config is DONE!

          With MMAP IO: yes
          With Locking: yes
       Build rrd_graph: yes
     Build rrd_restore: yes
       Static programs: no
          Perl Modules: perl-piped perl-shared
           Perl Binary: /usr/bin/perl
          Perl Version: 5.36.0
          Perl Options: PREFIX=/opt/rrdtool-1.8.0 INSTALL_BASE= LIB=/opt/rrdtool-1.8.0/lib/perl/5.36.0 INSTALLSITEMAN3DIR=${datarootdir}/man/man3
          Ruby Modules: ruby
           Ruby Binary: /usr/bin/ruby
          Ruby Options: sitedir=/opt/rrdtool-1.8.0/lib/ruby
    Build Lua Bindings: no
      Systemd unit dir: /lib/systemd/system
    Build Tcl Bindings: no
 Build Python Bindings: no
         Python Binary: /usr/bin/python2
        Python Version: 2.7
        Build examples: yes
       Build rrdcached: yes
          Build rrdcgi: yes
       Build librrd MT: yes
           Use gettext: yes
           With libDBI: no
         With librados: no
          With libwrap: yes
      With systemd dir: /lib/systemd/system

             Libraries: -lcairo -lglib-2.0 -lgobject-2.0 -lharfbuzz -lm -lpango-1.0 -lpangocairo-1.0 -lpng -lwrap -lxml2 

Type 'make' to compile the software and use 'make install' to 
install everything to: /opt/rrdtool-1.8.0.

Desktop (please complete the following information):

  • OS: Debian Bookworm (amd64)

Additional context
I started looking at a build issue for 32-bit systems/hosts (will report on that later) when I noticed this issue.
When I followed the steps to reproduce on a (clean armhf/32bit) system with only python3 (and python3-dev) installed, it did the right thing.

@diederikdehaas
Copy link
Contributor Author

I started looking at a build issue for 32-bit systems/hosts (will report on that later)

It turned out that backporting the below referenced commits since 1.8.0 fixed that build issue, see https://salsa.debian.org/rrdtool-team/rrdtool/-/merge_requests/4 for details.

  • "acinclude.m4: Include <stdlib.h> when using exit" (f3334fc)
  • "Update Version and Copyright year in git files" (e839e17)
  • "Fix BUILD_DATE in rrdtool help output" (e59f703)
  • "Fix unsigned integer overflow in rrdtool first" (b74a0d6)

Specifically after "Fix BUILD_DATE in rrdtool help output" Salsa's CI (and thus the build i386 job) succeeded.
No idea why, but I'll take it ;-)

@hramrach
Copy link
Contributor

hramrach commented Jan 8, 2024

Sounds like this might work to prefer python3

diff --git a/configure.ac b/configure.ac
index be8b4d6e..140ad111 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1018,7 +1018,7 @@ AC_ARG_ENABLE(python,AS_HELP_STRING([--disable-python],[do not build the python

if test "$enable_python" = "yes"; then
dnl Check for python
-AM_PATH_PYTHON(2.3,[],[enable_python=no])
+AM_PATH_PYTHON(3,[],[AM_PATH_PYTHON(2.3,[],[enable_python=no])])
AM_CHECK_PYTHON_HEADERS(,[enable_python=no;AC_MSG_WARN(could not find Python headers)])
fi

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

2 participants