Skip to content

nng-sys: statically specifiy the lib output directory#39

Closed
flxo wants to merge 1 commit intonanomsg:mainfrom
flxo:nng-sys/lib-dir
Closed

nng-sys: statically specifiy the lib output directory#39
flxo wants to merge 1 commit intonanomsg:mainfrom
flxo:nng-sys/lib-dir

Conversation

@flxo
Copy link
Collaborator

@flxo flxo commented Feb 6, 2026

CMake's GNUInstallDirs module sets CMAKE_INSTALL_LIBDIR to lib64 on some 64-bit Linux distributions (e.g., Ubuntu with multilib), but the build script only searches in lib, causing "could not find native static library nng" errors.

Explicitly set CMAKE_INSTALL_LIBDIR to lib to ensure consistent library output path across all platforms.

Fixes #38

Summary by CodeRabbit

  • Bug Fixes
    • Fixed library installation directory configuration during build process to ensure consistent placement across different Linux distributions.

CMake's GNUInstallDirs module sets CMAKE_INSTALL_LIBDIR to lib64 on
some 64-bit Linux distributions (e.g., Ubuntu with multilib), but the
build script only searches in lib/, causing "could not find native
static library nng" errors.

Explicitly set CMAKE_INSTALL_LIBDIR to lib to ensure consistent library
output path across all platforms.

Fixes nanomsg#38
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

The nng-sys build script is modified to explicitly set CMAKE_INSTALL_LIBDIR to "lib" during the CMake configuration, ensuring the vendored NNG library is installed to a consistent directory path regardless of platform-specific defaults that may use lib64 on certain Linux distributions.

Changes

Cohort / File(s) Summary
CMake Build Configuration
nng-sys/build.rs
Adds CMAKE_INSTALL_LIBDIR variable definition to force library installation to "lib" directory, resolving platform-specific lib64 installation path issues on Linux systems.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 On Linux where lib64 once roamed,
A simple "lib" brings the library home,
One variable set, the build now stays true,
Ubuntu builds pass—problem through and through! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly describes the main change: statically specifying the lib output directory in nng-sys to resolve the CMAKE_INSTALL_LIBDIR inconsistency across platforms.
Linked Issues check ✅ Passed The pull request addresses issue #38 by setting CMAKE_INSTALL_LIBDIR to lib, ensuring the static library is placed consistently in lib across platforms, matching the build script's expectations.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to setting CMAKE_INSTALL_LIBDIR in the CMake configuration for the vendored NNG build, directly addressing the library output directory issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@flxo
Copy link
Collaborator Author

flxo commented Feb 6, 2026

This PR also need to be applied to the v1.xx branch.

@flxo flxo marked this pull request as ready for review February 6, 2026 10:58
@flxo flxo requested a review from jonhoo February 6, 2026 12:14
@jonhoo
Copy link
Collaborator

jonhoo commented Feb 10, 2026

Feels potentially more reasonable to me to update the build.rs to search in both lib64/ and lib/ (probably in that order), no?

@flxo
Copy link
Collaborator Author

flxo commented Feb 10, 2026

Feels potentially more reasonable to me to update the build.rs to search in both lib64/ and lib/ (probably in that order), no?

Ok - fine for me. Your proposed change is in #29. Closing this in favor if #29

@flxo flxo closed this Feb 10, 2026
@flxo flxo deleted the nng-sys/lib-dir branch February 11, 2026 13:40
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.

Build Error: could not find native static library nng

2 participants