Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(convert): dyn linking (#3320)
Sean Aye78ee528f97db
diff --git a/rust/cloud-storage/Dockerfile.convert_service.prebuilt b/rust/cloud-storage/Dockerfile.convert_service.prebuiltindex b19d7d4965..07c88cb029 100644--- a/rust/cloud-storage/Dockerfile.convert_service.prebuilt+++ b/rust/cloud-storage/Dockerfile.convert_service.prebuilt@@ -37,6 +37,23 @@ COPY ./prebuilt/nix-store/ /nix/store/COPY ./prebuilt/${SERVICE_NAME} /app/svcRUN chmod +x /app/svc+# The nix-built binary uses the nix dynamic linker, which doesn't search system+# library paths (/usr/lib, /lib). LibreOfficeKit's libmergedlo.so is loaded via+# dlopen at runtime and depends on system libraries (libz, libfreetype, etc.).+# We symlink system shared libs into the LOK program dir so they are found via+# LD_LIBRARY_PATH, but skip libs that the nix binary provides (glibc, OpenSSL,+# gcc) to avoid version conflicts between nix and system libraries.+RUN for lib in /usr/lib/x86_64-linux-gnu/*.so* /lib/x86_64-linux-gnu/*.so*; do \+ name="$(basename "$lib")"; \+ case "$name" in \+ libc.so*|libm.so*|libdl.so*|librt.so*|libpthread.so*|ld-linux*) continue ;; \+ libssl.so*|libcrypto.so*) continue ;; \+ libgcc_s.so*) continue ;; \+ esac; \+ [ ! -e "/app/lok/instdir/program/$name" ] && ln -s "$lib" "/app/lok/instdir/program/$name" 2>/dev/null || true; \+ done+ENV PORT=8080+ENV LD_LIBRARY_PATH=/app/lok/instdir/programEXPOSE ${PORT}ENTRYPOINT ["dumb-init", "./svc"]diff --git a/rust/cloud-storage/convert_service/src/main.rs b/rust/cloud-storage/convert_service/src/main.rsindex b40d5f5d54..68284c2da6 100644--- a/rust/cloud-storage/convert_service/src/main.rs+++ b/rust/cloud-storage/convert_service/src/main.rs@@ -16,11 +16,55 @@ mod model;mod process;mod utils;+/// Smoke-tests LibreOfficeKit by forking a child process that initializes LOK.+/// Fails fast at startup if the LOK shared libraries cannot be loaded.+fn smoke_test_lok(lok_path: &str) -> anyhow::Result<()> {+ use nix::unistd::{ForkResult, fork};++ tracing::info!("running LOK smoke test");++ match unsafe { fork() } {+ Ok(ForkResult::Parent { child }) => {+ let status = nix::sys::wait::waitpid(child, None)+ .context("failed to wait for LOK smoke test child")?;+ match status {+ nix::sys::wait::WaitStatus::Exited(_, 0) => {+ tracing::info!("LOK smoke test passed");+ Ok(())+ }+ _ => {+ anyhow::bail!("LOK smoke test failed with status: {:?}", status);+ }+ }+ }+ Ok(ForkResult::Child) => unsafe {+ std::env::set_var("SAL_LOG", "");+ let result = rs_libreoffice_bindings::Office::new(lok_path);+ match result {+ Ok(office) => {+ drop(office);+ nix::libc::exit(0);+ }+ Err(e) => {+ eprintln!("LOK smoke test: failed to initialize LibreOfficeKit: {e}");+ nix::libc::exit(1);+ }+ }+ },+ Err(e) => {+ anyhow::bail!("LOK smoke test fork failed: {e}");+ }+ }+}+#[tokio::main]async fn main() -> anyhow::Result<()> {let env = Environment::new_or_prod();MacroEntrypoint::new(env).init();+ let lok_path = std::env::var("LOK_PATH").context("LOK_PATH must be provided")?;+ smoke_test_lok(&lok_path)?;+let aws_config = macro_aws_config::get_macro_aws_config().await;let secretsmanager_client = secretsmanager_client::SecretsManager::new(