PaddiM8/kalker

Issue to build version 2.1.0 on Arch Linux (AUR package)

Closed this issue · 10 comments

Hi,

I am the kalker AUR package maintainer and I have an issue to update the AUR package to 2.1.0.
When I try to build the package, I had an error when cargo try to build gmp-mpfr-sys dependency (check log in attachment). I also tried to deactivate gmp-mpfr-sys feature without success (same error).

Do you do have any solution to fix the build or at least deactivate correctly the gmp-mpfr-sys feature ?

Thank you.

Arch package build log : kalker-2.1.0-1-x86_64-build.log

PS : Out of scope, but I see in the cli Cargo file, the version still set to 2.0.4

Hmm this is strange. I am also on Arch (and the newest GCC) and it builds for me. I assume you're also on the newest GCC? Could you be running out of RAM or something? Looks like it fails during testing? I guess you could disable the testing with something like CARGO_FEATURE_C_NO_TESTS=1 cargo build --release. That would make it compile way faster too. It seems to die at t-cmp, so if comparison operations work anyway, it should be fine?

The feature that makes it use gmp-mpfr-sys is called rug in the ./kalk sub-crate. It's a default feature, but it should be possible to remove it from ./cli. However, then you're limited to 64-bit floats, so it isn't ideal.

PS : Out of scope, but I see in the cli Cargo file, the version still set to 2.0.4

Apparently a couple of commits had been removed from GitHub, even though I had previously pushed them. Strange, but the latest release seems to have them at least. Thanks for letting me know.

I try to build with CARGO_FEATURE_C_NO_TESTS=1 cargo build --release and now I had a new error.

New build log : kalker-2.1.0-1-x86_64-build.log

Hmm... m4 is a dependency. You probably already have that since it's a core package, but might as well make sure it's there.

Maybe worth trying the newest version of rug (which is what depends on gmp-mpfr-sys), i.e. a patch like

diff --git a/kalk/Cargo.toml b/kalk/Cargo.toml
index 99915ea..4c14f3c 100644
--- a/kalk/Cargo.toml
+++ b/kalk/Cargo.toml
@@ -14,7 +14,7 @@ categories = ["mathematics", "parser-implementations"]
 crate-type = ["cdylib", "rlib"]

 [dependencies]
-rug = { version = "1.17.0", features = ["float"], optional = true }
+rug = { version = "1.24.0", features = ["float"], optional = true }
 lazy_static = "1.4.0"
 wasm-bindgen = "0.2.69"
 gmp-mpfr-sys = { version = "1.4.9", optional = true }

(it should be compatible with the kalker code)

Or maybe a different compiler altogether would work, i.e. clang, and setting CC=clang

Still out of luck. I have the same error with an updated rug dependency, and I have a different error when I try to compile with clang.

Log: kalker-2.1.0-1-x86_64-build.log

EDIT : and of course, m4 dependency are installed on my machine.

I remembered now that it had to use an older version of gmp-mpfr-sys before due to some bug in newer versions, but I think that has been fixed. So it might be worth trying without that, eg.

diff --git a/kalk/Cargo.toml b/kalk/Cargo.toml
index 99915ea..13910db 100644
--- a/kalk/Cargo.toml
+++ b/kalk/Cargo.toml
@@ -14,10 +14,9 @@ categories = ["mathematics", "parser-implementations"]
 crate-type = ["cdylib", "rlib"]

 [dependencies]
-rug = { version = "1.17.0", features = ["float"], optional = true }
+rug = { version = "1.24.0", features = ["float"], optional = true }
 lazy_static = "1.4.0"
 wasm-bindgen = "0.2.69"
-gmp-mpfr-sys = { version = "1.4.9", optional = true }

 [dev-dependencies]
 wasm-bindgen-test = "0.3.19"
@@ -25,7 +24,7 @@ test-case = "1.0.0"
 regex = "1"

 [features]
-default = ["rug", "gmp-mpfr-sys"]
+default = ["rug"]

 # Breaks when optimizing for some reason.
 [package.metadata.wasm-pack.profile.release]

Or maybe it would work to tell it to use the system libraries (seem to be in the core repos) instead of compiling them (I'm pretty sure this would fix it, and speed up compile times by a lot!):

diff --git a/kalk/Cargo.toml b/kalk/Cargo.toml
index 99915ea..1d00a9c 100644
--- a/kalk/Cargo.toml
+++ b/kalk/Cargo.toml
@@ -14,10 +14,14 @@ categories = ["mathematics", "parser-implementations"]
 crate-type = ["cdylib", "rlib"]

 [dependencies]
-rug = { version = "1.17.0", features = ["float"], optional = true }
+rug = { version = "1.24.0", features = ["float"], optional = true }
 lazy_static = "1.4.0"
 wasm-bindgen = "0.2.69"
-gmp-mpfr-sys = { version = "1.4.9", optional = true }
+
+[dependencies.gmp-mpfr-sys]
+version = "1.6.2"
+default-features = false
+features = ["mpfr", "use-system-libs"]

 [dev-dependencies]
 wasm-bindgen-test = "0.3.19"
@@ -25,7 +29,7 @@ test-case = "1.0.0"
 regex = "1"

 [features]
-default = ["rug", "gmp-mpfr-sys"]
+default = ["rug"]

 # Breaks when optimizing for some reason.
 [package.metadata.wasm-pack.profile.release

The two solutions seems to work when I build manually. Now I have to create a patch for AUR package.

Great! I pushed the first solution now, so it should just work for future versions. If you want I could create a tag for this as well, but I guess it would make the version number a bit weird 2.1.0-1 instead of v2.1.0, so a patch might be better anyway (having the regular v prefix would trigger CI, so can't have that)

Finally, I pushed update to AUR.

For information, I had to use system libs for gmp-mpfr-sys dependency. With only updated dependencies, I still had error C test on gmp-mpfr-sys build.

Very nice! Now it compiles much quicker as well.

There's a new version already (there was a regression), which also has the newest version of the gmp-mpfr-sys crate, unlike the previous version. It should now be possible to simply append a few lines to the Cargo.toml before building:

[dependencies.gmp-mpfr-sys]
version = "1.6.2"
default-features = false
features = ["mpfr", "use-system-libs"]

Should be more robust than a patch. This should work for a long time without intervention. If it's viable to append like that in a pkgbuild?