Search code examples
python-3.xarmapple-m1

Cannot install python 3.10.0 on m1 Apple silicon - ld: symbol(s) not found for architecture x86_64


I am trying to get python 3.10.0 installed on my Apple M1 Silicon.

Installing via asdf venv manager. 3.7.9 and 3.9.4 work without any issues but installing 3.10.0 causes the following error:

Last 10 log lines:
  "_libintl_textdomain", referenced from:
      __locale_textdomain in libpython3.10.a(_localemodule.o)
      __locale_textdomain in libpython3.10.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: clangerror: linker command failed with exit code 1 (use -v to see invocation)
: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1

cmake version 3.22.0

Apple clang version 13.0.0 (clang-1300.0.29.3) Target: x86_64-apple-darwin21.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

What I tried:

export ARCHFLAGS="-arch arm64"

and all the suggestions from

Can't install Python 3.10.0 with pyenv on MacOS

Thank you so much in advance, it's driving me nuts :-)


Solution

    1. First install gettext:
    brew install gettext
    
    1. Then export flags:
    export LDFLAGS="-L/opt/homebrew/lib"; export CPPFLAGS="-I/opt/homebrew/include"
    
    1. Finaly install python:
    pyenv install 3.10.0
    

    It worked for me. I found it here https://github.com/pyenv/pyenv/issues/1877#issuecomment-962514298