-
Notifications
You must be signed in to change notification settings - Fork 263
libiconv
necessary on mac, doesn't link
#488
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
Comments
This seems to impact us because this crate depends on the In any case, it does seem that this is an upstream issue and maybe not one we can easily fix ourselves (short of not depending on the |
We are planning on no longer depending on the |
libiconv
necessary on mac, doesn't link
Should fixing #448 be prioritized at all? How much of an issue is this for you, @boyland-pf? Fixing #448 would have a bunch of other small benefits as well, but isn't immediately pressing otherwise. |
It's a low priority for me. |
…` as a subcommand, overriding `RUSTC_WRAPPER`. More specifically, instead of using `cargo` as a dependency, which is enormous and causes some compilation issues (#488), we invoke `cargo` as a subcommand. This also has the advantage of using the correct `rustup` `cargo` wrapper so that it resolves correctly. Then we set `RUSTC_WRAPPER` to our own binary. We use `RUSTC_WRAPPER` to detect if we're being invoked as a `cargo` or `rustc` wrapper. If we're the `cargo` wrapper, we parse args using `clap` derive, determine the crate target info (that we want to instrument) using `cargo metadata` instead of the massive `cargo` dependency, and then run `cargo` as a subcommand, passing the `cargo` args as is (so all normal `cargo` invocations all work), our own executable as `$RUSTC_WRAPPER`, and the crate target info and instrumentation args serialized through `$C2RUST_INSTRUMENT_INFO`. If we're the `rustc` wrapper, we parse the instrument info, determine if we should instrument the current `rustc` command if the crate being compiled matches the crate target info passed, and based on that, either invoke `rustc` or run `RunCompiler::new(...).run()` with our `MirTransformCallbacks`, and then save the metadata to the metadata file. Note that we have to pass the `--sysroot` to `RunCompiler` as normally `rustc` looks this up relative to its executable's location, which works when the `rustup` `rustc` wrapper resolves to the toolchain-specific `rustc`, but since we're using `RunCompiler` directly and being `rustc`, we need to explicitly set the sysroot. Instead of passing `c2rust_analysis_rt` as an `--extern` and running `cargo` separately to compile it, we just add it as a normal dependency to the crate we're instrumenting. In this way it's similar to `libc`, which can be `extern`ed as it's in the sysroot, but the preferred way is to specify it as a normal dependency.
@boyland-pf, can you confirm if this has been fixed now after #554 landed? |
Yes, it's been fixed, instrumentation can run on mac. |
The mac version of c2rust with dynamic instrumentation enabled only requires libiconv at some point in the build, resulting in the following error.
This happens on my mac (a Catalina), which has iconv, and won't link libiconv (installed via brew) because it already has iconv which does the same thing.
This post on stackoverflow (https://stackoverflow.com/questions/57734434/libiconv-or-iconv-undefined-symbol-on-mac-osx) has the best description of the problem that I've found.
Because the compilation is handled by cargo, I don't know how to find a list of all the compilation steps to add
--with-libiconv-prefix=<dir>
to, or whether this would work.The text was updated successfully, but these errors were encountered: