missingcharacter/termux-dot-files

aws cli pip install error: ld.lld: error: unknown argument '-fatal_warnings', did you mean '-fatal-warnings'

Closed this issue · 8 comments

Following your instructions for installing aws cli on termux, last step produces:

ld.lld: error: unknown argument '-fatal_warnings', did you mean '-fatal-warnings'                               clang-14: error: linker command failed with
exit code 1 (use -v to see invocation)
            error: command '/data/data/com.termux/files/
usr/bin/aarch64-linux-android-clang' failed with exit code 1
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.                          error: legacy-install-failure

      × Encountered error while trying to install packag
e.
      ╰─> awscrt                                                                                                      note: This is an issue with the package mentioned above, not pip.                                               hint: See above for output from the failure.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Using:

11 cd $(mktemp -d)                                            10                                                             9 INFO echo -e "\nAWS CLI\n\t(special method for termux pref    ix env - see https://github.com/awsdocs/aws-cli-user-guide    /issues/11#issuecomment-1141227642)"                        8 yes | pkg install git python rust build-essential           7 git clone -b v2 https://github.com/aws/aws-cli.git          6 cd aws-cli                                                  5 sed -i 's/ruamel.yaml>=0.15.0,<0.16.0/ruamel.yaml>=0.15.0,    <0.17.18/g' setup.cfg                                       4 export CARGO_BUILD_TARGET=aarch64-linux-android             3 # Your phone's architecture must match the build target. T    his target is for android phones with arm64 CPUs (check wi    th 'uname -a' and compare with https://doc.rust-lang.org/r    ustc/platform-support.html).                                2 set -x                                                      1 echo                                                      69  pip install ruamel.yaml==0.17.17                            1 pip install -e .

With:

$ uname -a                              Linux localhost 5.4.147-qgki-24343067-abG998USQS5CVGA #1 SMP PREEMPT Mon Jul 25 18:12:42 KST 2022 aarch64 Android
~ $ pkg show lld                                              Package: lld                                                  Version: 14.0.6-2                                             Maintainer: @buttaface                                        Installed-Size: 15.3 MB                                       Depends: libllvm (= 14.0.6-2)                                 Homepage: https://clang.llvm.org/                             Download-Size: 1930 kB                                        APT-Manual-Installed: no                                      APT-Sources: https://mirror.iscas.ac.cn/termux/apt/termux-main stable/main aarch64 Packages                                 Description: LLVM-based linker                                                                                              ~ $ pkg show clang                                            Package: clang                                                Version: 14.0.6-2                                             Maintainer: @buttaface                                        Installed-Size: 153 MB                                        Depends: libcompiler-rt, lld, llvm, ndk-sysroot, libllvm (= 14.0.6-2)                                                       Breaks: libllvm (<< 11.0.0-1), clangd
Replaces: libllvm (<< 11.0.0-1), clangd                       Homepage: https://clang.llvm.org/
Download-Size: 22.8 MB                                        APT-Manual-Installed: yes
APT-Sources: https://mirror.iscas.ac.cn/termux/apt/termux-main stable/main aarch64 Packages
Description: C language frontend for LLVM

@timblaktu I probably need to update my instructions, awsdocs/aws-cli-user-guide#11 (comment) shows somewhat different way, if this doesn't work I'd love to help you figure this out

Yeah, those are actually the instructions I followed ( The most recent ones from may in that link you sent). ( Sorry about the line formatting problems in my post...).

I'll try to post more information on it Later today.

@missingcharacter I updated my OP to include the full error. The awscrt recipe compiles fine then gets the posted linker error not recognizing linker option '-fatal_warnings', suggesting '-fatal-warnings'. This last linker step is thr only command that includes the problem.option:

            aarch64-linux-android-clang -shared -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r23c-api-24-v0/sysroot/usr/lib -L/data/data/com.termux/files/usr/lib -Wl,-rpath=/data/data/com.termux/files/usr/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--no-as-needed,-landroid-support,--as-needed -L/home/builder/.termux-build/_cache/android-r23c-api-24-v0/sysroot/usr/lib build/temp.linux-aarch64-cpython-310/source/auth_credentials.o build/temp.linux-aarch64-cpython-310/source/auth_signer.o build/temp.linux-aarch64-cpython-310/source/auth_signing_config.o build/temp.linux-aarch64-cpython-310/source/common.o build/temp.linux-aarch64-cpython-310/source/crc.o build/temp.linux-aarch64-cpython-310/source/crypto.o build/temp.linux-aarch64-cpython-310/source/event_stream_headers.o build/temp.linux-aarch64-cpython-310/source/event_stream_rpc_client_connection.o build/temp.linux-aarch64-cpython-310/source/event_stream_rpc_client_continuation.o build/temp.linux-aarch64-cpython-310/source/http_connection.o build/temp.linux-aarch64-cpython-310/source/http_headers.o build/temp.linux-aarch64-cpython-310/source/http_message.o build/temp.linux-aarch64-cpython-310/source/http_proxy.o build/temp.linux-aarch64-cpython-310/source/http_stream.o build/temp.linux-aarch64-cpython-310/source/io.o build/temp.linux-aarch64-cpython-310/source/module.o build/temp.linux-aarch64-cpython-310/source/mqtt_client.o build/temp.linux-aarch64-cpython-310/source/mqtt_client_connection.o build/temp.linux-aarch64-cpython-310/source/pkcs11_lib.o build/temp.linux-aarch64-cpython-310/source/s3_client.o build/temp.linux-aarch64-cpython-310/source/s3_meta_request.o -L/data/data/com.termux/files/usr/lib -Lbuild/temp.linux-aarch64-cpython-310/deps/install/lib -l:libaws-c-s3.a -l:libaws-c-mqtt.a -l:libaws-c-auth.a -l:libaws-c-http.a -l:libaws-c-event-stream.a -l:libaws-c-compression.a -l:libaws-checksums.a -l:libaws-c-io.a -l:libaws-c-cal.a -l:libaws-c-sdkutils.a -l:libaws-c-common.a -l:libs2n.a -l:libcrypto.a -lrt -lpython3.10 -o build/lib.linux-aar
