Skip to content

When compiling the sqlite crate (version 0.37.0) on ARM Linux after vendoring dependencies, we encounter a syntax error in the vendored source code #109

@seghart

Description

@seghart

Issue Description
​Problem:​​
When compiling the sqlite crate (version 0.37.0) on ARM Linux after vendoring dependencies, we encounter a syntax error in the vendored source code:

error: expected identifier, found keyword use
--> /home/uos/rust/batch/vendor/sqlite-0.37.0/src/cursor.rs:193:72
|
193 | pub fn iter(&self) -> impl Iterator<Item = (&'_ str, &'_ Value)> + use<'_> {
| ^^^ expected identifier, found keyword
​Cause:​​
The code incorrectly uses use (a Rust keyword) as a trait name in the return type declaration. This is invalid Rust syntax. The issue occurs only on ARM Linux, while the same code compiles successfully on x86 Linux, suggesting a potential difference in compiler versions or target-specific behavior.

Solution Implemented
To resolve this issue while maintaining vendored dependencies, I implemented the following solution:

​Modified the problematic source file:

Path to the problematic file

FILE_PATH="/home/uos/rust/batch/vendor/sqlite-0.37.0/src/cursor.rs"

Fix the syntax error by replacing invalid syntax

sed -i '193s/+ use<'''>/ + '''/' $FILE_PATH
​Updated checksum verification:

Path to checksum file

CHECKSUM_FILE="/home/uos/rust/batch/vendor/sqlite-0.37.0/.cargo-checksum.json"

Calculate new SHA256 checksum

NEW_CHECKSUM=$(sha256sum $FILE_PATH | awk '{print $1}')

Update checksum in JSON file

jq --arg file "src/cursor.rs"
--arg checksum "$NEW_CHECKSUM"
'.files[$file] = $checksum' $CHECKSUM_FILE > temp.json
mv temp.json $CHECKSUM_FILE
Verification Steps
After implementing the solution:

The syntax error is resolved by changing + use<'> to the valid + ' lifetime bound
The checksum file is updated to match the modified file
The project compiles successfully on ARM Linux
Long-Term Recommendation
For a more sustainable solution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions