Skip to content

ZLib declared as optional depencency while in fact it is mandatory #3701

@DSysoletin

Description

@DSysoletin

Describe the bug

Hello!
While Readme states ZLib is optional and required only in certain cases, in fact build will fail on Linux if there is no ZLib in the system. This happens because in file external_dependencies.cmake we have check if platform is NOT windows and it is NOT custom - then throw an error if ZLib is not found, even if -DENABLE_ZLIB_REQUEST_COMPRESSION is set to "OFF" or just absent.
This seems like a bug because if this dependency is optional and we don't use features that require ZLib - build should not fail because of "Could not find zlib".

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Build on Linux without -DENABLE_ZLIB_REQUEST_COMPRESSION flag OR with -DENABLE_ZLIB_REQUEST_COMPRESSION="OFF" should pass even if there is no ZLib in the build system(container).

Current Behavior

Build on Linux will fail if there is no ZLib in the build system(container).

Reproduction Steps

  1. Use Docker based on Ubuntu 20.04
  2. cd /tmp && git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp && cd ./aws-sdk-cpp && mkdir build && cd ./build
  3. cmake ..
    -DCMAKE_C_COMPILER=arm-none-linux-gnueabihf-gcc
    -DCMAKE_CXX_COMPILER=arm-none-linux-gnueabihf-g++
    -DBUILD_ONLY="s3"
    -DENABLE_ZLIB_REQUEST_COMPRESSION=OFF
    -DCMAKE_CROSSCOMPILING=TRUE

Possible Solution

Alter checks in external_dependencies.cmake file to take -DENABLE_ZLIB_REQUEST_COMPRESSION flag into account.

Additional Information/Context

This is only observed during cross-compiling when we don't have zlib in cross-compilation sysroot. This is NOT observed on normal (non-cross) compilation because zilb from the host is used.

AWS CPP SDK version used

1.11.733

Compiler and Version used

It fails on CMake phase, not on compile phase

Operating System and version

Ubuntu 20.04 (dockerized)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions