Linker command failed Xcode arm64 for aws-sdk-cpp

45 Views Asked by At

CMake is something I'm still learning, I've been trying to work this out for a while but keep getting errors.

Im on MacOS 14.2.1, using JUCE and Xcode, trying to use https://github.com/aws/aws-sdk-cpp

However I am getting a linking error:

A summary of the error:

Showing Recent Messages
Ld /Users/dev/Development/juce/FarmWater/Builds/MacOSX/build/Debug/HelloWorldDemo.app/Contents/MacOS/HelloWorldDemo normal (in target 'FarmWater - App' from project 'FarmWater')
    cd /Users/dev/Development/juce/FarmWater/Builds/MacOSX
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Xlinker -reproducible -target arm64-apple-macos10.13 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -O0 -L/Users/dev/Library/Developer/Xcode/DerivedData/FarmWater-gkrgzjimtyyxtbdnaarqdmyqsztx/Build/Intermediates.noindex/EagerLinkingTBDs/Debug -L/Users/dev/Development/juce/FarmWater/Builds/MacOSX/build/Debug -F/Users/dev/Library/Developer/Xcode/DerivedData/FarmWater-gkrgzjimtyyxtbdnaarqdmyqsztx/Build/Intermediates.noindex/EagerLinkingTBDs/Debug -F/Users/dev/Development/juce/FarmWater/Builds/MacOSX/build/Debug -filelist /Users/dev/Library/Developer/Xcode/DerivedData/FarmWater-gkrgzjimtyyxtbdnaarqdmyqsztx/Build/Intermediates.noindex/FarmWater.build/Debug/FarmWater\ -\ App.build/Objects-normal/arm64/HelloWorldDemo.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/dev/Library/Developer/Xcode/DerivedData/FarmWater-gkrgzjimtyyxtbdnaarqdmyqsztx/Build/Intermediates.noindex/FarmWater.build/Debug/FarmWater\ -\ App.build/Objects-normal/arm64/HelloWorldDemo_lto.o -Xlinker -no_deduplicate -stdlib\=libc++ -Wl,-ld_classic -framework Cocoa -framework Foundation -framework IOKit -framework QuartzCore -framework Security -weak_framework Metal -weak_framework MetalKit -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/dev/Library/Developer/Xcode/DerivedData/FarmWater-gkrgzjimtyyxtbdnaarqdmyqsztx/Build/Intermediates.noindex/FarmWater.build/Debug/FarmWater\ -\ App.build/Objects-normal/arm64/HelloWorldDemo_dependency_info.dat -o /Users/dev/Development/juce/FarmWater/Builds/MacOSX/build/Debug/HelloWorldDemo.app/Contents/MacOS/HelloWorldDemo

