Azure Pipelines 上的构建失败,React Native iOS 应用程序中出现弃用的 char_traits 警告

问题描述 投票:0回答:1

我正在尝试使用 Azure Pipelines 构建 React Native iOS 应用程序,但由于与 RCT-Folly 库中已弃用的

char_traits
相关的警告,构建失败。以下是错误日志的相关部分和我的设置:

错误日志

⚠️ /Users/runner/work/1/s/ios/Pods/Headers/Private/RCT-Folly/folly/Range.h:176:16:“char_traits”已弃用:T 的 char_traits 不等于 char、wchar_t 、char8_t、char16_t 或 char32_t 是非标准的,并且是临时提供的。它将在 LLVM 18 中删除,因此请从中迁移。 [-W已弃用声明] typedef std::char_traits::type>

构建失败

以下构建命令失败:

CompileC /Users/runner/Library/Developer/Xcode/DerivedData/raurauAdmin-gztdyzcynucaikdocaqdcfvsvqqd/Build/Intermediates.noindex/Pods.build/Release-iphoneos/RCT-Folly.build/Objects-normal/arm64/json.o /Users /runner/work/1/s/ios/Pods/RCT-Folly/folly/json.cpp 正常arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler(在项目“Pods”的目标“RCT-Folly”中) ')

Podfile 如下

Podfile 和 CI yaml 配置

这是我的 Podfile 和 CI yaml 的相关部分:

platform :ios, '12.0'
pod 'Firebase', :modular_headers => true
# other pods...

post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS'] = 'NO'
      end
    end
  end
end
**CI YAML Pipeline Configuration**

trigger:
- main  # Trigger the pipeline on changes to the main branch

variables:
  - group: 'New variable group 12-Sep'  # Link to variable group for shared variables
  - name: System.Debug
    value: true  # Enable debug logging for detailed output

jobs:
- job: Build_iOS
  displayName: Build iOS App
  pool:
    vmImage: macos-latest  # Use the latest macOS image available

  steps:
  - checkout: self
    fetchDepth: 1  # Fetch only the latest commit for faster checkout

  # Node.js setup to use the specified version
  - task: NodeTool@0
    displayName: 'Setup Node.js'
    inputs:
      versionSpec: '18.x'  # Use Node.js version 18.x

  # Install dependencies using Yarn
  - task: Yarn@3
    displayName: 'Install dependencies'
    inputs:
      verbose: false

  # Clean Xcode derived data to ensure a clean build environment
  - task: Bash@3
    displayName: 'Clean Derived Data'
    inputs:
      targetType: 'inline'
      script: rm -rf ~/Library/Developer/Xcode/DerivedData/*

  # Install CocoaPods dependencies
  - task: CocoaPods@0
    displayName: 'Install CocoaPods'
    inputs:
      forceRepoUpdate: true
      cwd: ios  # Execute in the ios directory

  # Perform a clean build to remove any previous build artifacts
  - script: |
      xcodebuild clean -workspace ios/raurauAdmin.xcworkspace -scheme raurauAdmin -configuration Release
    displayName: 'Clean Build with Xcode'

  # Build the iOS application
  - task: Xcode@5
    displayName: 'Build iOS IPA'
    inputs:
      configuration: Release
      sdk: iphoneos
      xcWorkspacePath: 'ios/raurauAdmin.xcworkspace'
      scheme: 'raurauAdmin'
      useXcpretty: true
      packageApp: true

# Note: Additional steps for archiving, exporting the IPA, or deploying the build to a service like TestFlight or App Store can be added here.
ios xcode react-native azure-devops azure-pipelines
1个回答
0
投票

LLVM 删除了

std::char_traits<T>
的定义,自 LLVM 18 以来,C++ 标准中未定义该定义。作为解决方法,您可以使用
std::vector<std::byte>
。详情请参阅本期

来自 LLVM17:

std::char_traits 的基本模板已被标记为已弃用,并将在 LLVM 18 中删除。如果您将 std::char_traits 与 char、wchar_t、char8_t、char16_t、char32_t 以外的类型或自定义字符类型一起使用,如果您专门化了 std::char_traits,那么当我们删除基本模板时,您的代码将停止工作。该标准不强制要求提供基本模板,并且这样的基本模板对于某些类型来说肯定是不正确的,这目前可能会导致意外行为而未被检测到。

© www.soinside.com 2019 - 2024. All rights reserved.