Repository navigation
Readline issues on new install of FreeBSD 13.1 #2585
Copy link
Copy link
Description
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
pyenvand the defaultpython-buildplugin only. Please refrain from reporting issues of other plugins here.
- This repository is maintaining
Description
- Platform information (e.g. Ubuntu Linux 16.04):
FreeBSD 13.1-RELEASE-p3 - OS architecture (e.g. amd64):
amd64 - pyenv version:
pyenv 2.3.9 - Python version:
Python 3.9.16 (installed via pkg) - C Compiler information (e.g. gcc 7.3):
FreeBSD clang version 13.0.0 - Please attach the debug trace of the failing command as a gist:
- Run
env PYENV_DEBUG=1 <faulty command> 2>&1 | tee trace.logand attachtrace.log. E.g. if you have a problem with installing Python, runenv PYENV_DEBUG=1 pyenv install -v <version> 2>&1 | tee trace.log(note the-voption topyenv install).
- Run
Recently provisioned a remote VPS on FreeBSD 13.1 and wanted to give pyenv a whirl. Seems I'm hit with readline issues. I attempted to install readline libs, but what I believe to be happening is that pyenv make cannot resolve readline. Here is what I performed:
- installed pyenv via bash script
- Ran:
pyenv install 3.11.1
Errors reported:
pyenv: /home/blogger/.pyenv/versions/3.11.1 already exists
continue with installation? (y/N) y
Downloading Python-3.11.1.tar.xz...
-> https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tar.xz
Installing Python-3.11.1...
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/blogger/.pyenv/versions/3.11.1/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/home/blogger/.pyenv/versions/3.11.1/lib/python3.11/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Installed Python-3.11.1 to /home/blogger/.pyenv/versions/3.11.1
Packages installed:
# pkg info | grep -i read
readline-8.2.0 Library for editing command lines as they are typed
tclreadline-2.3.8 GNU readline for TCL
What I believe is happening is that GNU readline requirement is not being read properly as the output shows:
checking how to link readline libs... none
Debug log attached.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
native-api commentedon Jan 6, 2023
Could you please also attach
config.logfrom the build directory?Do you have Readline development headers and lib files installed? Through what means? (I dunno if BSD have package managers. I know they have "ports" which are kinda that and may need additional compiler flags to link against.)
dcontiveros commentedon Jan 6, 2023
The
config.logfile does not appear to be created:[~/.pyenv] $ find . | grep config.log(returns no results)I made sure to install readline libs using pkg command as stated in my first update. Just to be sure, I logged on and verified:
native-api commentedon Jan 7, 2023
config.logis in the build directory under/tmp. In the log, it's/tmp/python-build.20230106142056.35755.dcontiveros commentedon Jan 7, 2023
Log attached.
python-build.20230107112237.54254.log
native-api commentedon Jan 7, 2023
I said
config.log, not the build log.It should be under the build directory, e.g.
/tmp/python-build.20230106142056.35755/config.log.dcontiveros commentedon Jan 7, 2023
I removed all files from /tmp and this is the only log that is being generated.
native-api commentedon Jan 7, 2023
Oh, that's right. Your build succeeds, so the build path is being removed.
Please run
pyenv installwith-kto keep it.dcontiveros commentedon Jan 7, 2023
It appears
config.logwas generated in another location with the-kswitch:Please see attached. I am seeing linker errors, so am assuming would need to append something to either LDFLAGS or CFLAGS. Let me know.
config.log
native-api commentedon Jan 7, 2023
Okay, it looks like unlike Linux, in BSD, the compiler is configured to not look in
/usr/local/by default:native-api commentedon Jan 7, 2023
Could you test the codebase from https://github.com/native-api/pyenv/tree/use_freebsd_ports ?
dcontiveros commentedon Jan 7, 2023
Using your code tree the latest python available is
3.9.7. Is there anyway I can test3.11.1?native-api commentedon Jan 7, 2023
Use the
use_freebsd_portsbranchdcontiveros commentedon Jan 7, 2023
Same error. Looks like the same output:
I rebuilt to regenerate relevant logs. Please see attached.
config.log
native-api commentedon Jan 7, 2023
Okay, I was able to set up a FreeBSD VM and reproduce the issue.
It turns out, you don't have
pkg-configinstalled.Which, counterintuitively, is in the
pkgconfPorts package.All ports modules have
.pcfiles that allow to locate them usingpkg-config(which Python's Configure uses as well).We can still add compiler flags for the case when
readlinepackage is installed andpkg-configis missing.I've checked that either way works.
dcontiveros commentedon Jan 8, 2023
Great find. I installed
pkgconf, the replacement forpkg-configbut still getting a failure. I'm not using any ports and do not even have the ports tree populated, only binary pacckages. I'm still receiving the error. Please see config.log.config.log
1 remaining item
dcontiveros commentedon Jan 8, 2023
Ok this seems to have gotten me past readline:
Let me get sqlite up before we close this. Would love a complete build. Thanks!
dcontiveros commentedon Jan 8, 2023
I'm wondering if there needs to be some pkgconf optimizations to look for libraries in /usr/local/lib:
Is there a way to get the build script to use pkgconf/pkg-config by default on FreeBSD?
native-api commentedon Jan 8, 2023
CPython's Configure is supposed to already be using
pkg-configto locate libraries.dcontiveros commentedon Jan 8, 2023
Ok troubleshooting this further, with the
pkgconf/pkg-configcommands it seems the build script expects sqlite3. The version I had installed wassqlite, which defaults to 2 on FreeBSD.I think we are good here. Believe we can close this. Definitely appreciate your help. One last question, will these changes be merged into master pyenv?
dcontiveros commentedon Jan 10, 2023
I grabbed latest merge today,
2369ac2a089e1afaf61753ee1d4bc08b80c1ace7and I receive the same readline error, although sqlite is fine. I cannot compare the tree with master since it has been deleted. Can we double check?config.log
dcontiveros commentedon Jan 10, 2023
Testing with
2.3.10dcontiveros commentedon Jan 10, 2023
Same readline error. Please reopen.
native-api commentedon Jan 13, 2023
Okay, it turns out that -- surprisingly enough -- Python's Configure does NOT use pkg-config to locate Readline.
And the PR's code only worked because my invocation for
command -v pkg-configwas broken! So when I fixed it when merging...dcontiveros commentedon Jan 13, 2023
I have been testing on a new VM and it does appear that the crux of this issue is python not using pkg-config for readLine.
Interestingly enough, specifying libedit does allow it to build, as well as setting flags manually. I believe the only way around this would be to just set the flags in the previous fix if FreeBSD is detected. I did read up on this and it does appear that you are correct in that tool chains don't look at /usr/local.
What really bothers me about this is that there IS a readline.pc file available in PKG_CONFIG_PATH. Think only this could be fixed upstream.
native-api commentedon Jan 13, 2023
I've tested that https://github.com/native-api/pyenv/tree/fix_freebsd fixes the probem for me (the URL means https://github.com/native-api/pyenv repo,
fix_freebsdbranch). Could you confirm?native-api commentedon Jan 13, 2023
Yes, this is an upstream problem.
They already fixed it in
3.12.0a1.dcontiveros commentedon Jan 13, 2023
Ok this branch works. I have also confirmed
pkg info -e libreturns 0, so it should pass that test.