Skip to content

Compilation errors in pkg/libsignalgo due to CFixedBytes() type mismatch #595

@Dr-Deep

Description

@Dr-Deep

When building the Go wrapper (pkg/libsignalgo), I encounter multiple errors like:

cannot use NewACIServiceID(aci).CFixedBytes() (value of pointer type cPNIType) 
       as *_Ctype_SignalServiceIdFixedWidthBinaryBytes in variable declaration

It appears that CFixedBytes() currently returns a *cPNIType, whereas the C functions expect a *_Ctype_SignalServiceIdFixedWidthBinaryBytes. This mismatch was introduced by a recent change in the libsignal bridge code.

Steps to Reproduce:

  1. Clone the repository and checkout the main branch (or tag v0.8.1).
    git clone https://github.com/mautrix/signal.git
    cd signal
  2. Initialize and update submodules:
    git submodule update --init --recursive
  3. Build the Rust bridge:
    cd rust/bridge
    cargo build --release
  4. Return to the project root and build the Go wrapper:
    cd ../../
    CGO_CFLAGS="-I/usr/local/include" CGO_LDFLAGS="-L/usr/local/lib" go build ./pkg/libsignalgo
  5. Observe the compilation errors as shown above.

Expected Behavior:
pkg/libsignalgo should compile successfully, with CFixedBytes() returning the correct pointer type (*C.SignalServiceIdFixedWidthBinaryBytes) so that the C FFI calls match their signatures.

Environment:

  • OS: HardenedBSD (FreeBSD fork)
  • Go: go1.20.4 freebsd/amd64
  • Rust: rustc 1.70.0
  • Submodule (libsignal) pinned at: efe13e9b363d2c115dba61b76e5e53bbfc2874bc (pre-breaking change)
  • Repo tag: v0.8.1 (Commit 03d675c)

Workaround:
Manually pinning the libsignal submodule to the pre-update commit (efe13e9b…) restores compatibility and allows the build to succeed.

Proposed Fix:

  1. Update CFixedBytes() in pkg/libsignalgo to explicitly return *C.SignalServiceIdFixedWidthBinaryBytes (for example, via an unsafe.Pointer cast).
  2. Alternatively, adjust the underlying C type definitions in the libsignal bridge so they remain compatible with the existing Go bindings.

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions