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

Not buildable with macOS <= 10.9 #648

Closed
pkgw opened this issue May 2, 2023 · 5 comments · Fixed by #649
Closed

Not buildable with macOS <= 10.9 #648

pkgw opened this issue May 2, 2023 · 5 comments · Fixed by #649

Comments

@pkgw
Copy link

pkgw commented May 2, 2023

It seems that Rustix isn't buildable against versions of the macOS SDK <= 10.9, which don't provide some of the *at filesystem calls:

   = note: Undefined symbols for architecture x86_64:
             "_renameat", referenced from:
                 rustix::backend::fs::syscalls::renameat::h2c0c0bdc5b1b53dd in librustix-8716fc0ada80f679.rlib(rustix-8716fc0ada80f679.rustix.c8295d04-cgu.2.rcgu.o)
             "_unlinkat", referenced from:
                 rustix::backend::fs::syscalls::unlinkat::h64403488044b3003 in librustix-8716fc0ada80f679.rlib(rustix-8716fc0ada80f679.rustix.c8295d04-cgu.2.rcgu.o)
             "_linkat", referenced from:
                 rustix::backend::fs::syscalls::linkat::h944058f8262ceb1d in librustix-8716fc0ada80f679.rlib(rustix-8716fc0ada80f679.rustix.c8295d04-cgu.2.rcgu.o)
           ld: symbol(s) not found for architecture x86_64
           clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

This is from a conda-forge build of Tectonic. During package builds, conda-forge sets the MACOSX_SDK_VERSION and MACOSX_DEPLOYMENT_TARGET environment variables to 10.9 in an effort to produce binaries that are widely portable.

This is an old OS version, of course, and if there isn't any interest in attaining/maintaining compatibility with it, I'll understand. But I thought I'd flag the issue so it's at least documented.

sunfishcode added a commit that referenced this issue May 2, 2023
macOS <= 10.9 lacks these functions, so use weak symbols for them.

Fixes #648.
@sunfishcode
Copy link
Member

Thanks for the report! Rustix should fix these; I've submitted #649 with a fix.

@pkgw
Copy link
Author

pkgw commented May 2, 2023

Thanks for looking into this! For what it's worth, I don't know if those three functions are the only ones that aren't available, or if maybe there's some linker magic where there are other potentially problematic symbols but they're not causing errors because they're not used in that particular program.

Also, out of curiosity, what would be the behavior for a build on 10.9 with the weak symbols — failure at runtime?

@sunfishcode
Copy link
Member

I don't have a macos 10.9 or earlier machine myself, but I have now added MACOSX_DEPLOYMENT_TARGET and MACOSX_SDK_VERSION to the CI script, and the build succeeds.

I've now modified the PR to fall back to link/rename/etc. in the cases where that's possible, but otherewise yes, they'll fail at runtime with an ENOSYS error.

sunfishcode added a commit that referenced this issue May 3, 2023
* Make `linkat`, `unlinkat`, and `renameat` weak on macos.

macOS <= 10.9 lacks these functions, so use weak symbols for them.

Fixes #648.

* Handle the `AT_FDCWD` cases with fallbacks.

* Test with macOS 10.7.

Set MACOSX_DEPLOYMENT_TARGET and MACOSX_SDK_VERSION to 10.7, currently
the oldest version supported by Rust itself.

* Add support for `faccessat` too.

* Add some tests for `faccessat`.

* Add more tests.
@sunfishcode
Copy link
Member

This is now fixed in rustix 0.37.19.

@pkgw
Copy link
Author

pkgw commented May 4, 2023

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 a pull request may close this issue.

2 participants