Giter Site home page Giter Site logo

Install script unable to compile python on debian based system (gcc 11, error: implicit declaration of function ‘close_range’) about pyenv HOT 12 CLOSED

Youjin1985 avatar Youjin1985 commented on September 22, 2024
Install script unable to compile python on debian based system (gcc 11, error: implicit declaration of function ‘close_range’)

from pyenv.

Comments (12)

native-api avatar native-api commented on September 22, 2024 1

Adding declarations of functions that should be in system headers in a certain no-go -- that'll break the build in other environments where those functions are defined differently.

Strictly speaking, you are installing deb packages into an environment that they were not designed for.
Nobody guarantees you that they will work properly.

  • Is using the system compiler not an option? That should be the easiest way to proceed
  • You can provide a custom patch to apply to the source code with the -p option to pyenv install
  • A "good" solution I have in mind is to pinpoint the place in your specific compiler toolchain where it goes wrong and fix that -- perhaps possible by defining an envvar or preprocessor symbol.
    For that, I need to be able to reproduce the issue -- which I'm having trouble with, so your help in that would be very welcome.

from pyenv.

Youjin1985 avatar Youjin1985 commented on September 22, 2024 1

Thank you so much. Seems patch is only option (but I already did it manually faster than I would figure out how to apply it - I am not using it in development).
I'll gladly provide any information which can help.

How did you install the gcc-11 package? Deepin has a "package installer" to install 3rd-party deb's, but it requires all the package's dependencies, too. Is there a way easier than discovering and downloading them all manually?
Is using the system compiler not an option? That should be the easiest way to proceed

I did not install it. It was available out of box just after OS installation, and no *deb packages were manually installed. For installation of all required packages (like libreadline-dev), I only used sudo apt install with default repos.

For that, I need to be able to reproduce the issue -- which I'm having trouble with, so your help in that would be very welcome.

My OS is Deepin linux, installed from deepin-desktop-community-23-Beta2-amd64.iso available from official site - in case you have time and resources for reproducing it in virtual machine

from pyenv.

Youjin1985 avatar Youjin1985 commented on September 22, 2024

I found this post https://bbs.deepin.org/zh/post/260319, edited file Python/fileutils.c, updated checksum in pyenv script, and all almost compiled, but at very end build fails with

File "/home/youjin/.pyenv/sources/3.11.7/Python-3.11.7/Lib/ensurepip/init.py", line 4, in
import subprocess
File "/home/youjin/.pyenv/sources/3.11.7/Python-3.11.7/Lib/subprocess.py", line 104, in
from _posixsubprocess import fork_exec as _fork_exec
ModuleNotFoundError: No module named '_posixsubprocess'
make: *** [Makefile:1883:install] 错误 1

????

from pyenv.

Youjin1985 avatar Youjin1985 commented on September 22, 2024

Turns out _posixsubprocess module was not compiled because of same reason - error: implicit declaration of function ‘close_range’. After fix from link above 3.11.7 can be compiled.
Please fix the issue by applying patch to all places containing calls of close_range function in python code - I am not sure I can do it myself and pull request.

from pyenv.

native-api avatar native-api commented on September 22, 2024

Looks like a problem with either the compiler toolchain or CPython build logic. The function close_range is found by Configure but somehow not found during actual compilation.
I'll try to reproduce the problem and examine the details when I'm back home.

from pyenv.

Youjin1985 avatar Youjin1985 commented on September 22, 2024

I remember that gcc-12 on another linux distribution was compiling successfully, I got this problem only with gcc-11.2 mentioned above.
(I didn't want to mess with system compiler, so I just used workaround with declaring extern function.)

from pyenv.

native-api avatar native-api commented on September 22, 2024

How did you install the gcc-11 package? Deepin has a "package installer" to install 3rd-party deb's, but it requires all the package's dependencies, too. Is there a way easier than discovering and downloading them all manually?

from pyenv.

native-api avatar native-api commented on September 22, 2024

Okay, I've installed Deepin 13 Beta2 into a VM.
When I installed Pyenv build dependencies as per https://github.com/pyenv/pyenv/wiki#suggested-build-environment , it installed GCC 13 as a dependency, so there isn't an obvious reason to use GCC 11.
Regardless, then I installed GCC 11, and it installed gcc-11 11.4.0-3.

Neither of those had a build problem with 3.11.7.

So I suggest you just upgrade the compiler package and/or the Pyenv dependency packages. (Note: only upgrade those. The distro doesn't seem to be very stable, a full apt upgrade bricked my system; Apt also suggested some packages for autoremove, I didn't do that, either.)

from pyenv.

Youjin1985 avatar Youjin1985 commented on September 22, 2024

I upgraded system gcc to 13.2.0 which is also available, and python compiles without problems

from pyenv.

so1n avatar so1n commented on September 22, 2024

I'm having a similar problem, but my gcc version is 13.2, is there any solution? @native-api @Youjin1985

Here are some of my dependencies:
➜ ~ pyenv --version
pyenv 2.4.3
➜ ~ uname -a
Linux so1n-PC 6.6.25-amd64-desktop-hwe #23.01.00.25 SMP PREEMPT_DYNAMIC Wed Apr 10 21:20:25 CST 2024 x86_64 GNU/Linux
➜ ~ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Deepin 13.2.0-3deepin2' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/usr/src/packages/BUILD/debian/tmp-nvptx/usr,amdgcn-amdhsa=/usr/src/packages/BUILD/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=8
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Deepin 13.2.0-3deepin2)

from pyenv.

native-api avatar native-api commented on September 22, 2024

@so1n Can't say anything without the necessary diagnostic details as per the issue template.

from pyenv.

so1n avatar so1n commented on September 22, 2024

@native-api I'm so sorry and I created an issue (#2988) according to the issue template.

from pyenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.