Skip to content

Can't cross-compile for iOS on Linux after following documentation #9353

Open
@kus04e4ek

Description

@kus04e4ek

Tested versions

master [c4279fe3e0b27d0f40857c00eece7324a967285f]

System information

Ubuntu 22.04.4 LTS 22.04

Issue description

Get this error when trying to compile:

clang: error: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]

This patch fixes it, but not sure if this is the correct solution:

diff --git a/platform/ios/detect.py b/platform/ios/detect.py
index e3bac4ec5ce..ddb8e775803 100644
--- a/platform/ios/detect.py
+++ b/platform/ios/detect.py
@@ -126,6 +126,7 @@ def configure(env: "SConsEnvironment"):
             CCFLAGS=(
                 "-fobjc-arc -arch x86_64"
                 " -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks"
+                " -stdlib=libc++"
                 " -fasm-blocks -isysroot $IOS_SDK_PATH"
             ).split()
         )
@@ -136,6 +137,7 @@ def configure(env: "SConsEnvironment"):
                 "-fobjc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing"
                 " -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits"
                 " -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies"
+                " -stdlib=libc++"
                 " -isysroot $IOS_SDK_PATH".split()
             )
         )

Steps to reproduce

Follow the steps from the documentation while using Xcode 14.3.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:contributingIssues and PRs related to the Contributing/Development section of the documentationbugtopic:buildsystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions