Skip to content

Instantly share code, notes, and snippets.

@traversaro
Created February 23, 2026 13:03
Show Gist options
  • Select an option

  • Save traversaro/de0fd7c1b80072b06509164a2c22903b to your computer and use it in GitHub Desktop.

Select an option

Save traversaro/de0fd7c1b80072b06509164a2c22903b to your computer and use it in GitHub Desktop.
Reproducer for clang_linux-64 and clangxx_linux-64 build failure
c_compiler:
- clang
cxx_compiler:
- clangxx
c_stdlib:
- sysroot # [linux]
- macosx_deployment_target # [osx]
- vs # [win]
#include <iostream>
#include <optional>
#include <string>
int main() {
std::optional<std::string> msg = std::string("optional-ok");
if (!msg) {
return 1;
}
std::cout << *msg << '\n';
return 0;
}
[workspace]
name = "cpp17-optional-reproducer"
description = "Minimal C++17 std::optional compiler/stdlib sanity check"
channels = ["conda-forge"]
platforms = ["linux-64"]
[dependencies]
rattler-build = "*"
[tasks]
# Reproduces the breakage: libstdcxx-devel_linux-64 is NOT added to build requirements
build-broken = "rattler-build build --recipe . --variant 'pin_libstdcxx_devel=false' --output-dir output"
# Fixes the issue: libstdcxx-devel_linux-64 15.* IS added to build requirements
build-fixed = "rattler-build build --recipe . --variant 'pin_libstdcxx_devel=true' --output-dir output"
context:
name: cpp17-optional-reproducer
version: "0.1.0"
package:
name: ${{ name }}
version: ${{ version }}
source:
path: .
use_gitignore: false
build:
number: 0
skip:
- win
script:
# Helpful diagnostics in the build log
- echo "CC=${CC}"
- echo "CXX=${CXX}"
- ${CXX} -std=c++17 -v -E -x c++ /dev/null
# Actual compile (this is where <optional> will fail if stdlib headers are broken)
- ${CXX} -std=c++17 -O2 main.cpp -o optional-smoke
- mkdir -p ${PREFIX}/bin
- cp optional-smoke ${PREFIX}/bin/optional-smoke
requirements:
build:
- ${{ compiler('c') }}
- ${{ stdlib('c') }}
- ${{ compiler('cxx') }}
# Controlled via -m variant-fixed.yaml / variant-broken.yaml (use_libstdcxx_devel)
- if: pin_libstdcxx_devel == "true"
then:
- libstdcxx-devel_linux-64 15.*
tests:
- script:
- optional-smoke
- test "$(optional-smoke)" = "optional-ok"
about:
summary: "Minimal C++17 std::optional compiler/stdlib sanity check"
license: BSD-3-Clause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment