[PR #1756] [MERGED] FIX: ARM64 build: c_char initialization #2478

Closed
opened 2026-01-29 17:22:22 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1756
Author: @x15sr71
Created: 10/21/2025
Status: Merged
Merged: 10/22/2025
Merged by: @prateekmedia

Base: masterHead: fix/c_char_arm64


📝 Commits (1)

  • 9d5aec6 Fix ARM64 build: c_char initialization

📊 Changes

2 files changed (+2 additions, -1 deletions)

View changed files

📝 docs/CHANGES.TXT (+1 -0)
📝 src/rust/src/avc/nal.rs (+1 -1)

📄 Description

Description

Fixes #1755

This PR fixes a compilation failure on ARM64/AArch64 Linux systems. The build was failing with:

error[E0277]: the trait bound `u8: From<i8>` is not satisfied
  --> src/avc/nal.rs:599:20

Problem

The c_char type in Rust is platform-dependent:

  • On x86_64: c_char is i8 (signed)
  • On ARM64/AArch64: c_char is u8 (unsigned)

The original code used c_char::from(0i8) which worked on x86_64 but failed on ARM64 because Rust doesn't implement From<i8> for u8.

Solution

Changed line 599 in src/rust/src/avc/nal.rs:

Before:

let mut buf = [c_char::from(0i8); 64];

After:

let mut buf = [0 as c_char; 64];

Using 0 as c_char works on all architectures because zero is valid for both signed and unsigned char types.

Testing

Verified the fix on both architectures:

Platform OS Arch Result
VM Ubuntu 25.04 aarch64 Builds successfully
Laptop Ubuntu 24.04 x86_64 Builds successfully

References

Impact

  • Fixes builds on all ARM64/AArch64 Linux distributions
  • No functional changes - still initializes buffer to null bytes
  • No performance impact
  • Maintains compatibility with x86_64

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1756 **Author:** [@x15sr71](https://github.com/x15sr71) **Created:** 10/21/2025 **Status:** ✅ Merged **Merged:** 10/22/2025 **Merged by:** [@prateekmedia](https://github.com/prateekmedia) **Base:** `master` ← **Head:** `fix/c_char_arm64` --- ### 📝 Commits (1) - [`9d5aec6`](https://github.com/CCExtractor/ccextractor/commit/9d5aec66a3c4f7e5debb317895e106d9b011dd6f) Fix ARM64 build: c_char initialization ### 📊 Changes **2 files changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/rust/src/avc/nal.rs` (+1 -1) </details> ### 📄 Description ## Description Fixes #1755 This PR fixes a compilation failure on ARM64/AArch64 Linux systems. The build was failing with: ``` error[E0277]: the trait bound `u8: From<i8>` is not satisfied --> src/avc/nal.rs:599:20 ``` ## Problem The `c_char` type in Rust is platform-dependent: - On x86_64: `c_char` is `i8` (signed) - On ARM64/AArch64: `c_char` is `u8` (unsigned) The original code used `c_char::from(0i8)` which worked on x86_64 but failed on ARM64 because Rust doesn't implement `From<i8>` for `u8`. ## Solution Changed line 599 in `src/rust/src/avc/nal.rs`: **Before:** ```rust let mut buf = [c_char::from(0i8); 64]; ``` **After:** ```rust let mut buf = [0 as c_char; 64]; ``` Using `0 as c_char` works on all architectures because zero is valid for both signed and unsigned char types. ## Testing Verified the fix on both architectures: | Platform | OS | Arch | Result | |----------|----|----- |--------| | VM | Ubuntu 25.04 | aarch64 | ✅ Builds successfully | | Laptop | Ubuntu 24.04 | x86_64 | ✅ Builds successfully | ## References - Rust `c_char` docs: https://doc.rust-lang.org/stable/std/os/raw/type.c_char.html - C Standard Section 6.2.5: Plain `char` signedness is implementation-defined ## Impact - Fixes builds on all ARM64/AArch64 Linux distributions - No functional changes - still initializes buffer to null bytes - No performance impact - Maintains compatibility with x86_64 --- **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [ ] I have used CCExtractor just a couple of times. - [x] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:22:22 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2478