Skip to content

Conversation

@pniedzielski
Copy link
Collaborator

@pniedzielski pniedzielski commented Dec 17, 2025

This pull request teaches our CI to build bmqbrkr and bmqtool in C++03, which is a supported configuration for them.

Some notes about this PR:

  • ntf-core's configure script will overwrite whatever UFID we pass it on Linux to compile with C++20. Feat: Let Linux/Darwin/Windows users pick their C++ version ntf-core#353 changes this behavior and is necessary for this to work.
  • There are two commits that should not be merged in. They're titled chore[DO NOT MERGE].
    • The first temporarily uses a tag in my personal fork of ntf-core that includes the changes in Feat: Let Linux/Darwin/Windows users pick their C++ version ntf-core#353. Once that PR is merged, we should remove this commit.
    • The second is a line of code that is a syntax error in C++03 but not in C++11 or later. This commit just serves to prove that we are building BlazingMQ in C++03, and causes only the C++03 job to fail.
  • There's one real C++03 fix in this PR as well, a conversion to shared_ptr that seems to work fine on Solaris but not Linux+GCC.

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build 3167 of commit 7aecf44 has completed with FAILURE

@pniedzielski pniedzielski marked this pull request as ready for review December 17, 2025 15:47
@pniedzielski pniedzielski requested a review from a team as a code owner December 17, 2025 15:47
@pniedzielski pniedzielski requested a review from 678098 December 17, 2025 15:47
@pniedzielski
Copy link
Collaborator Author

Run [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  BUILD_DEPS_SHA=$(cat docker/build_deps.sh | shasum)
  echo "cache_key=deps-$CPP_VERSION_TAG$BUILD_DEPS_SHA" >> $GITHUB_OUTPUT
0s
Run [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  BUILD_DEPS_SHA=$(cat docker/build_deps.sh | shasum)
  echo "cache_key=deps-$CPP_VERSION_TAG$BUILD_DEPS_SHA" >> $GITHUB_OUTPUT
  shell: /usr/bin/bash -e {0}
1s
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
1s
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -

PR is using c++03 deps cache entry even in non c++03 build, let me see what's up.

@pniedzielski
Copy link
Collaborator Author

Run [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  BUILD_DEPS_SHA=$(cat docker/build_deps.sh | shasum)
  echo "cache_key=deps-$CPP_VERSION_TAG$BUILD_DEPS_SHA" >> $GITHUB_OUTPUT
0s
Run [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  [[ false ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""
  BUILD_DEPS_SHA=$(cat docker/build_deps.sh | shasum)
  echo "cache_key=deps-$CPP_VERSION_TAG$BUILD_DEPS_SHA" >> $GITHUB_OUTPUT
  shell: /usr/bin/bash -e {0}
1s
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
1s
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Run actions/cache/restore@v4
Cache hit for: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -
Lookup only - skipping download
Cache found and can be restored from key: deps-cpp03-1ef1fd1307a7392d2465bae7f687eef2aead9067  -

PR is using c++03 deps cache entry even in non c++03 build, let me see what's up.

Extra [[ ... ]] around false

@pniedzielski pniedzielski force-pushed the ci/cpp03-deps branch 8 times, most recently from 4e21a4c to 4a58940 Compare December 18, 2025 20:19
pniedzielski and others added 4 commits December 29, 2025 17:30
We key our cache entries for dependencies with the hash of the
`build-deps.sh` script and the date the dependencies are built on.
Because we run this job nightly, we end up with a new cache entry each
night containing the same build results.  This quickly fills up our
cache with duplicate entries, crowding out space for the cache entries
we use to communicate build results between jobs.

In fact, it is very unusual to key a cache on the date in GitHub
Actions.  Most languages encourage you to use the hash of a dependency
lock file (à la `yarn.lock`) for repeatability.  In our case, the the
`build-deps.sh` contains the BDE and NTF tags we need to build.  As
long as we use stable version tags or specific commit SHAs, each
workflow run always tries to build the same source code, building the
same binaries.

This patch removes the date from the cache entry name.

Signed-off-by: Patrick M. Niedzielski <[email protected]>
Signed-off-by: Patrick M. Niedzielski <[email protected]>
Signed-off-by: Patrick M. Niedzielski <[email protected]>
Signed-off-by: Patrick M. Niedzielski <[email protected]>
@pniedzielski pniedzielski force-pushed the ci/cpp03-deps branch 2 times, most recently from 415a6d6 to a3fb042 Compare December 30, 2025 15:52
@pniedzielski pniedzielski requested a review from 678098 December 30, 2025 16:49
@pniedzielski
Copy link
Collaborator Author

@678098 you can take a look at this now. We're blocked on a PR to ntf-core for this, so we can't merge it anyway. I updated the PR description with some information.

working-directory: deps
run: ../docker/build_deps.sh
run: |
${{ inputs.cpp03 }} ]] && ../docker/build_deps.sh --cpp03 || ../docker/build_deps.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${{ inputs.cpp03 }} ]] && ../docker/build_deps.sh --cpp03 || ../docker/build_deps.sh
[[ ${{ inputs.cpp03 }} ]] && ../docker/build_deps.sh --cpp03 || ../docker/build_deps.sh

Don't understand how it worked before

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm not sure how it worked, but crucially we don't want [[ ... ]]. inputs.cpp03 expands to true or false, and both [[ true ]]; echo $? and [[ false ]]; echo $? evaluate to 0.

required: false
type: string
default: "build-ubuntu"
cpp03:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a string property cxx_standard instead and explicitly pass cpp03 or cpp17 (or what version do we build here)?
This allows to normalize the code and remove pattern flag && A || B like [[ ${{ inputs.cpp03 }} ]] && CPP_VERSION_TAG="cpp03-" || CPP_VERSION_TAG=""

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I'll go this route.

-DCMAKE_BUILD_TYPE=Debug \
-DBDE_BUILD_TARGET_SAFE=ON \
-DBDE_BUILD_TARGET_64=ON \
-DBDE_BUILD_TARGET_CPP03=ON \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't provide configure script with ufid but can support something similar and simple like standard configuration if we update CMakeLists.txt

on:
workflow_call:
inputs:
cpp03:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can also have cxx_standard

static_cast<bsls::Types::Int64>(port),
&localAllocator);
bsl::shared_ptr<bmqst::StatContext> portStatContext =
bslma::ManagedPtr<bmqst::StatContext> portStatContext =
Copy link
Collaborator

@678098 678098 Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change required for cpp03?
Changing shared_ptr to ManagedPtr looks like a step back in this case.

Somehow we are able to build a shared_ptr later when we construct a PortContext

        struct PortContext {
            bsl::shared_ptr<bmqst::StatContext> d_portContext;
            bsl::size_t                         d_numChannels;
        };

@678098 678098 assigned pniedzielski and unassigned 678098 Dec 30, 2025
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