In order to compile using macros, LD_LIBRARY_PATH needs to be extended otherwise getting compilation errors:
error: external macro implementation type 'FoundationMacros.PredicateMacro' could not be found for macro 'Predicate'; compiler plugin '/usr/lib/swift/host/plugins/libFoundationMacros.so' could not be loaded; libswift_StringProcessing.so: cannot open shared object file: No such file or directory
31 | self.context = context
32 |
33 | let allInstruments = #Predicate<InstrumentReferenceData> { _ in
| `- error: external macro implementation type 'FoundationMacros.PredicateMacro' could not be found for macro 'Predicate'; compiler plugin '/usr/lib/swift/host/plugins/libFoundationMacros.so' could not be loaded; libswift_StringProcessing.so: cannot open shared object file: No such file or directory
34 | true
35 | }
FoundationEssentials.Predicate:2:40: note: 'Predicate' declared here
1 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
2 | @freestanding(expression) public macro Predicate<each Input>(_ body: (repeat each Input) -> Bool) -> Predicate<repeat each Input> = #externalMacro(module: "FoundationMacros", type: "PredicateMacro")
| `- note: 'Predicate' declared here
Several libraries cannot be found:
$ docker run -t swiftlang/swift:nightly-main-jammy ldd /usr/lib/swift/host/plugins/libFoundationMacros.so
linux-vdso.so.1 (0x00007ffdc13f6000)
libSwiftSyntaxMacros.so => /usr/lib/swift/host/plugins/../libSwiftSyntaxMacros.so (0x00007f2816014000)
libSwiftSyntaxBuilder.so => /usr/lib/swift/host/plugins/../libSwiftSyntaxBuilder.so (0x00007f2815f70000)
libSwiftParserDiagnostics.so => /usr/lib/swift/host/plugins/../libSwiftParserDiagnostics.so (0x00007f2815e90000)
libSwiftBasicFormat.so => /usr/lib/swift/host/plugins/../libSwiftBasicFormat.so (0x00007f2815e6c000)
libSwiftParser.so => /usr/lib/swift/host/plugins/../libSwiftParser.so (0x00007f2815c71000)
libSwiftDiagnostics.so => /usr/lib/swift/host/plugins/../libSwiftDiagnostics.so (0x00007f2815c4a000)
libSwiftSyntax.so => /usr/lib/swift/host/plugins/../libSwiftSyntax.so (0x00007f28151f3000)
libswiftCore.so => not found
libswift_Concurrency.so => not found
libswift_StringProcessing.so => not found
libswift_RegexParser.so => not found
libswiftGlibc.so => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2815107000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2814ede000)
libswiftGlibc.so => /usr/lib/swift/host/plugins/../../linux/libswiftGlibc.so (0x00007f2814ecb000)
libswift_Concurrency.so => /usr/lib/swift/host/plugins/../../linux/libswift_Concurrency.so (0x00007f2814e34000)
libswiftCore.so => /usr/lib/swift/host/plugins/../../linux/libswiftCore.so (0x00007f2814772000)
/lib64/ld-linux-x86-64.so.2 (0x00007f281606c000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2814546000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2814526000)
libdispatch.so => /usr/lib/swift/host/plugins/../../linux/libdispatch.so (0x00007f28144c6000)
libBlocksRuntime.so => /usr/lib/swift/host/plugins/../../linux/libBlocksRuntime.so (0x00007f28144c0000)
Hi @shahmishal !
In order to compile using macros,
LD_LIBRARY_PATH
needs to be extended otherwise getting compilation errors:Several libraries cannot be found:
If this is set correctly then libs are found:
I'm not sure if this should be set in build scripts to set to
RPATH
via compile time or solved on container level via the following:As the only affected library is
libFoundationMacros.so