Skip to content
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

Linker issue with blst-msm #4

Closed
vmx opened this issue Feb 21, 2023 · 5 comments
Closed

Linker issue with blst-msm #4

vmx opened this issue Feb 21, 2023 · 5 comments

Comments

@vmx
Copy link

vmx commented Feb 21, 2023

I get an error like

  = note: /usr/bin/ld: /tmp/blstmsmlinkerissue/target/debug/deps/libblst_msm-f154847bd3acdcfa.rlib(blst_msm-f154847bd3acdcfa.blst_msm.14511a1f-cgu.6.rcgu.o): in function `blst_msm::multi_scalar_mult':
          /home/vmx/.cargo/git/checkouts/sppark-766e0a6fee265121/f939f36/poc/blst-cuda/src/lib.rs:49: undefined reference to `mult_pippenger'
          collect2: error: ld returned 1 exit status
          
  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

when trying to use blst-msm as a dependency. Steps to reproduce (you can copy&paste that into your terminal and execute it directly):

cargo init blstmsmlinkerissue
cd blstmsmlinkerissue
cargo add blst
cargo add blst-msm --git https://github.com/supranational/sppark --features bls12_381
cat > src/main.rs << EOF
use blst::{blst_scalar, blst_p1_affine, blst_fp};

fn main() {                                      
    let bases = vec![blst_scalar{ b: [0; 32] }];
    let exponents = vec![blst_p1_affine{ x: blst_fp { l: [0; 6] }, y: blst_fp { l: [0; 6]} }];
    let point = blst_msm::multi_scalar_mult(&exponents, &bases);                              
    println!("point: {:?}", point);                             
}                                  
EOF
cargo build 

I'm on Debian.

@vmx
Copy link
Author

vmx commented Feb 22, 2023

I got a fix via side-channel. You need to include pipenger.cu instead of pipenger_inf.cu if you want to use it with blst based types.

diff --git a/poc/blst-cuda/build.rs b/poc/blst-cuda/build.rs
index a44513b..367552b 100644
--- a/poc/blst-cuda/build.rs
+++ b/poc/blst-cuda/build.rs
@@ -115,7 +115,7 @@ fn main() {
         if let Some(include) = env::var_os("DEP_SPPARK_ROOT") {
             nvcc.include(include);
         }
-        nvcc.file("cuda/pippenger_inf.cu").compile("blst_cuda_msm");
+        nvcc.file("cuda/pippenger.cu").compile("blst_cuda_msm");
 
         println!("cargo:rustc-cfg=feature=\"cuda\"");
         println!("cargo:rerun-if-changed=cuda");

@vmx vmx mentioned this issue Feb 22, 2023
@dot-asm
Copy link
Collaborator

dot-asm commented Feb 23, 2023

when trying to use blst-msm as a dependency.

PoCs are not meant to be used as dependency, but as an example of how to use sppark as dependency.

@vmx
Copy link
Author

vmx commented Feb 23, 2023

as an example of how to use sppark as dependency

Agreed. But I'd expect it to to be a working example, so that one can then use it as a template for your own stuff. When it's not a PoC for working blst, then I think that part should be removed.

@dot-asm
Copy link
Collaborator

dot-asm commented Feb 23, 2023

But I'd expect it to to be a working example,

And it's working. You do cd poc/blst-cuda && cargo test --features=bls12_381 and it works :-) No further promises are made.

Just in case, I do recognize your problem, which is effectively rooted in poor messaging from our side. At this point I reckon that it would be more efficient if we use more interactive means of communications to move forward. More interactive than github issues that is :-)

@vmx
Copy link
Author

vmx commented Mar 6, 2023

The POC isn't meant to be used with blstrs types (although the code is there), hence I'm closing this issue.

@vmx vmx closed this as completed Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants