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

Build errors using a Samba user (Bad file Descriptor + C compiler cannot create executables) on Arch #3100

Open
12 of 13 tasks
pterrien opened this issue Nov 1, 2024 · 2 comments

Comments

@pterrien
Copy link

pterrien commented Nov 1, 2024

Too many issues will kill our team's development velocity, drastically.
Make sure you have checked all steps below.

Prerequisite

  • Make sure your problem is not listed in the common build problems.
  • Make sure no duplicated issue has already been reported in the pyenv issues. You should look for closed issues, too.
  • Make sure you are not asking us to help solving your specific issue.
    • GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like Gitter, StackOverflow, etc.
  • Make sure your problem is not derived from packaging (e.g. Homebrew).
    • Please refer to the package documentation for the installation issues, etc.
  • Make sure your problem is not derived from plugins.
    • This repository is maintaining pyenv and the default python-build plugin only. Please refrain from reporting issues of other plugins here.

Description

  • Platform information (e.g. Ubuntu Linux 16.04): Arch
  • OS architecture (e.g. amd64): x86_64
  • pyenv version: 2.4.17
  • Python version: any version CPython I tried to install failed, this example is about v3.10.15
  • C Compiler information (e.g. gcc 7.3): gcc 14.2.1 20240910
  • Please attach the debug trace of the failing command as a gist:
    • Run env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.log and attach trace.log. E.g. if you have a problem with installing Python, run env PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log (note the -v option to pyenv install).
  • If you have a problem with installing Python, please also attach config.log from the build directory
    • The build directory is reported after the "BUILD FAILED" message and is usually under /tmp.
  • If the build succeeds but the problem is still with the build process (e.g. the resulting Python is missing a feature), please attach
    • the debug trace from reinstalling the faulty version with env PYENV_DEBUG=1 pyenv install -f -k -v <version> 2>&1 | tee trace.log
    • config.log from the build directory. When using pyenv install with -k as per above, the build directory will be under $PYENV_ROOT/sources.

Hi,

After many hours trying to fix my problem without success, I hope you will be able to help me.

Overview:

More details in this gist

Basically, I encounter this error:

$ pyenv install 3.10
Downloading Python-3.10.15.tar.xz...
-> https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz
Installing Python-3.10.15...

BUILD FAILED (Arch Linux using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20241101205203.9933
Results logged to /tmp/python-build.20241101205203.9933.log

Last 10 log lines:
./configure: line 3936: 5: Bad file descriptor
./configure: line 3936: 5: Bad file descriptor
./configure: line 3936: 5: Bad file descriptor
./configure: line 3936: 5: Bad file descriptor
checking whether the C compiler works... ./configure: line 3983: 5: Bad file descriptor
no
./configure: line 4026: 5: Bad file descriptor
configure: error: in `/tmp/python-build.20241101205203.9933/Python-3.10.15':
configure: error: C compiler cannot create executables
See `config.log' for more details

What I tried:

Reading these 2 comments (1 and 2), I fully understand my issue is linked to the compiler so I also:

  • ensured no env var may impact GCC, according to this page on gnu.org
  • tried to run ./configure directly from the folder (it works)
  • reinstall the relevant packages, tried to increase the limit of opened files, tried with a different compiler (GCC 13, clang) -> no change
  • I never use gcc myself, so it's quite unlikely I messed with its config or so

Conclusions:

I'm sorry to bother you with that issue that is probably not linked to pyenv directly, but I would be very grateful if you can help me, or guide me to investigate further, as I must admit I'm a bit lost...

Thanks in advance for help.

@pterrien
Copy link
Author

pterrien commented Nov 1, 2024

I forgot to mention: my user is a Samba user. Just to see, I tried to set the flags described for OpenSSL, with not luck.
But I just did a test by running pyenv with root, and this time it works!

So I still have no clue on how to perform pyenv install with my normal user, but I wonder: as a workaround, could I just:

  • copy/chown the files from my root pyenv folder to my normal user?
    • I see that the shims files contain export PYENV_ROOT="/root/.pyenv", so would it be just a matter of replacing that value in all of those?
  • or even simpler: just set the same PYENV_ROOT for both users, and perform install/uninstall with root only? After all, the files in the pyenv folder are just meant to be read, and not write will happen after install?

@pterrien pterrien changed the title Build errors (Bad file Descriptor + C compiler cannot create executables) on Arch Build errors using a Samba user (Bad file Descriptor + C compiler cannot create executables) on Arch Nov 1, 2024
@native-api
Copy link
Member

The problem is definitely with the descriptor 5. The compiler problem seems to be a corollary.

I suggest to run the entire thing with strace -f and see the system calls related to that file descriptor, and, for the compiler's process, with standard descriptors.

I also suggest to save the following patch:

diff --git a/configure b/configure
index 4b71c4e00f8..6c108a8c9d5 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,6 @@
-#! /bin/sh
+#! /bin/bash
+export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
+set -x
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.69 for python 3.10.
 #

and run the installation like pyenv install -p -k -f 3.10.15 <path_to_patch and seeing the build log. It should contain the trace of configure execution, showing where exactly the "bad file descriptor" errors occur.

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