elast0ny / elast0ny/raw_sync-rs

macOS link fails: cargo run --example locks

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
66
Forks
20
PR merge metrics
No merged PRs in 30d

Description

On macos, the following two functions don't appear to be available. So the following fails to link or run:
`cargo run --example locks`
You can see the log at the end of this post.

These are the missing funcs on macOS:
```
pthread_rwlock_timedrdlock()
pthread_rwlock_timedwrlock()
```

Interestingly enough, `pthread_mutex_timedlock` is also not available on macOS, but an implementation
has been provided under `if #[cfg(target_os = "macos")] {...`
I wonder if there might be equivalents for pthread_rwlock_timed..lock() where that came from?
It also appears glibc offers a [replacement mentioned HERE](https://www.gnu.org/software/gnulib/manual/html_node/pthread_005frwlock_005ftimedrdlock.html#pthread_005frwlock_005ftimedrdlock)

I am checking to see the authors can suggest where to get a good replacement.
Or if the authors have a good idea about how to fix this?
Thanks, Cameron

```
c@macmini ~/D/r/raw_sync-rs (master) [101]> cargo run --example locks
Compiling raw_sync v0.1.5 (/Users/c/Documents/rs/raw_sync-rs)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "-arch" "x86_64" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.15vmvh72pfa6pnzf.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.1mhvuom1vif64dgp.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.1nl61rjywspj6e2l.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.1o5ku221nvivr1uo.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.20f4z4xoaa4w16j2.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.305h8lr7mfiyvwk4.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.30vnonx6dsngno0.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.34f01fvt4tquz6bz.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.3if3fqhg66h5j3qc.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.3kwmzklrjj7szlxh.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.3pq4vkndw1lzgsvy.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.3pu8s3f0iawz77x2.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.3ql9hfh7lk3uackc.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.40tz8klf0lpn4d4b.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.40uutlfvdgcb5buq.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.410vfbp1bswddlhj.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.42lk811q1nz7fw2h.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4722xntt5b9kowto.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.49tyyy7rkj9wr8p3.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4eo467iqjixrgbhi.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4g6r51ny6t1xj114.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4gt8305f6hgug1cv.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4qj2n04vsin1xn6e.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4wzor2jn3qhctwux.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.50qyhnzsci8nyn3l.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.512o8ca57zr2z10l.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.53jhgxekh2wxbkj.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.56oqlofvcytp228h.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.5ckzsuoquucy7rce.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.gy20ewq43yt2s6a.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.qh8fiu2davjyhki.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.qqyn39fzeof6vo1.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.tqvsw7p2sm0oqxr.rcgu.o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c.4gu86rmkv73c909f.rcgu.o" "-L" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps" "-L" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libraw_sync-9e3b62dd02c25d59.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libnix-31bfd5723b91edc4.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libbitflags-5807c7dc27ea64c8.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libmemoffset-0059bcb888f9d093.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libenv_logger-2fb8cd88855d6469.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libatty-0f41ef3414cde949.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/liblibc-c9fbfbcd791abe60.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libtermcolor-934608461d59bee3.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libhumantime-6ae3b1203ddc3145.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/liblog-6692e0a188c29cee.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libcfg_if-7e74d31581507915.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libregex-eac4b23977649399.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libaho_corasick-bd486f8f47a9c700.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libmemchr-7874de389e22e218.rlib" "/Users/c/Documents/rs/raw_sync-rs/target/debug/deps/libregex_syntax-3d679e5b759db215.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-04b20da5d2b4e02d.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-00f5b50d82ace1e3.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-45c041bae4e30a62.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-1bc22f5f5be77a23.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-caa784d0cecbd501.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-0ad46247e89234f6.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-68dabd8f37218f7c.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-4c67204728564461.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-eca93a0d11ef9a39.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-6ddabe46ef182f8b.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-7dc1037a76f2c18c.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-100dc4191a6287d7.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-c596c47fc21af016.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-c7163fef4a8cdd33.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-3463abc69f183e66.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-12a50039d8929e4e.rlib" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-a4134bbc9f4f0dab.rlib" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/c/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/c/Documents/rs/raw_sync-rs/target/debug/examples/locks-adce1879609c609c" "-Wl,-dead_strip" "-nodefaultlibs"
= note: Undefined symbols for architecture x86_64:
"_pthread_rwlock_timedrdlock", referenced from:
_$LT$raw_sync..locks..unix..RwLock$u20$as$u20$raw_sync..locks..LockImpl$GT$::try_rlock::h3295aa08710fdf36 in libraw_sync-9e3b62dd02c25d59.rlib(raw_sync-9e3b62dd02c25d59.2j047qgu8yj7k2nx.rcgu.o)
"_pthread_rwlock_timedwrlock", referenced from:
_$LT$raw_sync..locks..unix..RwLock$u20$as$u20$raw_sync..locks..LockImpl$GT$::try_lock::ha1e205a6fe064f36 in libraw_sync-9e3b62dd02c25d59.rlib(raw_sync-9e3b62dd02c25d59.2j047qgu8yj7k2nx.rcgu.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `raw_sync` due to previous error
c@macmini ~/D/r/raw_sync-rs (master) [101]>
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.