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 error due to undefined reference to 'GFp_p384_elem_mul_mont' in musl #2335

Closed
ekzhang opened this issue Feb 6, 2025 · 1 comment
Closed

Comments

@ekzhang
Copy link

ekzhang commented Feb 6, 2025

Hello,

I wanted to report a new linking issue due to an undefined reference to 'GFp_p384_elem_mul_mont'. Here is an example of the logs where this happens: https://github.com/ekzhang/sshx/actions/runs/13172728029/job/36814689096

You can reproduce the error message below with Docker.

git clone https://github.com/ekzhang/sshx.git
cd sshx
docker build -t sshx .

It seems like this wasn't happening in January so it's possible that there was something that changed in the latest rust:alpine base image version that caused this linker error? Just wondering what this error would mean and how to go about debugging it. Sorry if this isn't the right repository to file an issue in.

Error message

#21 0.513    Compiling sshx-server v0.3.1 (/home/rust/src/crates/sshx-server)
#21 31.97 error: linking with `cc` failed: exit status: 1
#21 31.97   |
[ ... long line truncated ]
#21 31.97   = note: /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o): in function `ring::ec::suite_b::ops::p384::p384_elem_inv_squared':
#21 31.97           ring.fafbc534f817f71-cgu.07:(.text._ZN4ring2ec7suite_b3ops4p38421p384_elem_inv_squared17h9494c68d7b0da7d6E+0x2b): undefined reference to `GFp_p384_elem_mul_mont'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o): in function `ring::ec::suite_b::ops::p384::p384_point_mul_base_impl':
#21 31.97           ring.fafbc534f817f71-cgu.07:(.text._ZN4ring2ec7suite_b3ops4p38424p384_point_mul_base_impl17ha739fb56d997a38cE+0x55): undefined reference to `GFp_nistz384_point_mul'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o): in function `ring::ec::suite_b::ops::p384::p384_scalar_inv_to_mont':
#21 31.97           ring.fafbc534f817f71-cgu.07:(.text._ZN4ring2ec7suite_b3ops4p38423p384_scalar_inv_to_mont17hc702fa2311783921E+0x54): undefined reference to `GFp_p384_scalar_mul_mont'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: ring.fafbc534f817f71-cgu.07:(.text._ZN4ring2ec7suite_b3ops4p38423p384_scalar_inv_to_mont17hc702fa2311783921E+0xa24): undefined reference to `GFp_p384_scalar_mul_mont'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o): in function `ring::ec::suite_b::ops::p384::GFp_p384_elem_sqr_mont':
#21 31.97           ring.fafbc534f817f71-cgu.07:(.text._ZN4ring2ec7suite_b3ops4p38422GFp_p384_elem_sqr_mont17hf75c7accd1f88d8dE+0x5): undefined reference to `GFp_p384_elem_mul_mont'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410COMMON_OPS17hdfb3188c14e5f3f5E+0x0): undefined reference to `GFp_p384_elem_add'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410COMMON_OPS17hdfb3188c14e5f3f5E+0x8): undefined reference to `GFp_p384_elem_mul_mont'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410COMMON_OPS17hdfb3188c14e5f3f5E+0x18): undefined reference to `GFp_nistz384_point_add'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38415PRIVATE_KEY_OPS17ha468966b7e49417cE+0x18): undefined reference to `GFp_nistz384_point_mul'
#21 31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410SCALAR_OPS17h79951cdcd4941be5E+0x10): undefined reference to `GFp_p384_scalar_mul_mont'
#21 31.97           collect2: error: ld returned 1 exit status
#21 31.97           
#21 31.97   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
#21 31.97   = note: use the `-l` flag to specify native libraries to link
#21 31.97   = 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#rustc-link-lib)
#21 31.97 
#21 32.06 error: could not compile `sshx-server` (bin "sshx-server") due to 1 previous error
#21 ERROR: process "/bin/sh -c cargo build --release --bin sshx-server &&     cp target/release/sshx-server /usr/local/bin" did not complete successfully: exit code: 101
------
 > [backend 6/6] RUN --mount=type=cache,target=/usr/local/cargo/registry     --mount=type=cache,target=/home/rust/src/target     cargo build --release --bin sshx-server &&     cp target/release/sshx-server /usr/local/bin:
31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410COMMON_OPS17hdfb3188c14e5f3f5E+0x18): undefined reference to `GFp_nistz384_point_add'
31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38415PRIVATE_KEY_OPS17ha468966b7e49417cE+0x18): undefined reference to `GFp_nistz384_point_mul'
31.97           /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /home/rust/src/target/release/deps/libring-6061a9f9d1be1d12.rlib(ring-6061a9f9d1be1d12.ring.fafbc534f817f71-cgu.07.rcgu.o):(.data.rel.ro._ZN4ring2ec7suite_b3ops4p38410SCALAR_OPS17h79951cdcd4941be5E+0x10): undefined reference to `GFp_p384_scalar_mul_mont'
31.97           collect2: error: ld returned 1 exit status
31.97           
31.97   = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
31.97   = note: use the `-l` flag to specify native libraries to link
31.97   = 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#rustc-link-lib)
31.97 
32.06 error: could not compile `sshx-server` (bin "sshx-server") due to 1 previous error
------
Error: failed to fetch an image or build from source: error building: failed to solve: process "/bin/sh -c cargo build --release --bin sshx-server &&     cp target/release/sshx-server /usr/local/bin" did not complete successfully: exit code: 101
@ekzhang
Copy link
Author

ekzhang commented Feb 6, 2025

Sorry, closing because I think it's a duplicate of #1444.

@ekzhang ekzhang closed this as completed Feb 6, 2025
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

1 participant