Consider the following code:
#include "gpgme++/context.h"
#include "gpgme++/data.h"
#include "gpgme++/importresult.h"
#include <memory>
#include <print>
const char* data = "this should not be imported";
int main()
{
GpgME::initializeLibrary();
const std::unique_ptr<GpgME::Context> ctx {
GpgME::Context::createForProtocol(GpgME::OpenPGP)
};
auto buffer = GpgME::Data(data, strlen(data), true);
auto errcode = ctx->importKeys(buffer);
if (errcode.error().isError()) {
std::println(stderr, "Couldn’t import key: {}",
errcode.error().asStdString());
}
return 0;
}Environment:
- macOS Tahoe 26.1
- M4 processor (aarch64/arm64)
- Apple Clang 17 (supplied by XCode)
- GNU C++ 15.2 (supplied by Homebrew)
- GPGMEPP 2.0.0 (supplied by Homebrew)
Expected result:
Code should compile and link cleanly.
Actual result:
- When compiling with Apple Clang, the code compiles and links cleanly.
- When compiling with GNU C++ 15.2, the following linking error occurs:
Undefined symbols for architecture arm64:
"GpgME::Error::asStdString[abi:cxx11]() const", referenced from:
_main in cc3RBL1t.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status