Skip to content

Build fails with OpenSSL header issues on Ubuntu 24.04 + Nix environment causes runtime library path conflicts #72

@uptownhr

Description

@uptownhr

Environment

  • OS: Ubuntu 24.04.2 LTS
  • Rust: 1.88.0
  • Cargo: 1.88.0
  • Node: v20.18.0
  • Bun: 1.2.17
  • Nix: Present in environment

Issue Description

Encountered two separate but related build/runtime issues when building Claudia:

1. OpenSSL Development Headers Not Found

Error:

warning: openssl-sys@0.9.109: /usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
error: failed to run custom build command for `openssl-sys v0.9.109`

Root Cause:
On Ubuntu 24.04, OpenSSL headers are located in /usr/include/x86_64-linux-gnu/openssl/ but the build system looks in /usr/include/openssl/.

Solution:
Even with libssl-dev and pkg-config installed, needed to create symbolic links:

sudo ln -sf /usr/include/x86_64-linux-gnu/openssl/opensslconf.h /usr/include/openssl/opensslconf.h
sudo ln -sf /usr/include/x86_64-linux-gnu/openssl/configuration.h /usr/include/openssl/configuration.h

2. Nix Environment Contamination

Error:

claudia: error while loading shared libraries: liblzma.so.5: cannot open shared object file: No such file or directory

Root Cause:
When built inside a Nix shell, the binary gets hardcoded RUNPATH pointing to non-existent Nix store paths:

$ readelf -d claudia | grep RUNPATH
Library runpath: [/home/user/outputs/out/lib:/nix/store/mhd0rk497xm0xnip7262xdw9bylvzh99-gcc-13.3.0-lib/lib:/nix/store/...]

Solution:
Build outside of Nix environment:

exit  # exit nix shell
cargo clean
bun run tauri build

Suggested Improvements

  1. Documentation: Add Ubuntu 24.04 specific build instructions mentioning the OpenSSL symlink requirement
  2. Build Script: Consider adding a pre-build check for OpenSSL headers in platform-specific locations
  3. Nix Compatibility: Add warning in docs about Nix environment contamination or provide nix-specific build instructions
  4. CI/CD: Test builds on Ubuntu 24.04 to catch these issues early

Reproduction Steps

  1. Start with clean Ubuntu 24.04 system
  2. Install standard Rust/Node/Bun toolchain
  3. Enter Nix shell (if using Nix)
  4. Run bun run tauri build
  5. Observe OpenSSL build failures
  6. After fixing OpenSSL issues, observe runtime library path issues

Workaround Summary

For Ubuntu 24.04 users:

  1. Create OpenSSL header symlinks as shown above
  2. Ensure you're NOT in a Nix shell when building
  3. Build should complete successfully

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