Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined symbol linker error by moving sign and secureHash t… #4084

Conversation

ahaladok
Copy link
Contributor

Move template definitions to .h file

Description

Moved the definitions of template methods Signer::sign and Address::secureHash from .cpp to .h files to resolve linker errors due to missing template instantiations. This change ensures that the compiler has access to the full implementation of these templates in the translation units where they are used.

Error was fixed:

Undefined symbols for architecture x86_64: "std::__1::vector<unsigned char, std::__1::allocator<unsigned char>> TW::Waves::Address::secureHash<std::__1::vector<unsigned char, std::__1::allocator<unsigned char>>>(std::__1::vector<unsigned char, std::__1::allocator<unsigned char>> const&)", referenced from: TW::Waves::tests::WavesAddress_SecureHash_Test::TestBody() in AddressTests.cpp.o "void TW::Harmony::Signer::sign<TW::Harmony::Transaction>(TW::PrivateKey const&, std::__1::vector<unsigned char, std::__1::allocator<unsigned char>> const&, TW::Harmony::Transaction&) const", referenced from: TW::Harmony::HarmonySigner_SignAssumeLocalNet_Test::TestBody() in SignerTests.cpp.o ld: symbol(s) not found for architecture x86_64 c++: error: linker command failed with exit code 1 (use -v to see invocation)

How to test

  1. Run a full build of the project to ensure that the linker error is resolved and all components compile successfully.
  2. Verify functionality by running existing tests for Signer::sign and Address::secureHash.
  3. Check for any potential issues with symbol resolution across different platforms (e.g., macOS, Linux).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Create pull request as draft initially, unless it's complete.
  • Add tests to cover changes as needed.
  • [х] Update documentation as needed.
  • If there is a related Issue, mention it in the description.

@satoshiotomakan satoshiotomakan merged commit 63ef219 into trustwallet:master Oct 31, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants