[MDEV-23539] Cannot build aws-key-management.so Created: 2020-08-22  Updated: 2020-10-26  Resolved: 2020-10-26

Status: Closed
Project: MariaDB Server
Component/s: Plugin - AWS key management
Affects Version/s: 10.4.15, 10.5.5
Fix Version/s: 10.4.16, 10.5.7

Type: Bug Priority: Minor
Reporter: Tanner Trautrim Assignee: Daniel Black
Resolution: Fixed Votes: 0
Labels: Compatibility
Environment:

Ubuntu 20.04.1 LTS
I9-9900k
GTX-980TI


Attachments: Text File cmake_output_unchanged_w_patch.txt     Text File make_output.txt     Text File make_output_w_patch.txt    

 Description   

Issue

Cannot build AWS key management using:

cmake -DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC \
           -DAWS_SDK_EXTERNAL_PROJECT=1 \
           -DNOT_FOR_DISTRIBUTION=1 \
            ../mariadb; \
 
make aws_key_management;

Steps to Reproduce

echo "deb http://ftp.osuosl.org/pub/mariadb/repo/10.5/ubuntu bionic main" \
         | tee -a /etc/apt/sources.list.d/mariadb.list
 
echo "deb-src http://ftp.osuosl.org/pub/mariadb/repo/10.5/ubuntu bionic main" \
         | tee -a /etc/apt/sources.list.d/mariadb-src.list
 
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
apt-get update
apt-get build-dep mariadb-10.5
 
git clone --branch 10.5 https://github.com/MariaDB/server.git /tmp/mariadb
 
mkdir /tmp/build-mariadb
cd /tmp/build-mariadb
 
cmake -DPLUGIN_AWS_KEY_MANAGEMENT=DYNAMIC \
           -DAWS_SDK_EXTERNAL_PROJECT=1 \
           -DNOT_FOR_DISTRIBUTION=1 \
            ../mariadb; \
 
make aws_key_management;

Work around

Initially a issue on the mariadb docker page (https://github.com/docker-library/mariadb/issues/322) @grooverdan provided me with a patch to allow me to build the AWS key management in a docker container. I have also tested this with a regular distribution of Ubuntu as stated from my environment above.

After "git clone --branch 10.5 https://github.com/MariaDB/server.git /tmp/mariadb" add

cd /tmp/mariadb
 
wget -O aws.patch https://gist.githubusercontent.com/grooverdan/639557efa21fd4a67aee0002c7f81d3d/raw/d372e07772e3760fd7c1abaf117032b26db1d713/mariadb-10.5-patch-aws-plugin
 
git apply aws.patch

Then continue with the rest of the steps.

Patch contents

diff --git a/extra/aws_sdk/CMakeLists.txt b/extra/aws_sdk/CMakeLists.txt
index 85a196dccce..7c4b8d8195c 100644
--- a/extra/aws_sdk/CMakeLists.txt
+++ b/extra/aws_sdk/CMakeLists.txt
@@ -34,7 +34,7 @@ ENDFOREACH()
 IF(CMAKE_VERSION LESS "3.0")
   SET(GIT_TAG "1.0.8")
 ELSE()
-  SET(GIT_TAG "1.2.11")
+  SET(GIT_TAG "1.8.29")
 ENDIF()
 
 IF(MSVC_CRT_TYPE MATCHES "/MD")
diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc
index 489dd375387..e2182336aa6 100644
--- a/plugin/aws_key_management/aws_key_management_plugin.cc
+++ b/plugin/aws_key_management/aws_key_management_plugin.cc
@@ -161,6 +161,10 @@ class  MySQLLogSystem : public Aws::Utils::Logging::FormattedLogSystem
   {
   }
 
+  virtual void Flush(void) override
+  {
+  }
+
 protected:
   virtual void ProcessFormattedStatement(Aws::String&& statement) override
   {



 Comments   
Comment by Daniel Black [ 2020-10-24 ]

In testing: https://github.com/MariaDB/server/commit/bebbc0a7023f30835ab7a878e21ef8fdffabe892#diff-47af931b17988296ff32a160f6a427c3c6c8157618f63d47cb7039eaae6ff780R167

wlad is this a strange way to flush stdout on windows in a plugin?

Comment by Vladislav Vaintroub [ 2020-10-24 ]

danblack, you can do that, but this it is too pedantically written. You do not need the ACID guarantees in this case, and if your machine(not the process) crashes, you probably won't not care about a couple of unwritten bytes in the error log. Outside Windows, the stderr is also not buffered (in stdio meaning of buffering), so I'd omit that fflush too, and make Flush() dummy, like it was originally proposed

Comment by Daniel Black [ 2020-10-26 ]

Thanks wlad. I've done that (keeping flush as empty).

Fix pushed to 10.4

Generated at Thu Feb 08 09:23:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.