Azure / azure-sdk-for-cpp

This repository is for active development of the Azure SDK for C++. For consumers of the SDK we recommend visiting our versioned developer docs at https://azure.github.io/azure-sdk-for-cpp.
MIT License
174 stars 124 forks source link

Warnings in `azure/identity.hpp` cause strict builds to fail #5235

Open anjakefala opened 8 months ago

anjakefala commented 8 months ago

Describe the bug I don't necessarily model this as a bug. This did affect my ability to build a project that had azure as a Third Party Dependency (https://github.com/apache/arrow/issues/39384), and so I wanted to let you know.

Essentially, azure/identity.hpp emitted a warning about visibility, that caused any strict build of Arrow to fail.

In the end Apache Arrow employed a workaround, where it ignores -Wattributes in azure/identity.hpp: https://github.com/apache/arrow/pull/39448/files

Exception or Stack Trace

[41/821] Building CXX object _deps/azure_sdk-build/sdk/identity/azure-identity/CMakeFiles/azure-identity.dir/src/client_certificate_credential.cpp.o                       
In file included from /home/anja/git/arrow/cpp/build/anja-python-debug/_deps/azure_sdk-src/sdk/identity/azure-identity/src/client_certificate_credential.cpp:4:            
/home/anja/git/arrow/cpp/build/anja-python-debug/_deps/azure_sdk-src/sdk/identity/azure-identity/inc/azure/identity/client_certificate_credential.hpp:68:9: warning: 'Azure
::Identity::ClientCertificateCredential' declared with greater visibility than the type of its field 'Azure::Identity::ClientCertificateCredential::m_pkey' [-Wattributes] 
   68 |   class ClientCertificateCredential final : public Core::Credentials::TokenCredential {                                                                            
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                
[45/821] Building CXX object _deps/azure_sdk-build/sdk/identity/azure-identity/CMakeFiles/azure-identity.dir/src/environment_credential.cpp.o                              
In file included from /home/anja/git/arrow/cpp/build/anja-python-debug/_deps/azure_sdk-src/sdk/identity/azure-identity/src/environment_credential.cpp:6:                   
/home/anja/git/arrow/cpp/build/anja-python-debug/_deps/azure_sdk-src/sdk/identity/azure-identity/inc/azure/identity/client_certificate_credential.hpp:68:9: warning: 'Azure
::Identity::ClientCertificateCredential' declared with greater visibility than the type of its field 'Azure::Identity::ClientCertificateCredential::m_pkey' [-Wattributes] 
   68 |   class ClientCertificateCredential final : public Core::Credentials::TokenCredential {     

To Reproduce Unfortunately, the way I bumped into this was by attempting to build Arrow, and then it would install a bundled version of Azure SDK. I am hoping the stacktrace will help.

If it helps, this is my Arrow CMakeUserPresets.json:

{
    "version": 3,
    "cmakeMinimumRequired": {
      "major": 3,
      "minor": 21,
      "patch": 0
    },
    "configurePresets": [
        {
            "name": "user-base",
            "hidden": true,
            "binaryDir": "${sourceDir}/build/${presetName}",
            "cacheVariables": {
              "ARROW_INSTALL_NAME_RPATH": "OFF"
            }
        },
        {
            "name": "anja-python-debug",
            "inherits": ["ninja-debug-python", "features-filesystems", "user-base"],
            "cacheVariables": {
                "CMAKE_INSTALL_PREFIX": "/home/anja/miniconda3/envs/pyarrow-dev",
                "CMAKE_CXX_STANDARD": "17",
                 "Azure_SOURCE":"BUNDLED",
               "ARROW_BUILD_EXAMPLES": "ON",
                "ARROW_FILESYSTEM": "ON"
            }
        }
    ]
}

Code Snippet See reproduction!

Expected behavior No warnings.

Setup (please complete the following information):

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

kou commented 8 months ago

@anjakefala Could you also provide command lines to reproduce this something like the following?

$ git clone --recursive https://github.com/apache/arrow.git
$ cd arrow
$ cmake ...
...
ahsonkhan commented 8 months ago

Looking at the workaround here, it looks like this issue comes up when using the GCC compiler. Is that correct? What version of the compiler is being used that triggers the error?

I would like to be able to locally reproduce this strict warning when building the SDK.

anjakefala commented 8 months ago

This is my version of gcc!

anja@x86_64-conda-linux-gnu:~/git/arrow|kef/39385⚡ ⇒  gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

These are the instructions I followed to clone and build Arrow: https://www.datawill.io/posts/apache-arrow-development-cpp-conda-macos/ . Except where it mentions the CMakeUsersPreset, I used the above one.

Importantly, I installed the Arrow dependencies using conda on a Linux machine. Folks who installed on MacOS, or did not use Conda, did not see the Warning.