Skip to content

ring 0.17.13 does not "cross" compile (on illumos, other x86_64 targets) unlike ring 0.17.12 #2461

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

Closed
ahqsoftwares opened this issue Mar 7, 2025 · 14 comments · Fixed by #2471
Milestone

Comments

@ahqsoftwares
Copy link

ring 0.17.11 used to compile perfectly in rust (+nightly-2025-01-25) but after updating to ring 0.17.13, it fails to compile

warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S: Assembler messages:
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:86: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:87: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:88: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:90: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:94: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:95: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:113: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:114: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:115: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:117: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:121: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:122: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:127: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S:128: Error: operand type mismatch for `vpclmulqdq'
warning: ring@0.17.13: /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-
  exit status: 1
  cargo:warning=ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C" "x86_64-unknown-illumos-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/include" "-I" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/target/x86_64-unknown-illumos/release/build/ring-54ed32f66968b3d1/out/c322a0bcc369f531-aes-gcm-avx2-x86_64-elf.o" "-c" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x[86](https://github.com/leadlang/lead/actions/runs/13713994179/job/38356261158#step:8:87)_64-elf.S"
  exit status: 0
  --- stderr
  error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" "x86_64-unknown-illumos-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/include" "-I" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/target/x86_64-unknown-illumos/release/build/ring-54ed32f66968b3d1/out/c322a0bcc369f531-aes-gcm-avx2-x86_64-elf.o" "-c" "/home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S"
warning: build failed, waiting for other jobs to finish...
@ahqsoftwares
Copy link
Author

@ahqsoftwares ahqsoftwares changed the title ring 0.17.13 does not compile on illumos ring 0.17.13 does not "cross" compile on illumos unlike ring 0.17.11 Mar 7, 2025
@briansmith
Copy link
Owner

What version of binutils are you using? If you google that error message, people claim that upgrading to 2.38 helps.

@qianyiwen2019
Copy link

qianyiwen2019 commented Mar 7, 2025

we met the same error too.

ring = "0.17.13" , this version caused the error.
ring = "0.17.11", this is OK.

@qianyiwen2019
Copy link

error log:

[email protected]: ToolExecError: command did not execute successfully (status code exit status: 1): LC_ALL="C" "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/include" "-I" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/target/x86_64-unknown-linux-gnu/release/build/ring-4503903eec66e078/out/c322a0bcc369f531-aes-gcm-avx2-x86_64-elf.o" "-c" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S"

error: failed to run custom build command for ring v0.17.13

@briansmith
Copy link
Owner

On my system I have:

$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.38

Please report what you have.

@briansmith
Copy link
Owner

Also, you can use 0.17.12 which doesn't have any increased as requirement. Or you can use clang as the compiler which will use its assembler.

@ahqsoftwares
Copy link
Author

ahqsoftwares commented Mar 7, 2025

I am actually using cross-rs to compile it for illumos. I think we have to pin ring to 0.17.12 on illumos (and file an issue at cross-rs/cross to update assembler)

EDIT: cross-rs/cross seems to be on Ubuntu 20.04 and uses binutils 2.28.1

@ssrlive
Copy link

ssrlive commented Mar 7, 2025

me too.

error occurred in cc-rs: command did not execute successfully (status code exit status: 1): LC_ALL="C" "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/include" "-I" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g3" "-DNDEBUG" "-o" "/target/x86_64-unknown-linux-gnu/debug/build/ring-fb03db282ef36793/out/c322a0bcc369f531-aes-gcm-avx2-x86_64-elf.o" "-c" "/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/ring-0.17.13/pregenerated/aes-gcm-avx2-x86_64-elf.S"

@briansmith
Copy link
Owner

Downgrading to ring 0.17.12 is a short-term workaround but it won't work in the long term, so it is good to find solutions.

It is good that people are working to upgrade binutils in cross-rs.

If there are other situations where this is an issue, then knowing the host operating system version (e.g. Ubuntu 20.04, RHEL 7, etc.) and the as --version output would be useful.

@briansmith
Copy link
Owner

briansmith commented Mar 7, 2025

According to the log above, these (using XMM registers) are accepted by the assembler:

	vpclmulqdq	$0x00,%xmm3,%xmm3,%xmm0
	vpclmulqdq	$0x01,%xmm3,%xmm3,%xmm1
	vpclmulqdq	$0x10,%xmm3,%xmm3,%xmm2
	vpclmulqdq	$0x01,%xmm0,%xmm6,%xmm2
	vpclmulqdq	$0x11,%xmm3,%xmm3,%xmm5
	vpclmulqdq	$0x01,%xmm1,%xmm6,%xmm0

But these are not:

	vpclmulqdq	$0x00,%ymm5,%ymm3,%ymm0
	vpclmulqdq	$0x01,%ymm5,%ymm3,%ymm1
	vpclmulqdq	$0x10,%ymm5,%ymm3,%ymm2
	vpclmulqdq	$0x01,%ymm0,%ymm6,%ymm2
	vpclmulqdq	$0x11,%ymm5,%ymm3,%ymm4
	vpclmulqdq	$0x01,%ymm1,%ymm6,%ymm0

So the issue is that the old as doesn't accept the use of YMM registers with vpclmulqdq.

@briansmith
Copy link
Owner

I verified with https://github.com/briansmith/ring/actions/runs/13724945792/job/38389040003 that the x86-64 build works fine in Ubuntu 20.04 in GitHub Actions, and that's the oldest Ubuntu in GitHub Actions, AFAICT. So maybe upgrading binutils in cross may be the only thing we need to do.

@briansmith
Copy link
Owner

It seems this will be fixed in cross-rs: cross-rs/cross#1639. I'm going to close this now.

@briansmith briansmith changed the title ring 0.17.13 does not "cross" compile on illumos unlike ring 0.17.11 ring 0.17.13 does not "cross" compile (on illumos, other x86_64 targets) unlike ring 0.17.11 Mar 8, 2025
@briansmith briansmith changed the title ring 0.17.13 does not "cross" compile (on illumos, other x86_64 targets) unlike ring 0.17.11 ring 0.17.13 does not "cross" compile (on illumos, other x86_64 targets) unlike ring 0.17.12 Mar 8, 2025
@briansmith
Copy link
Owner

In #2462 (comment), @azjezz wrote:

I just encountered the same issue cross compiling for linux: https://github.com/carthage-software/mago/actions/runs/13735422342/job/38418652700

updated for those having similar issue: we simply disabled cross for the failing target, and it works: carthage-software/mago@12beb0c

@briansmith briansmith linked a pull request Mar 11, 2025 that will close this issue
@briansmith briansmith reopened this Mar 11, 2025
@briansmith briansmith added this to the 0.17.14 milestone Mar 11, 2025
@briansmith
Copy link
Owner

0.17.14 was released with the fix for this.

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

Successfully merging a pull request may close this issue.

4 participants