-
Notifications
You must be signed in to change notification settings - Fork 418
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
Fails compiling against Bionic libc #252
Comments
FYI: ZeroCostGoods/sysconf.rs#19 Taking a look at it. |
Annoyingly, Alternatively, you could try to look up the appropriate value of that constant for your libc and replace That's at least something you can do right now without waiting on other people. The proper fix is of course to first fix Rust |
The tooling I'm using to create the Android build actually supports having a load of Thanks! |
The issue is resolved for me with the following patch: diff --git a/Cargo.toml b/Cargo.toml
index fa21354..33b9e02 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -45,7 +45,6 @@ serde_derive = "1.0"
serde_json = "1.0"
signal-hook = "0.1"
stderrlog = "0.4.1"
-sysconf = ">=0.3.4"
time = "0.1"
tiny_http = "0.6"
diff --git a/src/metrics.rs b/src/metrics.rs
index 5c678b0..6edd6ec 100644
--- a/src/metrics.rs
+++ b/src/metrics.rs
@@ -5,7 +5,6 @@ use std::io;
use std::net::SocketAddr;
use std::thread;
use std::time::Duration;
-use sysconf;
use tiny_http;
pub use prometheus::{
@@ -112,7 +111,7 @@ fn parse_stats() -> Result<Stats> {
fs::read_to_string("/proc/self/stat").chain_err(|| "failed to read /proc/self/stat")?;
let parts: Vec<&str> = value.split_whitespace().collect();
let page_size = page_size::get() as u64;
- let ticks_per_second = sysconf::raw::sysconf(sysconf::raw::SysconfVariable::ScClkTck)
+ let ticks_per_second = Ok(Stats { utime: 0, rss: 0, fds: 0, })
.expect("failed to get _SC_CLK_TCK") as f64;
let parse_part = |index: usize, name: &str| -> Result<u64> {
|
However now the build fails at RocksSB with:
|
That patch won't compile (rustc didn't find out as it didn't hit that code yet - it was only handling the dependency before). You need to replace whole function body, not just that single line. Looks like Android NDK doesn't provide |
Doh!
This comment seems to suggest you could try replacing Obviously I can't apply a patch to a dep though so I'd have to fork it and depend on the patched fork unless there's a better solution. |
Yes, it's even safer than before, but slower. :) I could imagine forking it in such way that it could be upstreamed later, if the maintainer is interested. It should be pretty easy. add: if cfg!(feature = "no_fread_unlocked") {
config.define("fread_unlock", Some("fread"));
} to then add then you can add:
to electrs Cargo Edit: there's such define already but it's excluded. |
I figured it out: |
Ok, I can test that locally... will report back. |
Anyway, I don't think we should lump two things under same issue. I was thinking that we could try to progress on the original one, but there seems to be something wrong, since the commit that would've fix it was reverted And it's in libc You could modify that patch to replace it with value |
Hi I am running into a similar problem with |
@LLFourn sadly, this can't be done in As an alternative, you could try to build dynamic ( |
Hi @Kixunil. I've tried to follow the instructions to build on FreeBSD 12.2 amd64 using a dynamic library but it still fails while building sysconf. Any help appreciated.
I have RocksDB 6.11.6 installed from Ports.
I guess these are the relevant libraries and headers:
Here is my build output:
|
@ulzeraj could you try to apply this patch? |
Thanks! It seems to get worked until a point where it tries to use llvm-config. LLVM/Clang is the main compiler on this version of FreeBSD but apparently this tool wasn't included. I'm installing the llvm version from ports and will report back once its finished compiling.
|
So what I've done so far:
The new compiler binaries will be installed on /usr/local/bin. By default the path variable sets /usr/bin before /usr/local/bin so the default compiler will take precedence over the new one so I had to run
Now I get this error which seems to be related to the path mentioned above. Apparently it is trying to convert the static values that replaced the sysconf code into a float.
EDIT: sorry posted the output from an attempt to convert the values into a floating number. Fixed now. |
I'm not familiar with rust but apparently Stats is a struct that has a float, an int and a memory size sort of thing:
So in this part utime should be something like 0.0:
Does " Sorry if those are dumb comments. |
I realized by reading what I wrote that it just wants a float (sorry not a developer) so I just replaced the whole object with a float and now it builds.
|
Yes, that's correct. Rust is very strict about types (thank God, saved my ass so many times...), so one has to explicitly write |
Oh, wait, I just realized there's division further below, so setting You may be wondering how these magic numbers impact |
0.9.0 should resolve this issue, please reopen if still relevant. |
Compiling against Bionic libc with the Android NDK gives:
Looks like it's an issue with the sysconf dep. Is it possible to work around this?
The text was updated successfully, but these errors were encountered: