Skip to content
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

Swift 6 - improvements #10

Open
kassane opened this issue Aug 21, 2024 · 2 comments
Open

Swift 6 - improvements #10

kassane opened this issue Aug 21, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@kassane
Copy link
Owner

kassane commented Aug 21, 2024

After #9. Tried some tests betwen targets (cross-compilation)

Sources

https://github.com/kassane/anotherBuildStep/tree/main/tests/swift_ffi

Build

native
$ ~/Downloads/zig-linux-x86_64-0.13.0/zig build --summary all --verbose
/home/kassane/Downloads/zig-linux-x86_64-0.13.0/zig build-lib -OReleaseSmall -Mroot=/home/kassane/anotherBuildStep/examples/zig_abi.zig -lc --cache-dir /home/kassane/anotherBuildStep/.zig-cache --global-cache-dir /home/kassane/.cache/zig --name zig_abi -static --listen=- 
/home/kassane/Downloads/zig-linux-x86_64-0.13.0/zig build-exe -OReleaseSafe --dep build_options -Mroot=/home/kassane/anotherBuildStep/tools/zigcc.zig -Mbuild_options=/home/kassane/anotherBuildStep/.zig-cache/c/c3a9b1f2fdf4bbdd8a1160b6f08cd482/options.zig --cache-dir /home/kassane/anotherBuildStep/.zig-cache --global-cache-dir /home/kassane/.cache/zig --name zcc --listen=- 
swiftc -import-bridging-header examples/c_include.h -g -clang-scanner-module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -Xfrontend -disable-llvm-verify examples/main.swift -v -cxx-interoperability-mode=default -parse-as-library -Xcc -stdlib=libc++ -target x86_64-unknown-linux-gnu -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example -ld-path=/home/kassane/anotherBuildStep/.zig-cache/o/f1f9a84666bfa391f83adf5acb58f32b/zcc -use-ld=/home/kassane/anotherBuildStep/.zig-cache/o/f1f9a84666bfa391f83adf5acb58f32b/zcc /home/kassane/anotherBuildStep/.zig-cache/o/bc3cf51116dd07753cb6e0e1bc7adfd9/libzig_abi.a 
Swift version 6.1-dev (LLVM 9d45b9c9d5c48a0, Swift 08721cf939ec503)
Target: x86_64-unknown-linux-gnu
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -target x86_64-unknown-linux-gnu -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /home/kassane/anotherBuildStep/examples/c_include.h -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -emit-pch -o /tmp/TemporaryDirectory.lQzIxg/c_include.pch /home/kassane/anotherBuildStep/examples/c_include.h
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -c -primary-file /home/kassane/anotherBuildStep/examples/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /tmp/TemporaryDirectory.lQzIxg/c_include.pch -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -parse-as-library -o /tmp/TemporaryDirectory.lQzIxg/main-1.o
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /home/kassane/anotherBuildStep/examples/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /tmp/TemporaryDirectory.lQzIxg/c_include.pch -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -emit-module-doc-path /tmp/TemporaryDirectory.lQzIxg/swift_example-1.swiftdoc -emit-module-source-info-path /tmp/TemporaryDirectory.lQzIxg/swift_example-1.swiftsourceinfo -parse-as-library -o /tmp/TemporaryDirectory.lQzIxg/swift_example-1.swiftmodule
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -modulewrap /tmp/TemporaryDirectory.lQzIxg/swift_example-1.swiftmodule -target x86_64-unknown-linux-gnu -o /tmp/TemporaryDirectory.lQzIxg/swift_example-1.o
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-autolink-extract /tmp/TemporaryDirectory.lQzIxg/swift_example-1.o /tmp/TemporaryDirectory.lQzIxg/main-1.o /home/kassane/anotherBuildStep/.zig-cache/o/bc3cf51116dd07753cb6e0e1bc7adfd9/libzig_abi.a -o /tmp/TemporaryDirectory.lQzIxg/swift_example-2.autolink
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/clang -fuse-ld=/home/kassane/anotherBuildStep/.zig-cache/o/f1f9a84666bfa391f83adf5acb58f32b/zcc --ld-path=/home/kassane/anotherBuildStep/.zig-cache/o/f1f9a84666bfa391f83adf5acb58f32b/zcc -pie -Xlinker --build-id -Xlinker -rpath -Xlinker /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.lQzIxg/swift_example-1.o /tmp/TemporaryDirectory.lQzIxg/main-1.o /home/kassane/anotherBuildStep/.zig-cache/o/bc3cf51116dd07753cb6e0e1bc7adfd9/libzig_abi.a @/tmp/TemporaryDirectory.lQzIxg/swift_example-2.autolink -L /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux -lswiftCore --target=x86_64-unknown-linux-gnu -v -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example
[zig cc] flags: "-pie /lib64/ld-linux-x86-64.so.2 -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example -L/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux -L/usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib -rpath /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.lQzIxg/swift_example-1.o /tmp/TemporaryDirectory.lQzIxg/main-1.o /home/kassane/anotherBuildStep/.zig-cache/o/bc3cf51116dd07753cb6e0e1bc7adfd9/libzig_abi.a -lc++ -lswiftCxx -lswiftCxxStdlib -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser -lswiftCore -lc -target native-native -mcpu=znver3 -lunwind "
clang version 17.0.0 (https://github.com/swiftlang/llvm-project.git 9d45b9c9d5c48a092cca2ace3743125b4e42725c)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1
Found candidate GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1
Selected GCC installation: /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/home/kassane/anotherBuildStep/.zig-cache/o/f1f9a84666bfa391f83adf5acb58f32b/zcc" -pie --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/Scrt1.o /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/crtbeginS.o -L/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux -L/usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1 -L/usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/lib -L/usr/lib --build-id -rpath /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/linux/x86_64/swiftrt.o /tmp/TemporaryDirectory.lQzIxg/swift_example-1.o /tmp/TemporaryDirectory.lQzIxg/main-1.o /home/kassane/anotherBuildStep/.zig-cache/o/bc3cf51116dd07753cb6e0e1bc7adfd9/libzig_abi.a -lc++ -lswiftCxx -lswiftCxxStdlib -lswiftSwiftOnoneSupport -lswiftCore -lswift_Concurrency -lswift_StringProcessing -lswift_RegexParser -lswiftCore -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/crtendS.o /usr/lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../lib64/crtn.o
Build Summary: 5/5 steps succeeded
install success
└─ swift_example success 437ms MaxRSS:163M
   ├─ zig build-exe zcc ReleaseSafe native success 7s MaxRSS:229M
   │  └─ options success
   ├─ zig build-exe zcc ReleaseSafe native (+1 more reused dependencies)
   └─ zig build-lib zig_abi ReleaseSmall native success 45ms MaxRSS:117M
cross-build
~/Downloads/zig-linux-x86_64-0.13.0/zig build --summary all --verbose -Dtarget=aarch64-linux
/home/kassane/Downloads/zig-linux-x86_64-0.13.0/zig build-lib -OReleaseSmall -target aarch64-linux -mcpu baseline -Mroot=/home/kassane/anotherBuildStep/examples/zig_abi.zig -lc --cache-dir /home/kassane/anotherBuildStep/.zig-cache --global-cache-dir /home/kassane/.cache/zig --name zig_abi -static --listen=- 
/home/kassane/Downloads/zig-linux-x86_64-0.13.0/zig build-exe -OReleaseSafe --dep build_options -Mroot=/home/kassane/anotherBuildStep/tools/zigcc.zig -Mbuild_options=/home/kassane/anotherBuildStep/.zig-cache/c/ac477cbcacdcdbe3f19ea1d29c9e0030/options.zig --cache-dir /home/kassane/anotherBuildStep/.zig-cache --global-cache-dir /home/kassane/.cache/zig --name zcc --listen=- 
swiftc -import-bridging-header examples/c_include.h -g -clang-scanner-module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -Xfrontend -disable-llvm-verify examples/main.swift -v -cxx-interoperability-mode=default -parse-as-library -Xcc -stdlib=libc++ -parse-stdlib -target arm64-unknown-linux-musl -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example -ld-path=/home/kassane/anotherBuildStep/.zig-cache/o/53df6cb343ca4fdf7b1eef8868271284/zcc -use-ld=/home/kassane/anotherBuildStep/.zig-cache/o/53df6cb343ca4fdf7b1eef8868271284/zcc /home/kassane/anotherBuildStep/.zig-cache/o/a3817ff4d248ac9b4c1ed32cf21e9939/libzig_abi.a 
Swift version 6.1-dev (LLVM 9d45b9c9d5c48a0, Swift 08721cf939ec503)
Target: arm64-unknown-linux-musl
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -target arm64-unknown-linux-musl -Xllvm -aarch64-use-tbi -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -parse-stdlib -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /home/kassane/anotherBuildStep/examples/c_include.h -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -emit-pch -o /tmp/TemporaryDirectory.51cI71/c_include.pch /home/kassane/anotherBuildStep/examples/c_include.h
/home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -c -primary-file /home/kassane/anotherBuildStep/examples/main.swift -disable-objc-attr-requires-foundation-module -target arm64-unknown-linux-musl -Xllvm -aarch64-use-tbi -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -parse-stdlib -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /tmp/TemporaryDirectory.51cI71/c_include.pch -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -parse-as-library -o /tmp/TemporaryDirectory.51cI71/main-1.o
error: compile command failed due to signal 6 (use -v to see invocation)
swift-frontend: /home/build-user/swift/lib/ClangImporter/ImportType.cpp:1613: swift::ImportedType adjustTypeForConcreteImport(ClangImporter::Implementation &, (anonymous namespace)::ImportResult, swift::ImportTypeKind, bool, swift::Bridgeability, llvm::function_ref<void (Diagnostic &&)>, swift::ImportTypeAttrs, swift::OptionalTypeKind, bool, clang::Qualifiers::ObjCLifetime): Assertion `importedType' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/bin/swift-frontend -frontend -c -primary-file /home/kassane/anotherBuildStep/examples/main.swift -disable-objc-attr-requires-foundation-module -target arm64-unknown-linux-musl -Xllvm -aarch64-use-tbi -disable-objc-interop -cxx-interoperability-mode=default -color-diagnostics -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -parse-stdlib -disable-llvm-verify -empty-abi-descriptor -Xcc -working-directory -Xcc /home/kassane/anotherBuildStep -resource-dir /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /home/kassane/anotherBuildStep -Xcc -stdlib=libc++ -import-objc-header /tmp/TemporaryDirectory.51cI71/c_include.pch -module-name swift_example -in-process-plugin-server-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/libSwiftInProcPluginServer.so -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/lib/swift/host/plugins -plugin-path /home/kassane/.local/share/swiftly/toolchains/main-snapshot-2024-08-21/usr/local/lib/swift/host/plugins -parse-as-library -o /tmp/TemporaryDirectory.51cI71/main-1.o
1.      Swift version 6.1-dev (LLVM 9d45b9c9d5c48a0, Swift 08721cf939ec503)
2.      Compiling with effective version 5.10
3.      While evaluating request TypeCheckSourceFileRequest(source_file "/home/kassane/anotherBuildStep/examples/main.swift")
4.      While evaluating request TypeCheckFunctionBodyRequest(swift_example.(file).HelloWorld.main()@/home/kassane/anotherBuildStep/examples/main.swift:5:17)
5.      While type-checking statement at [/home/kassane/anotherBuildStep/examples/main.swift:5:24 - line:10:5] RangeText="{
        let message = "Hello, World!"
        message.withCString { cString in
            println(cString)
        }
    "
6.      While type-checking expression at [/home/kassane/anotherBuildStep/examples/main.swift:7:9 - line:9:9] RangeText="message.withCString { cString in
            println(cString)
        "
7.      While type-checking-target starting at /home/kassane/anotherBuildStep/examples/main.swift:7:17
8.      While evaluating request UnqualifiedLookupRequest(looking up 'println' from 0x567994a87588 AbstractClosureExpr line=7 : <null> with options { AllowProtocolMembers, IncludeOuterResults })
9.      While evaluating request LookupInModuleRequest(0x567994a86858 FileUnit file="/home/kassane/anotherBuildStep/examples/main.swift", 'println', UnqualifiedLookup, Overloadable, 0x567994a86858 FileUnit file="/home/kassane/anotherBuildStep/examples/main.swift", { NL_RemoveNonVisible, NL_RemoveOverridden })
10.     /home/kassane/anotherBuildStep/examples/c_include.h:7:6: importing 'println'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend 0x00005679818bd837
1  swift-frontend 0x00005679818bb53e
2  swift-frontend 0x00005679818bdeaf
3  libc.so.6      0x00007778c244c1d0
4  libc.so.6      0x00007778c24a53f4
5  libc.so.6      0x00007778c244c120 gsignal + 32
6  libc.so.6      0x00007778c24334c3 abort + 223
7  libc.so.6      0x00007778c24333df
8  libc.so.6      0x00007778c2444177
9  swift-frontend 0x000056797c46efc4
10 swift-frontend 0x000056797c47083c
11 swift-frontend 0x000056797c470ddd
12 swift-frontend 0x000056797c4498a9
13 swift-frontend 0x000056797c444114
14 swift-frontend 0x000056797c424464
15 swift-frontend 0x000056797c425876
16 swift-frontend 0x000056797c3b1ddf
17 swift-frontend 0x000056797c3b157b
18 swift-frontend 0x000056797c82369e
19 swift-frontend 0x000056797c865f37
20 swift-frontend 0x000056797c865b2a
21 swift-frontend 0x000056797c898145
22 swift-frontend 0x000056797c86736c
23 swift-frontend 0x000056797c866665
24 swift-frontend 0x000056797c866581
25 swift-frontend 0x000056797c99d5a6
26 swift-frontend 0x000056797c8982ce
27 swift-frontend 0x000056797bef6de7
28 swift-frontend 0x000056797bef6c99
29 swift-frontend 0x000056797c27d637
30 swift-frontend 0x000056797c0ef996
31 swift-frontend 0x000056797c0f4ca3
32 swift-frontend 0x000056797c64d24c
33 swift-frontend 0x000056797c64f55e
34 swift-frontend 0x000056797c64d37e
35 swift-frontend 0x000056797c64fac8
36 swift-frontend 0x000056797c64f7c4
37 swift-frontend 0x000056797c64f9f1
38 swift-frontend 0x000056797c64f7c4
39 swift-frontend 0x000056797c64e802
40 swift-frontend 0x000056797c64d63b
41 swift-frontend 0x000056797c652b73
42 swift-frontend 0x000056797c652a14
43 swift-frontend 0x000056797c64f5b9
44 swift-frontend 0x000056797c64d37e
45 swift-frontend 0x000056797c64d223
46 swift-frontend 0x000056797c0ff72e
47 swift-frontend 0x000056797c0f3b32
48 swift-frontend 0x000056797c1ac383
49 swift-frontend 0x000056797c1ac2bd
50 swift-frontend 0x000056797c1ac198
51 swift-frontend 0x000056797c32506b
52 swift-frontend 0x000056797c32978c
53 swift-frontend 0x000056797c32773c
54 swift-frontend 0x000056797c326b93
55 swift-frontend 0x000056797c326725
56 swift-frontend 0x000056797c76e3e3
57 swift-frontend 0x000056797c6cda59
58 swift-frontend 0x000056797c8350fb
59 swift-frontend 0x000056797c3737a1
60 swift-frontend 0x000056797c375e87
61 swift-frontend 0x000056797c373675
62 swift-frontend 0x000056797ae54e69
63 swift-frontend 0x000056797ae4bfca
64 swift-frontend 0x000056797ae4bf67
65 swift-frontend 0x000056797ab0f19e
66 swift-frontend 0x000056797ab011f1
67 swift-frontend 0x000056797aafff02
68 swift-frontend 0x000056797a8ef954
69 libc.so.6      0x00007778c2434e08
70 libc.so.6      0x00007778c2434ecc __libc_start_main + 140
71 swift-frontend 0x000056797a8ee9ee
install
└─ swift_example failure
error: the following command exited with error code 1:
swiftc -import-bridging-header examples/c_include.h -g -clang-scanner-module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -module-cache-path /home/kassane/anotherBuildStep/.zig-cache/o/dd6ab5043092597b04e52dd988141101 -Xfrontend -disable-llvm-verify examples/main.swift -v -cxx-interoperability-mode=default -parse-as-library -Xcc -stdlib=libc++ -parse-stdlib -target arm64-unknown-linux-musl -o /home/kassane/anotherBuildStep/zig-out/bin/swift_example -ld-path=/home/kassane/anotherBuildStep/.zig-cache/o/53df6cb343ca4fdf7b1eef8868271284/zcc -use-ld=/home/kassane/anotherBuildStep/.zig-cache/o/53df6cb343ca4fdf7b1eef8868271284/zcc /home/kassane/anotherBuildStep/.zig-cache/o/a3817ff4d248ac9b4c1ed32cf21e9939/libzig_abi.a 
Build Summary: 3/5 steps succeeded; 1 failed
install transitive failure
└─ swift_example failure
   ├─ zig build-exe zcc ReleaseSafe native success 7s MaxRSS:230M
   │  └─ options success
   ├─ zig build-exe zcc ReleaseSafe native (+1 more reused dependencies)
   └─ zig build-lib zig_abi ReleaseSmall aarch64-linux success 37ms MaxRSS:118M
error: the following build command failed with exit code 1:
/home/kassane/anotherBuildStep/.zig-cache/o/8099e5e2c4326baf1914863c67517b45/build /home/kassane/Downloads/zig-linux-x86_64-0.13.0/zig /home/kassane/anotherBuildStep /home/kassane/anotherBuildStep/.zig-cache /home/kassane/.cache/zig --seed 0xc03f32f8 -Z43868b7f0fa84f13 --summary all --verbose -Dtarget=aarch64-linux
@kassane kassane added the bug Something isn't working label Aug 21, 2024
@kassane kassane added enhancement New feature or request and removed bug Something isn't working labels Aug 28, 2024
@kassane
Copy link
Owner Author

kassane commented Aug 31, 2024

New tests swiftc + zig (none SDK), like D lang -betterC mode.

Source
func swiftMain()
{
    print("Hello from Swift")
}

@_cdecl("main")
public func main(_ argc: Int32, _ argv: UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>) -> Int32
{
    swiftMain()
    return 0
}
$ swiftc --version
Swift version 6.1-dev (LLVM fe0f467028c23cf, Swift 406b8bd8921b5dc)
Target: x86_64-unknown-linux-gnu

$ swiftc examples/main.swift -parse-as-library -enable-experimental-feature Embedded -wmo -Xfrontend -function-sections -Xfrontend -disable-stack-protector -import-bridging-header $PWD/examples/bridging.h -Xcc --target=aarch64-linux -c
<unknown>:0: warning: argument unused during compilation: '-mcx16'
<unknown>:0: warning: argument unused during compilation: '-mcx16'
$ file main.o 
main.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (GNU/Linux), not stripped
# note: zig cross-compile use musl-libc by default [linux-target only]
$ zig cc main.o -o swift_main -target aarch64-linux
$ ./swift_main
Hello from Swift
$ ldd swift_main
   not a dynamic executable

Similar to flang, dropping some swiftc ldflags in zcc-wrapper can solve cross-minimal support (without stdlib).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant