google / google/rust_icu

Problem with versioned functions (FreeBSD)

Open
#236 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
140
Forks
34
Avg merge
5h 5m
Merged PRs (30d)
4

Description

Trying to build rust_icu_ustring on FreeBSD (after getting around #235), I get a bunch of errors like this:

```
error[E0425]: cannot find function `u_strFromUTF8_70` in this scope
--> /home/kaj/.cargo/registry/src/github.com-1ecc6299db9ec823/rust_icu_ustring-2.0.0/src/lib.rs:160:13
|
160 | versioned_function!(u_strFromUTF8)(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `u_strFromUTF8`
|
::: /usr/home/kaj/proj/r4s/target/debug/build/rust_icu_sys-f73623289ad55f94/out/lib.rs:3:850138
|
3 | ..."] pub fn u_strFromUTF8 (dest : * mut UChar , destCapacity : i32 , pDestLength : * mut i32 , src : * const :: std :: os :: raw :: c_char , srcLength : i32 , pErrorCode : * mut UErrorCode) -> * mut UChar ; } ...
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- similarly named function `u_strFromUTF8` defined here
|
= note: this error originates in the macro `versioned_function` (in Nightly builds, run with -Z macro-backtrace for more info)

```

I get eleven such errors, all for different function names `u_\w+_70`. Checking the actual library, (with `nm --dynamic --defined-only (libfile)` it contains the symbols like `u_strFromUTF8` but no symbols ending with `_70` (or any other _number). The same command on linux (Fedora 35) shows `u_strFromUTF8_69` (but no unversioned symbols).

The version number itself is correct, `libicuuc.so` on my FreeBSD host is a symlink to `libicuuc.so.70.1`. But the symbols in it are not versioned.

In `rust_icu_sys/bindgen/macros.rs`, it seems that versioning can be disabled by not using the `renaming` or the `icu_version_in_env` feature, but apparently at least one or those gets defined in my build even though it should not. Or should the cfg

https://github.com/google/rust_icu/blob/fc64773b3894089c9e9bbc28a75af842d62aa8b4/rust_icu_sys/bindgen/macros.rs#L32-L39

be changed to just

```rust
#[cfg(not(feature="renaming"))]
```

?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.