Skip to content

Swift cannot use -enable-experimental-cxx-interop on Linux with Foundation #64457

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

Closed
jpsim opened this issue Mar 17, 2023 · 10 comments · Fixed by #67557
Closed

Swift cannot use -enable-experimental-cxx-interop on Linux with Foundation #64457

jpsim opened this issue Mar 17, 2023 · 10 comments · Fixed by #67557
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler itself Linux Platform: Linux swift 5.9 unexpected error Bug: Unexpected error

Comments

@jpsim
Copy link
Contributor

jpsim commented Mar 17, 2023

Description

Foundation can't be used on Linux when -enable-experimental-cxx-interop is enabled.

Steps to reproduce

import Foundation from a Swift file compiled with -enable-experimental-cxx-interop on Linux.

Here's a full step-by-step repro case on macOS with Docker installed:

  1. Download swift-cxx-interop-demo.zip
  2. cd /path/to/unzipped/swift-cxx-interop-demo
  3. swift run -Xcc -std=c++17 <- building and running on macOS works
  4. docker run -it -v pwd:pwd-wpwd swift:5.7.3 swift run -Xcc -std=c++17 <- fails on Linux with the following errors:
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:62:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:62:
#include <CoreFoundation/CFBase.h>
         ^
/usr/lib/swift/CoreFoundation/CFBase.h:83:13: error: unknown type name '_Bool'
    typedef _Bool                   Boolean;
            ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:90:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSArray(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:91:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSData(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:92:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSDate(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:93:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSDictionary(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:94:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSObject(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:95:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSOrderedSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:96:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSNumber(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:97:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:98:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:99:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSTimeZone(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:100:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSValue(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:101:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSCFConstantString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:102:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSIndexSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:103:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSAttributedString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:485:5: error: unknown type name '_Bool'
    _Bool onStack;
    ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:488:15: error: unknown type name '_Bool'
static inline _Bool _resizeConditionalAllocationBuffer(_ConditionalAllocationBuffer *_Nonnull buffer, size_t amt) {
              ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:523:15: error: unknown type name '_Bool'
static inline _Bool _withStackOrHeapBuffer(size_t amount, void (__attribute__((noescape)) ^ _Nonnull applier)(_ConditionalAllocationBuffer *_Nonnull)) {
              ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:541:15: error: unknown type name '_Bool'
static inline _Bool _withStackOrHeapBufferWithResultInArguments(size_t amount, void (__attribute__((noescape)) ^ _Nonnull applier)(void *_Nonnull memory, size_t capacity, _Bool onStack)) {
              ^
<unknown>:0: error: too many errors emitted, stopping now
<unknown>:0: error: could not build C module 'CoreFoundation'
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:62:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:62:
#include <CoreFoundation/CFBase.h>
         ^
/usr/lib/swift/CoreFoundation/CFBase.h:83:13: error: unknown type name '_Bool'
    typedef _Bool                   Boolean;
            ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:90:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSArray(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:91:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSData(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:92:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSDate(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:93:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSDictionary(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:94:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSObject(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:95:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSOrderedSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:96:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSNumber(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:97:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:98:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:99:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSTimeZone(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:100:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSValue(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:101:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSCFConstantString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:102:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSIndexSet(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:10: note: in file included from /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:27:
#include <CoreFoundation/ForFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:103:11: error: unknown type name '_Bool'
CF_EXPORT BOOL _NSIsNSAttributedString(NSISARGTYPE arg);
          ^
/usr/lib/swift/CoreFoundation/ForFoundationOnly.h:87:14: note: expanded from macro 'BOOL'
#define BOOL _Bool
             ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:485:5: error: unknown type name '_Bool'
    _Bool onStack;
    ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:488:15: error: unknown type name '_Bool'
static inline _Bool _resizeConditionalAllocationBuffer(_ConditionalAllocationBuffer *_Nonnull buffer, size_t amt) {
              ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:523:15: error: unknown type name '_Bool'
static inline _Bool _withStackOrHeapBuffer(size_t amount, void (__attribute__((noescape)) ^ _Nonnull applier)(_ConditionalAllocationBuffer *_Nonnull)) {
              ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:103:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:103:
#include <CoreFoundation/ForSwiftFoundationOnly.h>
         ^
/usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h:541:15: error: unknown type name '_Bool'
static inline _Bool _withStackOrHeapBufferWithResultInArguments(size_t amount, void (__attribute__((noescape)) ^ _Nonnull applier)(void *_Nonnull memory, size_t capacity, _Bool onStack)) {
              ^
<unknown>:0: error: too many errors emitted, stopping now
<unknown>:0: error: could not build C module 'CoreFoundation'

Expected behavior

Foundation should be usable on Linux when -enable-experimental-cxx-interop is enabled.

Environment

  • Swift compiler version info: Swift version 5.7.3 (swift-5.7.3-RELEASE), Target: aarch64-unknown-linux-gnu
  • Xcode version info: N/A
  • Deployment target: Ubuntu Linux
@jpsim jpsim added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 17, 2023
@jpsim
Copy link
Contributor Author

jpsim commented Mar 17, 2023

With swift-DEVELOPMENT-SNAPSHOT-2023-03-13-a and -Xfrontend -cxx-interoperability-mode=swift-5.9 I get different errors:

swift run -Xcc -std=c++17
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1214:5: error: exception specification in declaration does not match previous declaration
    begin(valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:104:31: note: previous declaration is here
  template<typename _Tp> _Tp* begin(valarray<_Tp>&);
                              ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1224:5: error: exception specification in declaration does not match previous declaration
    begin(const valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:105:37: note: previous declaration is here
  template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
                                    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1234:5: error: exception specification in declaration does not match previous declaration
    end(valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:106:31: note: previous declaration is here
  template<typename _Tp> _Tp* end(valarray<_Tp>&);
                              ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1249:5: error: exception specification in declaration does not match previous declaration
    end(const valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:107:37: note: previous declaration is here
  template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
                                    ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:33:
#include <math.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:
# include <cmath>
          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1935:12: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1935:
#  include <bits/specfun.h>
           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:
#include <bits/stl_algobase.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:
#include <bits/stl_pair.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:
#include <bits/move.h> // for std::move / std::forward, and std::swap
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: error: could not build module 'std'
#include <type_traits> // Brings in std::declval too.
         ^
<unknown>:0: error: could not build C module 'CoreFoundation'
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "SwiftGlibc.h"
         ^
/usr/lib/swift/linux/aarch64/SwiftGlibc.h:13:10: note: in file included from /usr/lib/swift/linux/aarch64/SwiftGlibc.h:13:
#include <complex.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/complex.h:32:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/complex.h:32:
# include <ccomplex>
          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1214:5: error: exception specification in declaration does not match previous declaration
    begin(valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:104:31: note: previous declaration is here
  template<typename _Tp> _Tp* begin(valarray<_Tp>&);
                              ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1224:5: error: exception specification in declaration does not match previous declaration
    begin(const valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:105:37: note: previous declaration is here
  template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
                                    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1234:5: error: exception specification in declaration does not match previous declaration
    end(valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:106:31: note: previous declaration is here
  template<typename _Tp> _Tp* end(valarray<_Tp>&);
                              ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: note: while building module 'std' imported from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:
#include <type_traits> // Brings in std::declval too.
         ^
<module-includes>:32:10: note: in file included from <module-includes>:32:
#include "valarray"
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/valarray:1249:5: error: exception specification in declaration does not match previous declaration
    end(const valarray<_Tp>& __va) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/range_access.h:107:37: note: previous declaration is here
  template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
                                    ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:33:
#include <math.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:
# include <cmath>
          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1935:12: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1935:
#  include <bits/specfun.h>
           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:
#include <bits/stl_algobase.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:
#include <bits/stl_pair.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:
#include <bits/move.h> // for std::move / std::forward, and std::swap
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:55:10: error: could not build module 'std'
#include <type_traits> // Brings in std::declval too.
         ^
<unknown>:0: error: could not build C module 'CoreFoundation'
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "SwiftGlibc.h"
         ^
/usr/lib/swift/linux/aarch64/SwiftGlibc.h:13:10: note: in file included from /usr/lib/swift/linux/aarch64/SwiftGlibc.h:13:
#include <complex.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/complex.h:32:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/complex.h:32:
# include <ccomplex>
          ^
error: fatalError

@hyp hyp self-assigned this Mar 17, 2023
@hyp hyp added the c++ interop Feature: Interoperability with C++ label Mar 17, 2023
@AnthonyLatsis AnthonyLatsis added Linux Platform: Linux compiler The Swift compiler itself unexpected error Bug: Unexpected error c++ to swift Feature → c++ interop: c++ to swift swift 5.9 and removed triage needed This issue needs more specific labels labels Mar 21, 2023
@adam-rocska
Copy link

I'm also getting wild erorrs here. I don't want to flood this issue with another batch of erors, but apparently in my case I get a segfault when compiling for linux (and a humongouse error output, which I will share if asked for); and also get a quick fail on mac which I can share since it's fairly quick and small:

Rocska-MBP:xxxxx-xxxxxxxxxx rocskaadam$ swift build -c release --product xxxxxxxxxx --static-swift-stdlib -Xswiftc -enable-experimental-cxx-interop
Building for production...
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
/Users/rocskaadam/xxxxx/src/xxxxx-xxxxxxxxxx/.build/checkouts/swift-log/Sources/Logging/Locks.swift:65:39: error: missing arguments for parameters '__sig', '__opaque' in call
        var attr = pthread_mutexattr_t()
                                      ^
                                       __sig: <#Int#>, __opaque: <#(CChar, CChar, CChar, CChar, CChar, CChar, CChar, CChar)#>
Darwin._opaque_pthread_mutexattr_t:2:12: note: 'init(__sig:__opaque:)' declared here
    public init(__sig: Int, __opaque: (CChar, CChar, CChar, CChar, CChar, CChar, CChar, CChar))
           ^
[1/9] Compiling CStbImage image_io.c

Sure, it may look like it's an issue with swift-log, and it may be the case, but I only get this failure when I try to enable the experimental cxx interop.

If this comment was merely a noise, please accept my apologies.

@hyp
Copy link
Contributor

hyp commented May 5, 2023

@adam-rocska This is great feedback. We will look into it.

@etcwilde
Copy link
Contributor

etcwilde commented Jun 5, 2023

CC @etcwilde

@jackalcooper
Copy link

jackalcooper commented Jun 19, 2023

similar errors here with Swift nightly and cxxLanguageStandard: .cxx17

<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:33:
#include <math.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:
# include <cmath>
          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1927:12: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1927:
#  include <bits/specfun.h>
           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:
#include <bits/stl_algobase.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:
#include <bits/stl_pair.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:
#include <bits/move.h> // for std::move / std::forward, and std::swap
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:74:5: error: redefinition of 'forward'
    forward(typename std::remove_reference<_Tp>::type& __t) noexcept
    ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/move.h:74:5: note: previous definition is here
    forward(typename std::remove_reference<_Tp>::type& __t) noexcept
    ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:10: note: in file included from /usr/lib/swift/CoreFoundation/CoreFoundation.h:33:
#include <math.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:11: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/math.h:36:
# include <cmath>
          ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1927:12: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/cmath:1927:
#  include <bits/specfun.h>
           ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/specfun.h:45:
#include <bits/stl_algobase.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_algobase.h:64:
#include <bits/stl_pair.h>
         ^
/usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:10: note: in file included from /usr/bin/../lib/gcc/aarch64-linux-gnu/9/../../../../include/c++/9/bits/stl_pair.h:59:
#include <bits/move.h> // for std::move / std::forward, and std::swap

@lhoward
Copy link
Contributor

lhoward commented Jul 17, 2023

Similar errors here:

Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "CoreFoundation.h"
         ^
/opt/swift-5.9-DEVELOPMENT-SNAPSHOT-2023-07-10-a-ubuntu22.04-aarch64/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:10: note: in file included from /opt/swift-5.9-DEVELOPMENT-SNAPSHOT-2023-07-10-a-ubuntu22.04-aarch64/usr/lib/swift/CoreFoundation/CoreFoundation.h:33:
#include <math.h>
         ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/math.h:36:11: note: in file included from /usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/math.h:36:
# include <cmath>
          ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/cmath:1935:12: note: in file included from /usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/cmath:1935:
#  include <bits/specfun.h>
           ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/specfun.h:45:10: note: in file included from /usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/specfun.h:45:
#include <bits/stl_algobase.h>
         ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_algobase.h:64:10: note: in file included from /usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_algobase.h:64:
#include <bits/stl_pair.h>
         ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_pair.h:59:10: note: in file included from /usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/stl_pair.h:59:
#include <bits/move.h> // for std::move / std::forward, and std::swap
         ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/move.h:77:5: error: redefinition of 'forward'
    forward(typename std::remove_reference<_Tp>::type& __t) noexcept
    ^
/usr/lib/gcc/aarch64-linux-gnu/11/../../../../include/c++/11/bits/move.h:77:5: note: previous definition is here
    forward(typename std::remove_reference<_Tp>::type& __t) noexcept
    ^

If I remove cxxLanguageStandard: .cxx17 then I get a bit further, except the C++ headers I'm importing need things in C++17, so I don't get too much further.

@hyp
Copy link
Contributor

hyp commented Jul 26, 2023

yeah it appears it's only breaking starting with C++17 and above. Investigating.

@hyp
Copy link
Contributor

hyp commented Jul 26, 2023

@adam-rocska fwiw, your issue has been fixed, we now provide (deprecated) default constructors again.

@hyp
Copy link
Contributor

hyp commented Jul 27, 2023

I have a potential fix.

@lhoward
Copy link
Contributor

lhoward commented Jul 29, 2023

Thank you, will this make it into 5.9?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ c++ to swift Feature → c++ interop: c++ to swift compiler The Swift compiler itself Linux Platform: Linux swift 5.9 unexpected error Bug: Unexpected error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants