Skip to content

[Backport kirkstone-next] 2025 05 27 master next fix aws crt cpp #12658

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

Merged
merged 2 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions recipes-sdk/aws-crt-cpp/aws-crt-cpp/run-ptest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ApiMultiDefaultCreateDestroy \
ApiStaticDefaultCreateDestroy \
EventLoopResourceSafety \
ClientBootstrapResourceSafety \
MqttClientNewConnectionUninitializedTlsContext \
TLSContextUninitializedNewConnectionOptions \
Base64RoundTrip \
DateTimeBinding \
Expand All @@ -24,7 +23,6 @@ MD5ResourceSafety \
SHA256HMACResourceSafety \
HttpCreateConnectionInvalidTlsConnectionOptions \
IotPublishSubscribe \
HttpClientConnectionManagerInvalidTlsConnectionOptions \
DefaultResolution \
OptionalCopySafety \
OptionalMoveSafety \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ EXTRA_OECMAKE += "\
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$D/usr \
"

FILES:${PN}-dev += "${libdir}/*/cmake"
Expand All @@ -35,10 +34,3 @@ SOLIBS = "*.so"
FILES_SOLIBSDEV = ""

BBCLASSEXTEND = "native nativesdk"

# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address,undefined -fno-omit-frame-pointer', '', d)}"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BRANCH ?= "main"
SRC_URI = "git://github.com/aws/aws-iot-device-sdk-cpp-v2.git;protocol=https;branch=${BRANCH}"
SRC_URI = "gitsm://github.com/aws/aws-iot-device-sdk-cpp-v2.git;protocol=https;branch=${BRANCH}"
SRCREV = "0a3ddbc93410f3c2fe0af56dab07f38e982f5cba"
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
This disable the shared libs build for aws-crt-cpp and aws-c-iot,
cause they will conflict with already exising versions on a system.
Therefor they are static linked into the cpp libs to not conflict.

Upstream-Status: Inappropriate [oe specific]


Index: git/crt/aws-crt-cpp/CMakeLists.txt
===================================================================
--- git.orig/crt/aws-crt-cpp/CMakeLists.txt
+++ git/crt/aws-crt-cpp/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.9...3.31)

+set(BUILD_SHARED_LIBS OFF)
+
option(BUILD_DEPS "Builds aws common runtime dependencies as part of build. Turn off if you want to control your dependency chain." ON)
option(BYO_CRYPTO "Don't build a tls implementation or link against a crypto interface. This feature is only for unix builds currently" OFF)
option(USE_OPENSSL "Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto" OFF)
Index: git/crt/aws-c-iot/CMakeLists.txt
===================================================================
--- git.orig/crt/aws-c-iot/CMakeLists.txt
+++ git/crt/aws-c-iot/CMakeLists.txt
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.9...3.31)
project(aws-c-iot C)

+set(BUILD_SHARED_LIBS OFF)
+
option(USE_EXTERNAL_DEPS_SOURCES "Use dependencies provided by add_subdirectory command" OFF)

if (USE_EXTERNAL_DEPS_SOURCES)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/sh

export LD_PRELOAD=$(find /usr/lib /lib -type f -name "libasan.so*")

LSAN_OPTIONS=suppressions=openssl_suppressions.txt mqtt5_pubsub --help
mqtt5_pubsub --help
RETVAL=$?
if [ $RETVAL -eq 255 ] ; then
echo "PASS: aws-iot-device-sdk-cpp-v2-sample-mqtt5_pubsub help test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,52 @@ LICENSE = "Apache-2.0"

LIC_FILES_CHKSUM = "file://documents/LICENSE;md5=f91e61641e7a96835dea6926a65f4702"

DEPENDS += "aws-c-iot"
DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'build-deps', 'openssl', 'aws-c-iot', d)}"

PROVIDES += "aws/aws-iot-device-sdk-cpp-v2"

require aws-iot-device-sdk-cpp-v2-version.inc

SRC_URI:append = " \
file://run-ptest \
file://openssl_suppressions.txt \
${@bb.utils.contains('PACKAGECONFIG', 'static', '', 'file://001-shared-static-crt-libs.patch', d)} \
"

S = "${WORKDIR}/git"

inherit cmake pkgconfig ptest

UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)"

CXXFLAGS:append = " -fPIC"
LDFLAGS:append = " -Wl,-Bsymbolic"

EXTRA_OECMAKE += "\
-DCMAKE_MODULE_PATH=${STAGING_LIBDIR}/cmake \
-DBUILD_DEPS=OFF \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$D/usr \
-DUSE_OPENSSL=ON \
"

# Notify that libraries are not versioned
SOLIBS = "*.so"
FILES_SOLIBSDEV = ""

# enable PACKAGECONFIG = "static" to build static instead of shared libs
PACKAGECONFIG[static] = "-DBUILD_SHARED_LIBS=OFF,-DBUILD_SHARED_LIBS=ON,,"
PACKAGECONFIG[static] = "-DBUILD_SHARED_LIBS=OFF,-DBUILD_SHARED_LIBS=ON"

# build-deps is enabled by default to use the aws-c-iot lib (and its dependencies) version that comes as a git submodule,
# this also means that it conflicts with the aws-c-iot as it installs the same library if installed separate.
PACKAGECONFIG[build-deps] = "-DBUILD_DEPS=ON,-DBUILD_DEPS=OFF"

PACKAGECONFIG ??= "\
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
build-deps \
"
PACKAGECONFIG[with-tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,"
PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"

FILES:${PN}-dev += "${libdir}/*/cmake"
FILES:${PN}-dev += "${@bb.utils.contains('PACKAGECONFIG', 'build-deps', '${libdir}/s2n/cmake', '', d)}"

# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'build-deps', 'ldflags', '', d)}"

RDEPENDS:${PN}-ptest:prepend = "\
aws-iot-device-sdk-cpp-v2-samples-mqtt5-pubsub \
Expand All @@ -55,16 +59,3 @@ RDEPENDS:${PN}-ptest:prepend = "\
BBCLASSEXTEND = "native nativesdk"

EXTRA_OECMAKE:append = " -DCMAKE_BUILD_TYPE=RelWithDebInfo"

# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address,undefined -fno-omit-frame-pointer', '', d)}"

do_install_ptest:append() {
install -d ${D}${PTEST_PATH}/tests

install ${WORKDIR}/openssl_suppressions.txt ${D}${PTEST_PATH}/
}
Loading