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

duckdb-swift API build failing on Linux #12

Open
2 tasks done
levitatingpineapple opened this issue Feb 22, 2025 · 0 comments
Open
2 tasks done

duckdb-swift API build failing on Linux #12

levitatingpineapple opened this issue Feb 22, 2025 · 0 comments

Comments

@levitatingpineapple
Copy link

levitatingpineapple commented Feb 22, 2025

What happens?

Issue

duckdb-swift bindings are not building on linux with open source swift-foundation due to differences in the interface of Decimal type:

// Interface on Apple platforms
public struct Decimal : @unchecked Sendable {
    public init()
    public init(_exponent: Int32, _length: UInt32, _isNegative: UInt32, _isCompact: UInt32, _reserved: UInt32, _mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16))
    public var _exponent: Int32
    public var _length: UInt32
    public var _isNegative: UInt32
    public var _isCompact: UInt32
    public var _reserved: UInt32
    public var _mantissa: (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
}

// Open source foundation interface
public struct Decimal : Sendable {
    public typealias Mantissa = (UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
    public init(mantissa: UInt64, exponent: Int16, isNegative: Bool)
    public init()
}

Workaround

I managed to compile the bindings by typecasting to a locally declared type, with a matching memory layout and copying over few required bits of the interface: Decimal+Linux.swift. While this workaround would break, if the underlying implementation changes - the typecasting could be covered few tests.

Resources

To Reproduce

To reproduce - simply try building duckdb-swift on any platform which uses open source version of Foundation framework.

OS:

aarch64, debian 12

DuckDB Version:

latest

DuckDB Client:

Swift 6.0.3

Hardware:

No response

Full Name:

Arturs Krumins

Affiliation:

none

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@szarnyasg szarnyasg transferred this issue from duckdb/duckdb Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant