Skip to content

feat: statically link libchat#83

Merged
osmaczko merged 1 commit intomainfrom
feat/use-static-linking
Mar 1, 2026
Merged

feat: statically link libchat#83
osmaczko merged 1 commit intomainfrom
feat/use-static-linking

Conversation

@osmaczko
Copy link
Contributor

@osmaczko osmaczko commented Feb 23, 2026

Add rust-bundle, a single staticlib crate that depends on both libchat
and rln as rlibs. This ensures rustc links Rust std exactly once,
eliminating duplicate symbol errors on all platforms. Nim targets link
against liblogos_chat_bundle.a; Nix uses a bundleDrv instead of
separate libchat and rln derivations.

Reference: https://doc.rust-lang.org/reference/linkage.html#mixed-rust-and-foreign-codebases

Requires: logos-messaging/libchat#61

@osmaczko osmaczko requested review from Copilot and jazzz February 23, 2026 21:13
@osmaczko osmaczko added the Do Not Merge This PR should be only be merged after some dependency label Feb 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the build system to statically link libchat directly into liblogoschat.so, eliminating the need for dynamic linking. The changes move library path configuration from nimble tasks into Makefile and Nix files, and standardize naming by renaming librln to librlnDrv.

Changes:

  • Static linking of liblibchat.a instead of dynamic linking
  • Removal of CONVERSATIONS_LIB environment variable and runtime library path handling
  • Renaming of librln to librlnDrv for consistency with libchatDrv naming convention

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vendor/libchat Updates submodule to version that supports static linking
nix/shell.nix Removes CONVERSATIONS_LIB environment variable setup
nix/default.nix Adds static library linking flags and removes dynamic library path configuration
flake.nix Renames librln to librlnDrv for consistency
Makefile Adds static library linking and multiple definition handling for tests and liblogoschat targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jazzz
Copy link
Collaborator

jazzz commented Feb 25, 2026

I don't see any blockers for this, except the make build doesn't work.

Out of curiosity Is Nix replacing the Makefile or will they live in parallel?

@osmaczko osmaczko force-pushed the feat/use-static-linking branch from e02a98b to e98b1ac Compare February 25, 2026 19:15
Copy link
Collaborator

@jazzz jazzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing the path for this.

Once tests are working I don't see any issues with this

@osmaczko osmaczko force-pushed the feat/use-static-linking branch 5 times, most recently from f933197 to b5069cf Compare February 28, 2026 12:03
@osmaczko
Copy link
Contributor Author

Clearing the path for this.

Once tests are working I don't see any issues with this

@jazzz The approach has changed, see updated description, please re-review 🙏

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@osmaczko osmaczko force-pushed the feat/use-static-linking branch 4 times, most recently from 84918d0 to 62cb08f Compare February 28, 2026 20:04
@osmaczko osmaczko removed the Do Not Merge This PR should be only be merged after some dependency label Feb 28, 2026
@osmaczko osmaczko force-pushed the feat/use-static-linking branch from 62cb08f to f5aa1a7 Compare February 28, 2026 20:11
Copy link
Contributor

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@@ -0,0 +1,12 @@
[package]
name = "rust-bundle"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "rust-bundle"
name = "logos-chat-rust-bundle"

edition = "2024"

[lib]
name = "rust_bundle"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "rust_bundle"
name = "logos_chat_rust_bundle"

@osmaczko osmaczko requested a review from plopezlpz March 1, 2026 10:54
Copy link
Contributor

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah it's a static linking, sot the library name is internal, I don't care then

@osmaczko osmaczko force-pushed the feat/use-static-linking branch from f5aa1a7 to 1dd30d0 Compare March 1, 2026 12:10
Add rust-bundle, a single staticlib crate that depends on both libchat
and rln as rlibs. This ensures rustc links Rust std exactly once,
eliminating duplicate symbol errors on all platforms. Nim targets link
against liblogos_chat_bundle.a; Nix uses a bundleDrv instead of
separate libchat and rln derivations.

Reference: https://doc.rust-lang.org/reference/linkage.html#mixed-rust-and-foreign-codebases
@osmaczko osmaczko force-pushed the feat/use-static-linking branch from 1dd30d0 to 274e5c0 Compare March 1, 2026 16:07
@osmaczko osmaczko merged commit 53302e4 into main Mar 1, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

5 participants