-
-
Save orip/00142a498cf6d0c536b5d38771ad6249 to your computer and use it in GitHub Desktop.
diff --git a/Python/random.c b/Python/random.c | |
index 93d300d..396041d 100644 | |
--- a/Python/random.c | |
+++ b/Python/random.c | |
@@ -3,6 +3,9 @@ | |
#include <windows.h> | |
#else | |
#include <fcntl.h> | |
+#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) | |
+#include <sys/random.h> | |
+#endif | |
#ifdef HAVE_SYS_STAT_H | |
#include <sys/stat.h> | |
#endif |
@karthicraghupathi Thanks! This helped immensely.
@karthicraghupathi i am still getting same issue although i am trying to install on M1 architecture. Any fix for M1 big sur?
@benbenbuhben You're welcome.
@srini-akhil Multiple issues have been described on this page. What exactly are you running into? Posting logs will help someone assist you.
@benbenbuhben You're welcome.
@srini-akhil Multiple issues have been described on this page. What exactly are you running into? Posting logs will help someone assist you.
ASDF_PYTHON_PATCH_URL="https://gist.githubusercontent.com/karthicraghupathi/da7bccec3bce904ad081d06efea4a607/raw/e1d81c611ea44bbca114495fbc6e8458417b8313/Python-3.4.3-macos.patch" \
arch -x86_64 asdf install python 3.4.3
python-build --patch 3.4.3 /Users/srini/.asdf/installs/python/3.4.3
with patch file from: https://gist.githubusercontent.com/karthicraghupathi/da7bccec3bce904ad081d06efea4a607/raw/e1d81c611ea44bbca114495fbc6e8458417b8313/Python-3.4.3-macos.patch
Downloading openssl-1.0.2k.tar.gz...
-> https://pyenv.github.io/pythons/6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0
Installing openssl-1.0.2k...
Installed openssl-1.0.2k to /Users/srini/.asdf/installs/python/3.4.3
python-build: use readline from homebrew
Downloading Python-3.4.3.tar.xz...
-> https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz
Installing Python-3.4.3...
patching file Python/random.c
patching file Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
patching file configure
Hunk #1 succeeded at 3419 (offset -7 lines).
patching file configure.ac
Hunk #1 succeeded at 489 (offset -21 lines).
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
ERROR: The Python zlib extension was not compiled. Missing the zlib?
Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems
BUILD FAILED (OS X 11.2.3 using python-build 2.0.1-5-gbbcecc75)
Inspect or clean up the working tree at /var/folders/wz/khb2wmws78131mb3nmx1hkph0000gp/T/python-build.20210618111355.15602
Results logged to /var/folders/wz/khb2wmws78131mb3nmx1hkph0000gp/T/python-build.20210618111355.15602.log
Last 10 log lines:
./python.exe -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Collecting pip
Installing collected packages: pip, setuptools
Successfully installed pip-6.0.8 setuptools-12.0.5
although i have installed zlib library using brew and exported paths as per documentation as well but still i keep on getting this
Anyone installed python 3.4 on M1 Big sur can u pls help
@srini-akhil The documentation suggest setting up CPPFLAGS
and LDFLAGS
to solve the problem of missing libraries. So if you have installed zlib
and readline
using brew
, you might have to try something like this:
ASDF_PYTHON_PATCH_URL="https://gist.githubusercontent.com/karthicraghupathi/da7bccec3bce904ad081d06efea4a607/raw/e1d81c611ea44bbca114495fbc6e8458417b8313/Python-3.4.3-macos.patch" \
arch -x86_64 \
CPPFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix readline)/include" \
LDFLAGS="-L$(brew --prefix readline)/lib" \
asdf install python 3.4.3
YMMV. Keep trying a bunch of things. All the best.
For those, who happen to have aria2c
installed: you have to uninstall it as well, since it requires OpenSSL 1.1 to function properly. I did that, then I ran pyenv install
with Karthic's patch, and it worked flawlessly.
In the end, this is what I had to execute:
$ brew uninstall --ignore-dependencies --force openssl@1.1
Uninstalling openssl@1.1... (8,073 files, 18.5MB)
$ brew uninstall --ignore-dependencies --force aria2
Uninstalling aria2... (23 files, 4.0MB)
$ pyenv install 3.4.10 --patch < Python-3.4.3-macos.patch # this file I downloaded to my computer
Downloading openssl-1.0.2k.tar.gz...
# output omitted here
Installed Python-3.4.10 to [REDACTED]
$ pyenv versions
system
* 2.7.18 (set by [REDACTED])
3.4.10
3.6.14
* 3.9.6 (set by [REDACTED])
$ brew install openssl@1.1 aria2
Updating Homebrew...
# output omitted here
🍺 /usr/local/Cellar/openssl@1.1/1.1.1l: 8,073 files, 18.5MB
# output omitted here
🍺 /usr/local/Cellar/aria2/1.36.0: 23 files, 4.0MB
$ pyenv shell 3.4.10
$ python --version
Python 3.4.10
@srini-akhil Were you able to resolve? I have a similar issue and I tried what @karthicraghupathi suggested in this comment with no luck
python-build: use openssl from homebrew
python-build: use readline from homebrew
Installing Python-3.4.3...
patching file Python/random.c
patching file Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
patching file configure
Hunk #1 succeeded at 3419 (offset -7 lines).
patching file configure.ac
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 489 with fuzz 1 (offset -21 lines).
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?
Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems
BUILD FAILED (OS X 11.3.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/qf/7_n2v5yn74789h69s0rv2mn40000gp/T/python-build.20211110174308.82264
Results logged to /var/folders/qf/7_n2v5yn74789h69s0rv2mn40000gp/T/python-build.20211110174308.82264.log
Last 10 log lines:
(cd /Users/duncan.tormey/.pyenv/versions/3.4.3/share/man/man1; ln -s python3.4.1 python3.1)
if test "xupgrade" != "xno" ; then \
case upgrade in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
./python.exe -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS```
I got it to work. I had to do this, notice the lack of a version stamp
brew uninstall --ignore-dependencies --force openssl
Then...
brew reinstall zlib
and finally.
CPPFLAGS="-I/usr/local/opt/zlib/include -I$(brew --prefix readline)/include" LDFLAGS="-L$(brew --prefix readline)/lib -L/usr/local/opt/zlib/lib" pyenv install 3.4.3 --patch < Python-3.4.3-macos.patch
Where Python-3.4.3-macos.path is @karthicraghupathi version (thank you so much).
diff --git a/Python/random.c b/Python/random.c
index 93d300d..396041d 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -3,6 +3,9 @@
#include <windows.h>
#else
#include <fcntl.h>
+#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY)
+#include <sys/random.h>
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
diff --git a/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst b/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
new file mode 100644
index 0000000000000..ded66b567a92d
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2020-06-24-13-51-57.bpo-41100.mcHdc5.rst
@@ -0,0 +1 @@
+Support macOS 11 when building.
diff --git a/configure b/configure
index c51f396824b63..5024860ca4395 100755
--- a/configure
+++ b/configure
@@ -3426,7 +3426,7 @@ $as_echo "#define _BSD_SOURCE 1" >>confdefs.h
# has no effect, don't bother defining them
Darwin/[6789].*)
define_xopen_source=no;;
- Darwin/1[0-9].*)
+ Darwin/[12][0-9].*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
diff --git a/configure.ac b/configure.ac
index 70deefb6b9aea..5a3e340aa3e72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,7 +510,7 @@ case $ac_sys_system/$ac_sys_release in
# has no effect, don't bother defining them
Darwin/@<:@6789@:>@.*)
define_xopen_source=no;;
- Darwin/1@<:@0-9@:>@.*)
+ Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
define_xopen_source=no;;
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
Thanks everyone! I would have been lost without this page. Afterwords i reinstalled openssl.
@DuncanTormey your solution was the only one that worked for me (I did it with 3.4.10 btw). Thank you 💪
@DuncanTormey, your solution was the only one that worked for me too..... thank you so much!!
@DuncanTormey your solution was only one that worked for me too.... thank you sooooo much
Thanks. I was hoping to avoid uninstalling OpenSSL as re-installing it would mean
brew
would update all dependent packages because the new OpenSSL version would be newer than what I'm uninstalling. But having come this far, I went ahead and tried it anyway just to see if I could successfully install Python 3.4.10 and guess what: IT WORKED.The only thing I want to draw attention to is to use the
--force
option when uninstalling OpenSSL to ensure all versions are removed as indicated bybrew
.