0

I am building a Java app on Linux and calling CPP code via JNI. When I link my CPP objects with with libaws-cpp-sdk-core.so I get unresolved symbol:

Aws::Utils::Json::JsonValue::JsonValue(std::__cxx11::basic_string, std::allocator > const&)

The symbol in the aws-spp-sdk-core.so is almost matching: T Aws::Utils::Json::JsonValue::JsonValue(std::__cxx11::basic_string, Aws::Allocator > const&)

except its an Aws::Allocator instead of a std::allocator so I've tried passing both an AWSD ::String and a std::string but no help

The problem sysmbol comes from the following code calling AWS::Utils::Json::JsonValue():

JNIEXPORT jstring JNICALL Java_CCBJNI_labToMix(JNIEnv * env, jobject thisObj, jstring jcolor) {

Aws::Utils::Json::JsonValue labjson;
Aws::Utils::Json::JsonView labview;

string line;
Aws::String const& aws_line(line); 
labjson = Aws::Utils::Json::JsonValue(aws_line);
return NULL;

}

I have built the AWSSDK from source on Linux and have tried linking in all the generated .so libs I have install the prereqs: $sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev works on Windows using nuget package manager other AWS calls are working just not this one.

Thanks for any help

Rob Scott
  • 11
  • 3

2 Answers2

0

Needed to turn off CUSTOM_MEMORY_MANAGEMENT when building the libaws-cpp-sdk-core.so. It is turned on by default when building a shared lib. The correct build steps for libaws-cpp-sdk-core:

  1. install prereqs: $sudo apt-get install libcurl4-openssl-dev libssl-dev uuid-dev zlib1g-dev libpulse-dev
  2. clone awssdk: $git clone https://github.com/aws/aws-sdk-cpp.git
  3. install cmake: $sudo apt install cmake
  4. $cd aws-cpp-sdk
  5. sudo cmake . -DBUILD_ONLY="core" -DBUILD_SHARED_LIBS=ON -DENABLE_UNITY_BUILD=ON -DCUSTOM_MEMORY_MANAGEMENT=OFF
  6. sudo make
  7. sudo make install
Rob Scott
  • 11
  • 3
0

Thanks https://stackoverflow.com/users/3361160/rob-scott for the answer above just a small correction

Instead of git clone https://github.com/aws/aws-sdk-cpp.git in step 2.

If we do git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp it will get all the dependent packages and the build will be more smooth.

Imagron
  • 1
  • 1
  • It's not an answer but more a comment to the other answer. please, next time, use the comment section bellow a comment to inproove it. – charles Lgn Feb 17 '23 at 07:18