aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

no matching constructor for initialization of 'Aws::Crt::Auth::Credentials'

Open ambitslix opened this issue 1 year ago • 1 comments

Describe the bug

During cmake make step C++ compiler errors in S3CrtClient.cpp:

Expected Behavior

Should build without such errors.

Current Behavior

cmake -DCMAKE_PREFIX_PATH=/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/local -Bbuild -Haws-sdk-cpp

Ubuntu:

[ 79%] Building CXX object aws-cpp-sdk-s3-crt/CMakeFiles/aws-cpp-sdk-s3-crt.dir/ub_S3-CRT.cpp.o
cd /build/Linux_x86_64_Release_Native/aws-sdk-cpp/aws-cpp-sdk-s3-crt && /usr/bin/clang++ -DAWS_MQTT_WITH_WEBSOCKETS -DAWS_SDK_VERSION_MAJOR=1 -DAWS_SDK_VERSION_MINOR=9 -DAWS_SDK_VERSION_PATCH=362 -DAWS_USE_EPOLL -DENABLE_CURL_CLIENT -DENABLE_OPENSSL_ENCRYPTION -DHAS_PATHCONF -DHAS_UMASK -DPLATFORM_LINUX @CMakeFiles/aws-cpp-sdk-s3-crt.dir/includes_CXX.rsp -O3 -DNDEBUG -fno-exceptions -std=c++11 -fPIC -Wall -Werror -pedantic -Wextra -DS2N_SIKE_P434_R3_ASM -DS2N_BIKE_R3_AVX2 -DS2N_BIKE_R3_AVX512 -DS2N_BIKE_R3_PCLMUL -DS2N_BIKE_R3_VPCLMUL -DS2N_KYBER512R3_AVX2_BMI2 -DS2N_ADX -DS2N_HAVE_EXECINFO -DS2N_CPUID_AVAILABLE -DS2N_FALL_THROUGH_SUPPORTED -DS2N___RESTRICT__SUPPORTED -MD -MT aws-cpp-sdk-s3-crt/CMakeFiles/aws-cpp-sdk-s3-crt.dir/ub_S3-CRT.cpp.o -MF CMakeFiles/aws-cpp-sdk-s3-crt.dir/ub_S3-CRT.cpp.o.d -o CMakeFiles/aws-cpp-sdk-s3-crt.dir/ub_S3-CRT.cpp.o -c /build/Linux_x86_64_Release_Native/aws-sdk-cpp/aws-cpp-sdk-s3-crt/ub_S3-CRT.cpp
In file included from /build/Linux_x86_64_Release_Native/aws-sdk-cpp/aws-cpp-sdk-s3-crt/ub_S3-CRT.cpp:2:
In file included from /src/aws-sdk-cpp/aws-cpp-sdk-s3-crt/source/S3CrtARN.cpp:7:
In file included from /src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/Region.h:10:
In file included from /src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSString.h:10:
In file included from /src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h:11:
In file included from /src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/AWSMemory.h:13:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/memory:64:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/allocator.h:46:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11/bits/c++allocator.h:33:
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/new_allocator.h:162:23: error: no matching constructor for initialization of 'Aws::Crt::Auth::Credentials'
        { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
                             ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/alloc_traits.h:516:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<Aws::Crt::Auth::Credentials>::construct<Aws::Crt::Auth::Credentials>' requested here
          __a.construct(__p, std::forward<_Args>(__args)...);
              ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:519:30: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<Aws::Crt::Auth::Credentials>>::construct<Aws::Crt::Auth::Credentials>' requested here
          allocator_traits<_Alloc>::construct(__a, _M_ptr(),
                                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:651:6: note: in instantiation of function template specialization 'std::_Sp_counted_ptr_inplace<Aws::Crt::Auth::Credentials, std::allocator<Aws::Crt::Auth::Credentials>, __gnu_cxx::_S_atomic>::_Sp_counted_ptr_inplace<>' requested here
            _Sp_cp_type(__a._M_a, std::forward<_Args>(__args)...);
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1342:14: note: in instantiation of function template specialization 'std::__shared_count<__gnu_cxx::_S_atomic>::__shared_count<Aws::Crt::Auth::Credentials, std::allocator<Aws::Crt::Auth::Credentials>>' requested here
        : _M_ptr(), _M_refcount(_M_ptr, __tag, std::forward<_Args>(__args)...)
                    ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:409:4: note: in instantiation of function template specialization 'std::__shared_ptr<Aws::Crt::Auth::Credentials, __gnu_cxx::_S_atomic>::__shared_ptr<std::allocator<Aws::Crt::Auth::Credentials>>' requested here
        : __shared_ptr<_Tp>(__tag, std::forward<_Args>(__args)...)
          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:862:14: note: in instantiation of function template specialization 'std::shared_ptr<Aws::Crt::Auth::Credentials>::shared_ptr<std::allocator<Aws::Crt::Auth::Credentials>>' requested here
      return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{__a},
             ^
/src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/AWSAllocator.h:51:21: note: in instantiation of function template specialization 'std::allocate_shared<Aws::Crt::Auth::Credentials, std::allocator<Aws::Crt::Auth::Credentials>>' requested here
        return std::allocate_shared<T, Aws::Allocator<T>>(Aws::Allocator<T>(), std::forward<ArgTypes>(args)...);
                    ^
/src/aws-sdk-cpp/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp:211:26: note: in instantiation of function template specialization 'Aws::MakeShared<Aws::Crt::Auth::Credentials>' requested here
             return Aws::MakeShared<Aws::Crt::Auth::Credentials>(ALLOCATION_TAG);
                         ^
/src/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/auth/Credentials.h:40:17: note: candidate constructor not viable: requires single argument 'credentials', but no arguments were provided
                Credentials(const aws_credentials *credentials) noexcept;
                ^
/src/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/auth/Credentials.h:50:17: note: candidate constructor not viable: requires 1 argument, but 0 were provided
                Credentials(const Credentials &) = delete;
                ^
/src/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/auth/Credentials.h:51:17: note: candidate constructor not viable: requires 1 argument, but 0 were provided
                Credentials(Credentials &&) = delete;
                ^
/src/aws-sdk-cpp/crt/aws-crt-cpp/include/aws/crt/auth/Credentials.h:41:17: note: candidate constructor not viable: requires at least 4 arguments, but 0 were provided
                Credentials(
                ^
1 error generated.
make[2]: *** [aws-cpp-sdk-s3-crt/CMakeFiles/aws-cpp-sdk-s3-crt.dir/build.make:77: aws-cpp-sdk-s3-crt/CMakeFiles/aws-cpp-sdk-s3-crt.dir/ub_S3-CRT.cpp.o] Error 1
make[2]: Leaving directory '/build/Linux_x86_64_Release_Native/aws-sdk-cpp'
make[1]: *** [CMakeFiles/Makefile2:16936: aws-cpp-sdk-s3-crt/CMakeFiles/aws-cpp-sdk-s3-crt.dir/all] Error 2
make[1]: Leaving directory '/build/Linux_x86_64_Release_Native/aws-sdk-cpp'
make: *** [Makefile:136: all] Error 2

Reproduction Steps

As stated above.

Possible Solution

Replace constructor calls with existing ones, however this is "duct-tape" fix.

Additional Information/Context

Clang and GCC both fail.

AWS CPP SDK version used

1.9.361

Compiler and Version used

gcc (GCC) 12.2.1 20220819 (Red Hat 12.2.1-2) clang 14

Operating System and version

Fedora release 36 Ubuntu 22.04

ambitslix avatar Oct 07 '22 21:10 ambitslix

I am having the same issue on Ubuntu 22.04

benbeezy avatar Oct 18 '22 20:10 benbeezy

I think this has been fixed in a previous release. I'm unable to reproduce this on ubuntu 22.04 with the following build commands:

cmake .. -DBUILD_ONLY="s3;s3-crt" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="<install-path>"
cmake --build . --config=Debug
cmake --install . --config=Debug

Please let me know if you are still running into this error on Ubuntu

jmklix avatar Mar 11 '24 18:03 jmklix

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Mar 22 '24 00:03 github-actions[bot]