Skip to content

[WIP] pynac: switch to python3#73722

Closed
timokau wants to merge 1 commit intoNixOS:masterfrom
timokau:pynac-python3
Closed

[WIP] pynac: switch to python3#73722
timokau wants to merge 1 commit intoNixOS:masterfrom
timokau:pynac-python3

Conversation

@timokau
Copy link
Member

@timokau timokau commented Nov 18, 2019

Motivation for this change

Getting the sage python3 build ready. Unfortunately switching pynac over to python3 fails:

checking for python3.7... (cached) /nix/store/gpnm7i19lpj8p43mjrdw03d0hjalmskl-python3-3.7.5/bin/python
checking for a version of Python >= '2.1.0'... yes
checking for the distutils Python package... yes
checking for Python include path... -I/nix/store/gpnm7i19lpj8p43mjrdw03d0hjalmskl-python3-3.7.5/include/python3.7m
checking for Python library path... -L/nix/store/gpnm7i19lpj8p43mjrdw03d0hjalmskl-python3-3.7.5/lib -lpython3.7m
checking for Python site-packages path... /nix/store/gpnm7i19lpj8p43mjrdw03d0hjalmskl-python3-3.7.5/lib/python3.7/site-packages
checking python extra libraries... -lpthread -ldl -lcrypt -lncurses -lutil -lm
checking python extra linking flags... -Xlinker -export-dynamic
checking consistency of all components of python development environment... no
configure: error: in `/build/source':
configure: error:
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

See `config.log' for more details

@FRidh is this package-specific weirdness or are there any differences between the python2 and python3 packages that I should be aware of?

Archlinux apparently was able to switch this package over without any changes: python2 to python3. I tried export PYTHON=python3 without success.

This issue might be relevant, but setting libdir=${python3}/lib didn't solve the issue.

Here is the relevant m4 file.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@ofborg ofborg bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Nov 18, 2019
@FRidh
Copy link
Member

FRidh commented Nov 19, 2019

I have not seen this before with a Python package. Did notice something similar just now on staging-next with SDL_image.

Irrelevant, but note singular is listed twice.

@FRidh FRidh added the 6.topic: python Python is a high-level, general-purpose programming language. label Nov 19, 2019
@timokau
Copy link
Member Author

timokau commented Nov 19, 2019

pynac is not really a python package in the traditional sense. It's a C package that links to python.

Irrelevant, but note singular is listed twice.

Thanks, I'll fix that.

@timokau
Copy link
Member Author

timokau commented Nov 24, 2019

I had a look at the config.log. Turns out it actually failed because it was missing ncurses:

configure:4869: checking consistency of all components of python development environment
configure:4895: gcc -o conftest -g -O2  -I/nix/store/zdh16dcvjw99ybam59zd2ijb6bx138j0-python3-3.7.5/include/python3.7m  conftest.c  -L/nix/store/zdh16dcvjw99ybam59zd2ijb6bx138j0-python3-3.7.5/lib -lpython3.7m -Xlinker -export-dynamic -lpthread -ldl -lcrypt -lncurses -lutil -lm >&5
/nix/store/cg0k49h66nkdqx6ccwnqr0i4q0fnfznc-binutils-2.31.1/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
configure:4895: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "pynac"
| #define PACKAGE_TARNAME "pynac"
| #define PACKAGE_VERSION "0.7.26"
| #define PACKAGE_STRING "pynac 0.7.26"
| #define PACKAGE_BUGREPORT "<pynac-devel@googlegroups.com>"
| #define PACKAGE_URL ""
| #define PACKAGE "pynac"
| #define VERSION "0.7.26"
| #define HAVE_PYTHON "3.7"
| /* end confdefs.h.  */
| 
| 		#include <Python.h>
| int
| main ()
| {
| Py_Initialize();
|   ;
|   return 0;
| }
| 
configure:4912: result: no
configure:4916: error: in `/run/user/1000/tmp.o3V1EhrbOJ/source':
configure:4918: error: 
  Could not link test program to Python. Maybe the main Python library has been
  installed in some non-standard library path. If so, pass it to configure,
  via the LDFLAGS environment variable.
  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
  ============================================================================
   ERROR!
   You probably have to install the development version of the Python package
   for your distribution.  The exact name of this package varies among them.
  ============================================================================

Adding it to the buildInputs fixes the issue. I'll include the pynac python3 switch with the sage switch in #70474.

Curious that it worked without the ncurses dep in python2 though. Should ncurses maybe be propagated from python3?

@FRidh
Copy link
Member

FRidh commented Nov 24, 2019

Should ncurses maybe be propagated from python3?

That would result in every package needing python to receive ncurses as build-time dependency. That's a bit too much.

@timokau
Copy link
Member Author

timokau commented Nov 24, 2019

Yeah but it somehow must have been included with python2 right? Otherwise I don't know why I didn't need to specify the dependency before. Or maybe it has something to do with
https://github.com/pynac/pynac/blob/85c43c230e8050a1f71898889a021fec28318502/acinclude.m4#L45
(the only mention of ncurses in pynac). I don't really understand what's going on there, since I'm not really fluent in all the autotools stuff.

@timokau timokau closed this Nov 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants