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

problem: trying to link against librt on macOS #4702

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

fanquake
Copy link
Contributor

@fanquake fanquake commented Jul 8, 2024

Solution: don't use rt if not RT_LIBRARY

This currently causes the check to fail on macOS:

/Library/Developer/CommandLineTools/usr/bin/c++  -std=c++11 -Wno-tautological-constant-compare  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_8466b.dir/CheckSymbolExists.cxx.o -o cmTC_8466b  -lrt
ld: library 'rt' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

even though clock_gettime is available.

Move the clock_gettime check up with the other librt related checks, and don't set CMAKE_REQUIRED_LIBRARIES if not RT_LIBRARY.

Solution: don't use rt if not `RT_LIBRARY`

This currently causes the check to fail on macOS:
```bash
     /Library/Developer/CommandLineTools/usr/bin/c++  -std=c++11 -Wno-tautological-constant-compare  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_8466b.dir/CheckSymbolExists.cxx.o -o cmTC_8466b  -lrt
        ld: library 'rt' not found
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
even though `clock_gettime` is available.

Move the `clock_gettime` check up with the other librt related checks,
and don't set `CMAKE_REQUIRED_LIBRARIES` if not `RT_LIBRARY`.
@bluca bluca merged commit ee29bcd into zeromq:master Jul 8, 2024
55 of 62 checks passed
@fanquake fanquake deleted the macos_no_librt branch July 9, 2024 09:04
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