ch64-cpython-310/_awscrt.cpython-310.so -pthread -Wl,-fatal_warnings

I cant grep any reference to either "fatal warning" option in the awscli repo, branch v2 at HEAD commit b06369b1d5b5e98e93974bd4ea714dc024e87850:

.../tmp.Nwh0N3p16Z/aws-cli $ grep -rE "fatal*warnings"    
.../tmp.Nwh0N3p16Z/aws-cli $

So i'm guessing this is a problem with my local termux clang or lld package. Ill try to go deeper to see where these linker options are being set.

You have any bright ideas?

Edit: i dont see any reference to this linker option in llvm's lld nor gnu ld. Hmm...

Also im using python 3.10.6 and newer awscli v2 commit. Maybe you can try to repro in your environment to upgrade your awscli?

@timblaktu I was able to reproduce:

$ pkg upgrade
$ pkg install -y rust
$ python -m venv newvenv
$ source newvenv/bin/activate
$ git clone -b v2 https://github.com/aws/aws-cli.git new-aws-cli
$ cd new-aws-cli
$ pip install --upgrade pip
$ pip install ruamel.yaml==0.17.17
$ pip install -e .

Let me see if I can fix it

@missingcharacter turns out this is just a bug in awscrt python project, reported a couple months ago..

awslabs/aws-crt-python#366

Ill try to track down the commit that added this bogus linker argument and try to build the previous version, or fork and fix..

Edit: bullseye

@timblaktu I was able to build with these instructions, let me know if these work and I'll update my docs

$ pkg upgrade
$ pkg install -y rust
$ python -m venv newvenv
$ source newvenv/bin/activate
$ git clone -b v2 https://github.com/aws/aws-cli.git new-aws-cli
$ cd new-aws-cli
$ pip install --upgrade pip
$ pip install ruamel.yaml==0.17.17
$ pip install awscrt==0.13.0
$ vim setup.cfg
$  git diff
diff --git a/setup.cfg b/setup.cfg                                 index 91abf8b80..30dcf0048 100644                                  --- a/setup.cfg                                                    
+++ b/setup.cfg                                                    @@ -36,7 +36,7 @@ install_requires =
wcwidth<0.2.0                                                      prompt-toolkit>=3.0.24,<3.0.29                                     distro>=1.5.0,<1.6.0
-    awscrt>=0.12.4,<=0.14.0
+    awscrt==0.13.0                   
python-dateutil>=2.1,<3.0.0
jmespath>=0.7.1,<1.1.0
urllib3>=1.25.4,<1.27
$ pip install -e .
$  aws --version                                                   aws-cli/2.7.29 Python/3.10.6 Linux/5.10.107-android13-4-00008-g466e95df8c7c-ab8760753 source/aarch64 prompt/off

@missingcharacter Oh i see you used an old version of awscrt. You could also pre-imstall the awscrt dependency from my fork to get a newer version that works, using:

pip install git+https://github.com/timblaktu/aws-crt-python.git@bugfix366-fatal_warnings-linker-typo                    Collecting git+https://github.com/timblaktu/aws-crt-python.git@bugfix366-fatal_warnings-linker-typo                           Cloning https://github.com/timblaktu/aws-crt-python.git (to revision bugfix366-fatal_warnings-linker-typo) to /data/data/com.termux/files/usr/tmp/pip-req-build-x364gu7h                  Running command git clone --filter=blob:none --quiet https://github.com/timblaktu/aws-crt-python.git /data/data/com.termux/files/usr/tmp/pip-req-build-x364gu7h                           Running command git checkout -b bugfix366-fatal_warnings-linker-typo --track origin/bugfix366-fatal_warnings-linker-typo    Switched to a new branch 'bugfix366-fatal_warnings-linker-typo'                                                             branch 'bugfix366-fatal_warnings-linker-typo' set up to track 'origin/bugfix366-fatal_warnings-linker-typo'.                Resolved https://github.com/timblaktu/aws-crt-python.git to commit 9cbbd1b8ef7a2843de9aea54db13f79ef8d45a9f                 Running command git submodule update --init --recursive -q    Preparing metadata (setup.py) ... done                      Using legacy 'setup.py install' for awscrt, since package 'wheel' is not installed.                                         Installing collected packages: awscrt                           Running setup.py install for awscrt ... done                Successfully installed awscrt-1.0.0.dev0

Wow, the state of python packaging is really messy. (Its been a while for me). So...

@missingcharacter, I was able to get my fork/branch working with the latest awscli version by modifying awscli's setup.py using:

sed -i 's/awscrt.*$/''awscrt @ git+ssh:\/\/git@github.com\/timblaktu\/aws-crt-python@366-localtest''/g' setup.cfg

Once they merge the awscrt PR, we can remove this hack..