Skip to content

Need complete statically linked binary #3307

Open
@sanketRmeshram

Description

@sanketRmeshram

Describe the feature

We built the aws static libraries .
But this has lots of dynamic dependencies :

tech@code:~/sanket/aws/aws_standalone$ g++ aws_code.cpp -O3 -DNDEBUG -I /home/tech/sanket/aws/static/aws-sdk-cpp/install/include/  -L /home/tech/sanket/aws/static/aws-sdk-cpp/install/lib/ -laws-cpp-sdk-s3 -laws-cpp-sdk-s3-crt -laws-cpp-sdk-core -laws-crt-cpp -laws-c-mqtt -laws-c-event-stream -laws-c-s3 -laws-c-auth -laws-c-http -laws-c-io -ls2n -laws-c-compression -laws-c-cal -laws-c-sdkutils -laws-checksums -laws-c-common -ldl -lz -lpthread -lcurl -lcrypto
tech@code:~/sanket/aws/aws_standalone$ ldd a.out
        linux-vdso.so.1 (0x00007ffe56013000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007effc609e000)
        libcurl.so.4 => /lib/x86_64-linux-gnu/libcurl.so.4 (0x00007effc5ff7000)
        libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007effc5400000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007effc5000000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007effc5919000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007effc5fd1000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007effc4c00000)
        /lib64/ld-linux-x86-64.so.2 (0x00007effc60c7000)
        libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007effc5fa7000)
        libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007effc58f8000)
        librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007effc58d9000)
        libssh.so.4 => /lib/x86_64-linux-gnu/libssh.so.4 (0x00007effc586c000)
        libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007effc5f91000)
        libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007effc535c000)
        libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007effc5308000)
        libldap-2.5.so.0 => /lib/x86_64-linux-gnu/libldap-2.5.so.0 (0x00007effc52a9000)
        liblber-2.5.so.0 => /lib/x86_64-linux-gnu/liblber-2.5.so.0 (0x00007effc585b000)
        libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007effc4f31000)
        libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007effc584d000)
        libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007effc4a56000)
        libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007effc486b000)
        libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007effc4ee9000)
        libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007effc4ea3000)
        libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007effc47e9000)
        libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007effc471e000)
        libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007effc527a000)
        libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007effc5845000)
        libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007effc4e95000)
        libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007effc4e7a000)
        libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007effc4e57000)
        libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007effc45e3000)
        libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007effc4e3f000)
        libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007effc5271000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007effc4e2b000)
        libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007effc45d6000)
tech@code:~/sanket/aws/aws_standalone$

We want to link all those dependencies statically, so we tried using the -static flag . Getting this error when tried with -static flag :
https://pastebin.com/Z0Gr14q5

Then we tried using https://github.com/stunnel/static-curl to build the static curl library. But ran into many linking issues : https://pastebin.com/P0KZSgik

Use Case

We want a complete statically linked binary for our use case.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions