Closed iLynxcat closed 2 months ago
Hi, could you please try checking out the more-swift-6
branch to see if that fixes it? See #34.
Testing now, sorry for the delay
Looks like it has an issue linking libModule:
error: link command failed with exit code 1 (use -v to see invocation) Undefined symbols for architecture arm64: "_napi_acquire_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.close() throws -> () in NodeAsyncQueue.swift.o "_napi_add_async_cleanup_hook", referenced from: NodeAPI.NodeEnvironment.addCleanupHook(action: (() -> ()) -> ()) throws -> NodeAPI.AsyncCleanupHook in NodeEnvironment.swift.o "_napi_add_env_cleanup_hook", referenced from: NodeAPI.NodeEnvironment.addCleanupHook(action: @Sendable () -> ()) throws -> NodeAPI.CleanupHook in NodeEnvironment.swift.o "_napi_add_finalizer", referenced from: NodeAPI.NodeObject.addFinalizer(() -> ()) throws -> () in NodeObject.swift.o "_napi_adjust_external_memory", referenced from: NodeAPI.NodeEnvironment.adjustExternalMemory(byBytes: Swift.Int64) throws -> Swift.Int64 in NodeEnvironment.swift.o "_napi_call_function", referenced from: NodeAPI.NodeFunction.call(on: NodeAPI.NodeValueConvertible, _: [NodeAPI.NodeValueConvertible]) throws -> NodeAPI.AnyNodeValue in NodeFunction.swift.o "_napi_call_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.(run in _4CAF8D316B1561E5CF1F062C96B4C779)(blocking: Swift.Bool, _: @Sendable (NodeAPI.NodeEnvironment) -> ()) throws -> () in NodeAsyncQueue.swift.o "_napi_close_escapable_handle_scope", referenced from: $defer #1 () -> () in NodeAPI.NodeEnvironment.withScope(perform: () throws -> A) throws -> A in NodeEnvironment.swift.o "_napi_close_handle_scope", referenced from: $defer #1 () -> () in NodeAPI.NodeEnvironment.withScope(perform: () throws -> ()) throws -> () in NodeEnvironment.swift.o "_napi_coerce_to_bool", referenced from: NodeAPI.NodeBool.init(coercing: NodeAPI.NodeValueConvertible) throws -> NodeAPI.NodeBool in NodeBool.swift.o "_napi_coerce_to_number", referenced from: NodeAPI.NodeNumber.init(coercing: NodeAPI.NodeValueConvertible) throws -> NodeAPI.NodeNumber in NodeNumber.swift.o "_napi_coerce_to_object", referenced from: NodeAPI.NodeObject.init(coercing: NodeAPI.NodeValueConvertible) throws -> NodeAPI.NodeObject in NodeObject.swift.o "_napi_coerce_to_string", referenced from: NodeAPI.NodeString.init(coercing: NodeAPI.NodeValueConvertible) throws -> NodeAPI.NodeString in NodeString.swift.o "_napi_create_array", referenced from: NodeAPI.NodeArray.init(capacity: Swift.Int?) throws -> NodeAPI.NodeArray in NodeArray.swift.o "_napi_create_array_with_length", referenced from: NodeAPI.NodeArray.init(capacity: Swift.Int?) throws -> NodeAPI.NodeArray in NodeArray.swift.o "_napi_create_arraybuffer", referenced from: NodeAPI.NodeArrayBuffer.init(capacity: Swift.Int) throws -> NodeAPI.NodeArrayBuffer in NodeArrayBuffer.swift.o "_napi_create_bigint_int64", referenced from: NodeAPI.NodeBigInt.init(signed: Swift.Int64) throws -> NodeAPI.NodeBigInt in NodeBigInt.swift.o "_napi_create_bigint_uint64", referenced from: NodeAPI.NodeBigInt.init(unsigned: Swift.UInt64) throws -> NodeAPI.NodeBigInt in NodeBigInt.swift.o "_napi_create_bigint_words", referenced from: NodeAPI.NodeBigInt.init(sign: NodeAPI.NodeBigInt.Sign, words: [Swift.UInt64]) throws -> NodeAPI.NodeBigInt in NodeBigInt.swift.o "_napi_create_buffer", referenced from: NodeAPI.NodeBuffer.init(capacity: Swift.Int) throws -> NodeAPI.NodeBuffer in NodeBuffer.swift.o "_napi_create_buffer_copy", referenced from: closure #1 (Swift.UnsafeRawBufferPointer) throws -> () in NodeAPI.NodeBuffer.init(copying: Foundation.Data) throws -> NodeAPI.NodeBuffer in NodeBuffer.swift.o "_napi_create_dataview", referenced from: NodeAPI.NodeDataView.init(for: NodeAPI.NodeArrayBuffer, range: A) throws -> NodeAPI.NodeDataView in NodeDataView.swift.o "_napi_create_date", referenced from: NodeAPI.NodeDate.init(Foundation.Date) throws -> NodeAPI.NodeDate in NodeDate.swift.o "_napi_create_double", referenced from: NodeAPI.NodeNumber.init(Swift.Double) throws -> NodeAPI.NodeNumber in NodeNumber.swift.o "_napi_create_error", referenced from: NodeAPI.NodeError.init(code: Swift.String?, message: Swift.String) throws -> NodeAPI.NodeError in NodeError.swift.o "_napi_create_external", referenced from: NodeAPI.NodeExternal.init(value: Any) throws -> NodeAPI.NodeExternal in NodeExternal.swift.o "_napi_create_external_arraybuffer", referenced from: NodeAPI.NodeArrayBuffer.init(bytes: Swift.UnsafeMutableRawBufferPointer, deallocator: NodeAPI.NodeDataDeallocator) throws -> NodeAPI.NodeArrayBuffer in NodeArrayBuffer.swift.o "_napi_create_external_buffer", referenced from: NodeAPI.NodeBuffer.init(bytes: Swift.UnsafeMutableRawBufferPointer, deallocator: NodeAPI.NodeDataDeallocator) throws -> NodeAPI.NodeBuffer in NodeBuffer.swift.o "_napi_create_function", referenced from: closure #1 (Swift.UnsafeBufferPointer) throws -> () in closure #1 (Swift.UnsafeBufferPointer ) throws -> () in NodeAPI.NodeFunction.init(name: Swift.String, callback: @NodeAPI.NodeActor @Sendable (NodeAPI.NodeArguments) throws -> NodeAPI.NodeValueConvertible) throws -> NodeAPI.NodeFunction in NodeFunction.swift.o "_napi_create_object", referenced from: NodeAPI.NodeObject.init(NodeAPI.NodePropertyList ) throws -> NodeAPI.NodeObject in NodeObject.swift.o NodeAPI.NodeValueBase.persist(releaseQueue: NodeAPI.NodeAsyncQueue?) throws -> () in NodeValue.swift.o "_napi_create_promise", referenced from: NodeAPI.NodePromise.Deferred.init() throws -> NodeAPI.NodePromise.Deferred in NodePromise.swift.o "_napi_create_range_error", referenced from: NodeAPI.NodeError.init(rangeErrorCode: Swift.String, message: Swift.String) throws -> NodeAPI.NodeError in NodeError.swift.o "_napi_create_reference", referenced from: NodeAPI.NodeValueBase.persist(releaseQueue: NodeAPI.NodeAsyncQueue?) throws -> () in NodeValue.swift.o "_napi_create_string_utf8", referenced from: closure #1 (Swift.UnsafeBufferPointer ) throws -> () in closure #1 (Swift.UnsafeBufferPointer ) throws -> () in NodeAPI.NodeString.init(Swift.String) throws -> NodeAPI.NodeString in NodeString.swift.o "_napi_create_symbol", referenced from: NodeAPI.NodeSymbol.init(description: Swift.String?) throws -> NodeAPI.NodeSymbol in NodeSymbol.swift.o "_napi_create_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.init(label: Swift.String, asyncResource: NodeAPI.NodeObjectConvertible?, maxQueueSize: Swift.Int?) throws -> NodeAPI.NodeAsyncQueue in NodeAsyncQueue.swift.o "_napi_create_type_error", referenced from: NodeAPI.NodeError.init(typeErrorCode: Swift.String, message: Swift.String) throws -> NodeAPI.NodeError in NodeError.swift.o "_napi_create_typedarray", referenced from: NodeAPI.NodeAnyTypedArray.init(for: NodeAPI.NodeArrayBuffer, kind: NodeAPI.NodeTypedArrayKind, offset: Swift.Int, count: Swift.Int) throws -> NodeAPI.NodeAnyTypedArray in NodeTypedArray.swift.o "_napi_define_class", referenced from: closure #1 (Swift.UnsafeBufferPointer ) throws -> () in closure #2 (Swift.UnsafeBufferPointer ) throws -> () in NodeAPI.NodeFunction.init(className: Swift.String?, properties: NodeAPI.NodePropertyList , constructor: @NodeAPI.NodeActor @Sendable (NodeAPI.NodeArguments) throws -> ()) throws -> NodeAPI.NodeFunction in NodeClass.swift.o "_napi_define_properties", referenced from: NodeAPI.NodeObject.define(NodeAPI.NodePropertyList ) throws -> () in NodeObject.swift.o "_napi_delete_property", referenced from: NodeAPI.NodeObject.DynamicProperty.delete() throws -> Swift.Bool in NodeObject.swift.o "_napi_delete_reference", referenced from: closure #1 @NodeAPI.NodeActor @Sendable () throws -> () in NodeAPI.NodeValueBase.deinit in NodeValue.swift.o "_napi_detach_arraybuffer", referenced from: NodeAPI.NodeArrayBuffer.detach() throws -> () in NodeArrayBuffer.swift.o "_napi_escape_handle", referenced from: NodeAPI.NodeEnvironment.withScope(perform: () throws -> A) throws -> A in NodeEnvironment.swift.o "_napi_fatal_error", referenced from: closure #1 (Swift.UnsafeBufferPointer ) -> Swift.Never in closure #1 (Swift.UnsafeBufferPointer ) -> Swift.Never in closure #1 (Swift.UnsafeBufferPointer ) -> Swift.Never in closure #1 (Swift.UnsafeBufferPointer ) -> Swift.Never in NodeAPI.nodeFatalError(_: Swift.String, file: Swift.StaticString, line: Swift.UInt) -> Swift.Never in NodeThrowable.swift.o "_napi_fatal_exception", referenced from: NodeAPI.NodeEnvironment.throwUncaught(Swift.Error) throws -> () in NodeEnvironment.swift.o "_napi_get_all_property_names", referenced from: NodeAPI.NodeObject.propertyNames(collectionMode: NodeAPI.NodeObject.KeyCollectionMode, filter: NodeAPI.NodeObject.KeyFilter, conversion: NodeAPI.NodeObject.KeyConversion) throws -> NodeAPI.NodeArray in NodeObject.swift.o "_napi_get_and_clear_last_exception", referenced from: NodeAPI.NodeEnvironment.check(__C.napi_status) throws -> () in NodeEnvironment.swift.o "_napi_get_array_length", referenced from: NodeAPI.NodeArray.count() throws -> Swift.Int in NodeArray.swift.o "_napi_get_arraybuffer_info", referenced from: NodeAPI.NodeArrayBuffer.withUnsafeMutableBytes((Swift.UnsafeMutableRawBufferPointer) throws -> A) throws -> A in NodeArrayBuffer.swift.o "_napi_get_boolean", referenced from: NodeAPI.NodeBool.init(Swift.Bool) throws -> NodeAPI.NodeBool in NodeBool.swift.o "_napi_get_cb_info", referenced from: NodeAPI.NodeArguments.init(raw: Swift.OpaquePointer, in: NodeAPI.NodeContext) throws -> NodeAPI.NodeArguments in NodeFunction.swift.o closure #1 (inout Swift.UnsafeMutableBufferPointer , inout Swift.Int) throws -> () in NodeAPI.NodeArguments.init(raw: Swift.OpaquePointer, in: NodeAPI.NodeContext) throws -> NodeAPI.NodeArguments in NodeFunction.swift.o "_napi_get_dataview_info", referenced from: NodeAPI.NodeDataView.arrayBuffer() throws -> NodeAPI.NodeArrayBuffer in NodeDataView.swift.o NodeAPI.NodeDataView.byteRange() throws -> Swift.Range in NodeDataView.swift.o NodeAPI.NodeDataView.withUnsafeMutableBytes((Swift.UnsafeMutableRawBufferPointer) throws -> A) throws -> A in NodeDataView.swift.o "_napi_get_date_value", referenced from: NodeAPI.NodeDate.date() throws -> Foundation.Date in NodeDate.swift.o "_napi_get_element", referenced from: NodeAPI.NodeValueBase.rawValue() throws -> Swift.OpaquePointer in NodeValue.swift.o "_napi_get_global", referenced from: NodeAPI.NodeEnvironment.global.getter : NodeAPI.NodeObject in NodeEnvironment.swift.o "_napi_get_last_error_info", referenced from: NodeAPI.NodeEnvironment.check(__C.napi_status) throws -> () in NodeEnvironment.swift.o "_napi_get_new_target", referenced from: NodeAPI.NodeArguments.init(raw: Swift.OpaquePointer, in: NodeAPI.NodeContext) throws -> NodeAPI.NodeArguments in NodeFunction.swift.o "_napi_get_node_version", referenced from: NodeAPI.NodeEnvironment.nodeVersion.getter : NodeAPI.NodeVersion in NodeEnvironment.swift.o "_napi_get_null", referenced from: NodeAPI.NodeNull.init() throws -> NodeAPI.NodeNull in NodeNull.swift.o "_napi_get_property", referenced from: NodeAPI.NodeObject.DynamicProperty.nodeValue() throws -> NodeAPI.NodeValue in NodeObject.swift.o "_napi_get_prototype", referenced from: NodeAPI.NodeObject.prototype() throws -> NodeAPI.AnyNodeValue in NodeObject.swift.o "_napi_get_reference_value", referenced from: NodeAPI.NodeValueBase.rawValue() throws -> Swift.OpaquePointer in NodeValue.swift.o "_napi_get_typedarray_info", referenced from: static NodeAPI.NodeAnyTypedArray.(isObjectType in _83CB134B64B44ED7C9FDD12D80C308E8)(for: NodeAPI.NodeValueBase, kind: NodeAPI.NodeTypedArrayKind?) throws -> Swift.Bool in NodeTypedArray.swift.o NodeAPI.NodeAnyTypedArray.kind() throws -> NodeAPI.NodeTypedArrayKind in NodeTypedArray.swift.o NodeAPI.NodeAnyTypedArray.byteOffset() throws -> Swift.Int in NodeTypedArray.swift.o NodeAPI.NodeAnyTypedArray.withUnsafeMutableRawBytes((Swift.UnsafeMutableRawBufferPointer) throws -> A) throws -> A in NodeTypedArray.swift.o "_napi_get_undefined", referenced from: NodeAPI.NodeUndefined.init() throws -> NodeAPI.NodeUndefined in NodeUndefined.swift.o "_napi_get_value_bigint_int64", referenced from: NodeAPI.NodeBigInt.signed() throws -> (value: Swift.Int64, lossless: Swift.Bool) in NodeBigInt.swift.o "_napi_get_value_bigint_uint64", referenced from: NodeAPI.NodeBigInt.unsigned() throws -> (value: Swift.UInt64, lossless: Swift.Bool) in NodeBigInt.swift.o "_napi_get_value_bigint_words", referenced from: NodeAPI.NodeBigInt.words() throws -> (sign: NodeAPI.NodeBigInt.Sign, words: [Swift.UInt64]) in NodeBigInt.swift.o closure #1 (inout Swift.UnsafeMutableBufferPointer , inout Swift.Int) throws -> () in NodeAPI.NodeBigInt.words() throws -> (sign: NodeAPI.NodeBigInt.Sign, words: [Swift.UInt64]) in NodeBigInt.swift.o "_napi_get_value_bool", referenced from: NodeAPI.NodeBool.bool() throws -> Swift.Bool in NodeBool.swift.o "_napi_get_value_double", referenced from: NodeAPI.NodeNumber.double() throws -> Swift.Double in NodeNumber.swift.o "_napi_get_value_external", referenced from: NodeAPI.NodeExternal.value() throws -> Any in NodeExternal.swift.o "_napi_get_value_string_utf8", referenced from: NodeAPI.NodeString.string() throws -> Swift.String in NodeString.swift.o closure #1 (Swift.UnsafeMutableBufferPointer ) throws -> Swift.Int in closure #1 (Swift.UnsafeMutableBufferPointer ) throws -> Swift.Int in NodeAPI.NodeString.string() throws -> Swift.String in NodeString.swift.o "_napi_get_version", referenced from: NodeAPI.NodeEnvironment.apiVersion.getter : Swift.Int in NodeEnvironment.swift.o "_napi_has_own_property", referenced from: NodeAPI.NodeObject.hasOwnProperty(NodeAPI.NodeName) throws -> Swift.Bool in NodeObject.swift.o "_napi_has_property", referenced from: NodeAPI.NodeObject.DynamicProperty.exists() throws -> Swift.Bool in NodeObject.swift.o "_napi_instanceof", referenced from: NodeAPI.NodeObject.isInstance(of: NodeAPI.NodeFunction) throws -> Swift.Bool in NodeObject.swift.o "_napi_is_array", referenced from: static NodeAPI.NodeArray.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeArray.swift.o "_napi_is_arraybuffer", referenced from: static NodeAPI.NodeArrayBuffer.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeArrayBuffer.swift.o "_napi_is_buffer", referenced from: static NodeAPI.NodeBuffer.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeBuffer.swift.o "_napi_is_dataview", referenced from: static NodeAPI.NodeDataView.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeDataView.swift.o "_napi_is_date", referenced from: static NodeAPI.NodeDate.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeDate.swift.o "_napi_is_detached_arraybuffer", referenced from: NodeAPI.NodeArrayBuffer.isDetached() throws -> Swift.Bool in NodeArrayBuffer.swift.o "_napi_is_error", referenced from: static NodeAPI.NodeError.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodeError.swift.o "_napi_is_exception_pending", referenced from: NodeAPI.NodeEnvironment.check(__C.napi_status) throws -> () in NodeEnvironment.swift.o "_napi_is_promise", referenced from: static NodeAPI.NodePromise.isObjectType(for: NodeAPI.NodeValueBase) throws -> Swift.Bool in NodePromise.swift.o "_napi_is_typedarray", referenced from: static NodeAPI.NodeAnyTypedArray.(isObjectType in _83CB134B64B44ED7C9FDD12D80C308E8)(for: NodeAPI.NodeValueBase, kind: NodeAPI.NodeTypedArrayKind?) throws -> Swift.Bool in NodeTypedArray.swift.o "_napi_new_instance", referenced from: NodeAPI.NodeFunction.construct(withArguments: [NodeAPI.NodeValueConvertible]) throws -> NodeAPI.NodeObject in NodeFunction.swift.o "_napi_object_freeze", referenced from: NodeAPI.NodeObject.freeze() throws -> () in NodeObject.swift.o "_napi_object_seal", referenced from: NodeAPI.NodeObject.seal() throws -> () in NodeObject.swift.o "_napi_open_escapable_handle_scope", referenced from: NodeAPI.NodeEnvironment.withScope(perform: () throws -> A) throws -> A in NodeEnvironment.swift.o "_napi_open_handle_scope", referenced from: NodeAPI.NodeEnvironment.withScope(perform: () throws -> ()) throws -> () in NodeEnvironment.swift.o "_napi_ref_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.Handle.(in _4CAF8D316B1561E5CF1F062C96B4C779).init(NodeAPI.NodeAsyncQueue) throws -> NodeAPI.NodeAsyncQueue.Handle in NodeAsyncQueue.swift.o "_napi_reject_deferred", referenced from: NodeAPI.NodePromise.Deferred.callAsFunction(Swift.Result ) throws -> () in NodePromise.swift.o "_napi_release_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.close() throws -> () in NodeAsyncQueue.swift.o NodeAPI.NodeAsyncQueue.deinit in NodeAsyncQueue.swift.o "_napi_remove_async_cleanup_hook", referenced from: closure #1 () -> () in NodeAPI.(cAsyncCleanupHook in _2059BFC551DF27E7E153EA987DAC74DB)(handle: Swift.OpaquePointer?, payload: Swift.UnsafeMutableRawPointer?) -> () in NodeEnvironment.swift.o NodeAPI.NodeEnvironment.removeCleanupHook(NodeAPI.AsyncCleanupHook) throws -> () in NodeEnvironment.swift.o "_napi_remove_env_cleanup_hook", referenced from: NodeAPI.NodeEnvironment.removeCleanupHook(NodeAPI.CleanupHook) throws -> () in NodeEnvironment.swift.o "_napi_resolve_deferred", referenced from: NodeAPI.NodePromise.Deferred.callAsFunction(Swift.Result ) throws -> () in NodePromise.swift.o "_napi_run_script", referenced from: NodeAPI.NodeEnvironment.run(script: Swift.String) throws -> NodeAPI.AnyNodeValue in NodeEnvironment.swift.o "_napi_set_element", referenced from: NodeAPI.NodeValueBase.persist(releaseQueue: NodeAPI.NodeAsyncQueue?) throws -> () in NodeValue.swift.o "_napi_set_property", referenced from: NodeAPI.NodeObject.DynamicProperty.set(to: NodeAPI.NodeValueConvertible) throws -> () in NodeObject.swift.o "_napi_strict_equals", referenced from: static (extension in NodeAPI):NodeAPI.NodeValue.== infix(A, A) -> Swift.Bool in NodeValue.swift.o "_napi_throw", referenced from: NodeAPI.NodeEnvironment.throw(Swift.Error) throws -> () in NodeEnvironment.swift.o "_napi_typeof", referenced from: NodeAPI.NodeValueBase.nodeType() throws -> NodeAPI.NodeValueType in NodeValue.swift.o "_napi_unref_threadsafe_function", referenced from: NodeAPI.NodeAsyncQueue.init(label: Swift.String, asyncResource: NodeAPI.NodeObjectConvertible?, maxQueueSize: Swift.Int?) throws -> NodeAPI.NodeAsyncQueue in NodeAsyncQueue.swift.o closure #1 @NodeAPI.NodeActor @Sendable () -> () in closure #1 @Sendable (NodeAPI.NodeEnvironment) -> () in NodeAPI.NodeAsyncQueue.Handle.deinit in NodeAsyncQueue.swift.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) [297/298] Linking libModule.dylib
Trying to build using Swift 6.0 on macOS 15.0 Beta.
Output and error:
This is the expression being referenced:
https://github.com/kabiroberai/node-swift/blob/827802f140039ec9aba9bb574c5bbff353aed385/Sources/NodeAPI/NodeClass.swift#L247-L250
As much as I love Swift I'm still a newbie enough to not quite understand and put in a proper fix PR here.
Version in Package.swift:
I tried using 1.2.0 but there were a bunch more errors that don't seem to be present here.