fix: building liblogoschat

- build liblogoschat and required liblibchat
- update libchat and nim-ffi to latest
This commit is contained in:
pablo 2026-02-22 08:54:45 +02:00
parent d15bcb0729
commit e694d17718
No known key found for this signature in database
GPG Key ID: 78F35FCC60FDC63A
5 changed files with 25 additions and 4 deletions

View File

@ -130,6 +130,15 @@ liblogoschat: | build-waku-librln build-waku-nat build-libchat logos_chat.nims
$(ENV_SCRIPT) nim liblogoschat $(NIM_PARAMS) --path:src logos_chat.nims && \
echo -e "\n\x1B[92mLibrary built successfully:\x1B[39m" && \
echo " $(shell pwd)/$(LIBLOGOSCHAT)"
ifeq ($(shell uname -s),Darwin)
@cp vendor/libchat/target/release/liblibchat.dylib build/
@# Fix install names so the dylibs are relocatable (no absolute paths)
@install_name_tool -id @rpath/liblibchat.dylib build/liblibchat.dylib
@echo " $(shell pwd)/build/liblibchat.dylib"
else ifeq ($(shell uname -s),Linux)
@cp vendor/libchat/target/release/liblibchat.so build/
@echo " $(shell pwd)/build/liblibchat.so"
endif
endif

View File

@ -77,5 +77,17 @@ task pingpong, "Build the Pingpong example":
buildBinary name, "examples/", "-d:chronicles_log_level='INFO' -d:chronicles_disabled_topics='waku node' "
task liblogoschat, "Build the Logos-Chat shared library (C bindings)":
# Dynamically link liblibchat (Rust) on both platforms.
# Clients must distribute liblibchat.so/.dylib alongside liblogoschat.so/.dylib.
# Cannot static link because of duplicate symbols: both liblibchat.a and librln embed Rust's std
var linkFlags = ""
when defined(linux):
staticLinkFlags = " -d:CONVERSATIONS_LIB:liblibchat.so" &
" --passL:-Wl,-rpath,'$$ORIGIN'"
elif defined(macosx):
linkFlags = " -d:CONVERSATIONS_LIB:@rpath/liblibchat.dylib" &
" --passL:-Wl,-rpath,@loader_path"
buildLibrary "logoschat", "library/",
"-d:chronicles_log_level='INFO' -d:chronicles_enabled=on --path:src --path:vendor/nim-ffi"
"-d:chronicles_log_level='INFO' -d:chronicles_enabled=on --path:src --path:vendor/nim-ffi" &
linkFlags

View File

@ -81,7 +81,7 @@ proc newClient*(ds: WakuClient, ident: Identity): ChatClient {.raises: [IOError,
var q = QueueRef(queue: newAsyncQueue[ChatPayload](10))
var c = ChatClient(
libchatCtx: newConversationsContext(),
libchatCtx: newConversationsContext(ident.getName()),
ds: ds,
id: ident.getName(),
inboundQueue: q,

2
vendor/libchat vendored

@ -1 +1 @@
Subproject commit a9ca4ffb7de90ea4cd269350c189c19fb78a2589
Subproject commit 960bb195a13657a09fa2df66262b3b2ced738f30

2
vendor/nim-ffi vendored

@ -1 +1 @@
Subproject commit c2c03f1f0f300ec3aab8b733fe97575f452f6133
Subproject commit bb8a3e7e221c36effd528605a6eb8ecd0f8b22dd