Undefined symbols for architecture arm64:
  "Aws::Crt::ApiAllocator()", referenced from:
      mqtt() in Main.o
      Aws::Crt::StlAllocator<char>::StlAllocator() in Main.o
  "Aws::Crt::ErrorDebugString(int)", referenced from:
      mqtt() in Main.o
      mqtt()::$_0::operator()(Aws::Crt::Mqtt::MqttConnection&, int, aws_mqtt_connect_return_code, bool) const in Main.o
      mqtt()::$_2::operator()(Aws::Crt::Mqtt::MqttConnection&, int) const in Main.o
  "Aws::Crt::Io::TlsContext::TlsContext(Aws::Crt::Io::TlsContextOptions&, Aws::Crt::Io::TlsMode, aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContext::TlsContext()", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContextOptions::InitClientWithMtls(char const*, char const*, aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContextOptions::OverrideDefaultTrustStore(char const*, char const*)", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContextOptions::~TlsContextOptions()", referenced from:
      mqtt() in Main.o
      Aws::Iot::MqttClientConnectionConfigBuilder::~MqttClientConnectionConfigBuilder() in Main.o
  "Aws::Crt::Io::TlsContextOptions::operator=(Aws::Crt::Io::TlsContextOptions&&)", referenced from:
      Aws::Iot::MqttClientConnectionConfigBuilder::operator=(Aws::Iot::MqttClientConnectionConfigBuilder&&) in Main.o
  "Aws::Crt::Io::TlsConnectionOptions::TlsConnectionOptions(Aws::Crt::Io::TlsConnectionOptions&&)", referenced from:
      Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>::Optional(Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>&&) in Main.o
      Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>& Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>::operator=<Aws::Crt::Io::TlsConnectionOptions>(Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>&&) in Main.o
  "Aws::Crt::Io::TlsConnectionOptions::TlsConnectionOptions()", referenced from:
      Aws::Crt::Auth::CredentialsProviderX509Config::CredentialsProviderX509Config() in Main.o
  "Aws::Crt::Io::TlsConnectionOptions::~TlsConnectionOptions()", referenced from:
      mqtt() in Main.o
      Aws::Crt::Auth::CredentialsProviderX509Config::CredentialsProviderX509Config() in Main.o
      Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>& Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>::operator=<Aws::Crt::Io::TlsConnectionOptions>(Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>&&) in Main.o
      Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>::~Optional() in Main.o
      Aws::Crt::Auth::CredentialsProviderX509Config::~CredentialsProviderX509Config() in Main.o
  "Aws::Crt::Io::TlsConnectionOptions::operator=(Aws::Crt::Io::TlsConnectionOptions&&)", referenced from:
      mqtt() in Main.o
      Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>& Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>::operator=<Aws::Crt::Io::TlsConnectionOptions>(Aws::Crt::Optional<Aws::Crt::Io::TlsConnectionOptions>&&) in Main.o
  "Aws::Crt::Auth::CredentialsProvider::CreateCredentialsProviderX509(Aws::Crt::Auth::CredentialsProviderX509Config const&, aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Mqtt::MqttClient::~MqttClient()", referenced from:
      Aws::Iot::MqttClient::~MqttClient() in Main.o
  "Aws::Crt::Mqtt::MqttConnection::Disconnect()", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Mqtt::MqttConnection::Connect(char const*, bool, unsigned short, unsigned int, unsigned int)", referenced from:
      mqtt() in Main.o
  "Aws::Crt::ApiHandle::ApiHandle()", referenced from:
      mqtt() in Main.o
  "Aws::Crt::ApiHandle::~ApiHandle()", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClient::NewConnection(Aws::Iot::MqttClientConnectionConfig const&)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClient::MqttClient(aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::WebsocketConfig::WebsocketConfig(std::__1::basic_string<char, std::__1::char_traits<char>, Aws::Crt::StlAllocator<char>> const&, std::__1::shared_ptr<Aws::Crt::Auth::ICredentialsProvider> const&, aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClientConnectionConfigBuilder::WithEndpoint(std::__1::basic_string<char, std::__1::char_traits<char>, Aws::Crt::StlAllocator<char>>&&)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClientConnectionConfigBuilder::WithCertificateAuthority(char const*)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClientConnectionConfigBuilder::Build()", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClientConnectionConfigBuilder::MqttClientConnectionConfigBuilder(Aws::Iot::WebsocketConfig const&, aws_allocator*)", referenced from:
      mqtt() in Main.o
  "Aws::Iot::MqttClientConnectionConfigBuilder::MqttClientConnectionConfigBuilder()", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContext::NewConnectionOptions() const", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Io::TlsContextOptions::LastError() const", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Mqtt::MqttConnection::LastError() const", referenced from:
      mqtt() in Main.o
  "Aws::Crt::Mqtt::MqttConnection::operator bool() const", referenced from:
      mqtt() in Main.o
  "_aws_mem_acquire", referenced from:
      Aws::Crt::StlAllocator<char>::allocate(unsigned long, void const*) in Main.o
  "_aws_mem_release", referenced from:
      Aws::Crt::StlAllocator<char>::deallocate(char*, unsigned long) in Main.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Undefined symbol: Aws::Crt::ApiAllocator()

Undefined symbol: Aws::Crt::ErrorDebugString(int)

Undefined symbol: Aws::Crt::Io::TlsContext::TlsContext(Aws::Crt::Io::TlsContextOptions&, Aws::Crt::Io::TlsMode, aws_allocator*)

Undefined symbol: Aws::Crt::Io::TlsContext::TlsContext()

Undefined symbol: Aws::Crt::Io::TlsContextOptions::InitClientWithMtls(char const*, char const*, aws_allocator*)

Undefined symbol: Aws::Crt::Io::TlsContextOptions::OverrideDefaultTrustStore(char const*, char const*)

Undefined symbol: Aws::Crt::Io::TlsContextOptions::~TlsContextOptions()

Undefined symbol: Aws::Crt::Io::TlsContextOptions::operator=(Aws::Crt::Io::TlsContextOptions&&)

Undefined symbol: Aws::Crt::Io::TlsConnectionOptions::TlsConnectionOptions(Aws::Crt::Io::TlsConnectionOptions&&)

Undefined symbol: Aws::Crt::Io::TlsConnectionOptions::TlsConnectionOptions()

Undefined symbol: Aws::Crt::Io::TlsConnectionOptions::~TlsConnectionOptions()

Undefined symbol: Aws::Crt::Io::TlsConnectionOptions::operator=(Aws::Crt::Io::TlsConnectionOptions&&)

Undefined symbol: Aws::Crt::Auth::CredentialsProvider::CreateCredentialsProviderX509(Aws::Crt::Auth::CredentialsProviderX509Config const&, aws_allocator*)

Undefined symbol: Aws::Crt::Mqtt::MqttClient::~MqttClient()

Undefined symbol: Aws::Crt::Mqtt::MqttConnection::Disconnect()

Undefined symbol: Aws::Crt::Mqtt::MqttConnection::Connect(char const*, bool, unsigned short, unsigned int, unsigned int)

Undefined symbol: Aws::Crt::ApiHandle::ApiHandle()

Undefined symbol: Aws::Crt::ApiHandle::~ApiHandle()

Undefined symbol: Aws::Iot::MqttClient::NewConnection(Aws::Iot::MqttClientConnectionConfig const&)

Undefined symbol: Aws::Iot::MqttClient::MqttClient(aws_allocator*)

Undefined symbol: Aws::Iot::WebsocketConfig::WebsocketConfig(std::__1::basic_string<char, std::__1::char_traits<char>, Aws::Crt::StlAllocator<char>> const&, std::__1::shared_ptr<Aws::Crt::Auth::ICredentialsProvider> const&, aws_allocator*)

Undefined symbol: Aws::Iot::MqttClientConnectionConfigBuilder::WithEndpoint(std::__1::basic_string<char, std::__1::char_traits<char>, Aws::Crt::StlAllocator<char>>&&)

Undefined symbol: Aws::Iot::MqttClientConnectionConfigBuilder::WithCertificateAuthority(char const*)

Undefined symbol: Aws::Iot::MqttClientConnectionConfigBuilder::Build()

Undefined symbol: Aws::Iot::MqttClientConnectionConfigBuilder::MqttClientConnectionConfigBuilder(Aws::Iot::WebsocketConfig const&, aws_allocator*)

Undefined symbol: Aws::Iot::MqttClientConnectionConfigBuilder::MqttClientConnectionConfigBuilder()

Undefined symbol: Aws::Crt::Io::TlsContext::NewConnectionOptions() const

Undefined symbol: Aws::Crt::Io::TlsContextOptions::LastError() const

Undefined symbol: Aws::Crt::Mqtt::MqttConnection::LastError() const

Undefined symbol: Aws::Crt::Mqtt::MqttConnection::operator bool() const

Undefined symbol: _aws_mem_acquire

Undefined symbol: _aws_mem_release

Linker command failed with exit code 1 (use -v to see invocation)

I've used the example CMake

cd <BUILD_DIR>
cmake <path-to-root-of-this-source-code> \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=<path-to-install> \
cmake --build . --config=Debug
cmake --install . --config=Debug

And it successfully makes and installs all of the SDK, and the files are where I expect in the "include" directory path where I expected them. (I've installed all the aws sdk, even though I'd just like to use the iotv2 sdk, but that fails also)

In my project (which is using JUCE), I've included the path in my "Header Search Paths", which looks to be working.

Using https://github.com/aws/aws-iot-device-sdk-cpp-v2/blob/main/samples/mqtt/x509_credentials_provider_connect/main.cpp in my project shows no errors in Xcode while working (ie. Xcode isnt complaining it cant find a path to the file).

However, when I run the project, I get the linker errors described. I have tried a number of other CMake configurations such as -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64 \ with the same result

(Sorry I'm new to stackoverflow, so apologies for all the faux pas I've done)

0

There are 0 best solutions below