Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link failure when building on Fedora 64bit #1

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

kicsyromy
Copy link
Contributor

@kicsyromy kicsyromy commented Jan 21, 2025

Fix link failure when building on Fedora 64bit

Fedora and other Linux distributions tend to use lib64 as the library directory and when building and installing the native library with CMake the directory structure in the prefix conforms to this standard.

This makes the linking fail since the search directory for libnng is set to lib.

This patch adds lib64 to the library search path on Linux.

The same issue is also present for mbedtls and was fixed there as well.

@DoumanAsh
Copy link
Owner

Hm, interesting I would assume cmake create would pick up correct search location automatically, but that's not the case then?

@DoumanAsh
Copy link
Owner

If possible, can you shall full build log(cargo build --verbose) from your machine where you encounter issue?

@kicsyromy
Copy link
Contributor Author

If possible, can you shall full build log(cargo build --verbose) from your machine where you encounter issue?

build.log

@kicsyromy
Copy link
Contributor Author

Hm, interesting I would assume cmake create would pick up correct search location automatically, but that's not the case then?

CMake itself, I think, is doing the right thing. The issue is that it is assumed that the build directory contains: bin, include and lib, but, in fact, it contains bin, include, and lib64 on Fedora.

Somehow CMake picks up some environmental setting and creates a lib64 directory instead of lib which in 99% of cases is the right thing to do, but here, because of the previous assumption, leads to a link failure.

Of note that this does not happen on Ubuntu since it uses a different library differentiation technique.

@DoumanAsh
Copy link
Owner

DoumanAsh commented Jan 21, 2025

Hm looking back I forgot that cmake crate just returns root of installation directoy
So it is build script responsibility to find correct folder

I'm thinking instead of doing rename, we should add lib64 to search path maybe?
That would be safe in case something changes and both lib and lib64 would be created

@kicsyromy kicsyromy force-pushed the master branch 2 times, most recently from 8f16b53 to 02841bb Compare January 21, 2025 07:51
Fedora and other Linux distributions tend to use `lib64` as the library
directory and when building and installing the native library with CMake the
directory structure in the prefix conforms to this standard.

This makes the linking fail since the search directory for `libnng` is set to
`lib`.

This patch adds `lib64` to the library search path on Linux.

The same issue is also present for `mbedtls` and was fixed there as well.
@DoumanAsh
Copy link
Owner

Thanks, I will merge and release it later after work

@DoumanAsh DoumanAsh merged commit bc501ed into DoumanAsh:master Jan 21, 2025
3 checks passed
@DoumanAsh
Copy link
Owner

Released 1.9.0-beta.2 (will release nng-c bump a bit later)

@kicsyromy
Copy link
Contributor Author

Thanks!

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.

2 participants