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

Incompatibility of lmdb-master-sys Package with Cross-Compilation #281

Open
Losses opened this issue Sep 15, 2024 · 0 comments
Open

Incompatibility of lmdb-master-sys Package with Cross-Compilation #281

Losses opened this issue Sep 15, 2024 · 0 comments

Comments

@Losses
Copy link

Losses commented Sep 15, 2024

Description

The lmdb-master-sys package in the heed crate does not support cross-compilation correctly. When attempting to cross-compile using the command:

cargo build --target aarch64-unknown-linux-gnu

the library generates incompatible binary files:

8c28d618c08bdb0c-mdb.o:                                                         ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), with debug_info, not stripped
8c28d618c08bdb0c-midl.o:                                                        ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), with debug_info, not stripped
lmdb_master_sys-f5d577e22e9dc6e8.lmdb_master_sys.4026053b71a9477b-cgu.0.rcgu.o: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), not stripped

This results in a linking error:

aarch64-unknown-linux-gnu-ld: release/deps/liblmdb_master_sys-4cb3ac6e86087a04.rlib: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status

Context

Some libraries, such as zstd, can resolve cross-compilation issues by setting environment variables:

export PKG_CONFIG_ALLOW_CROSS=1
export ZSTD_SYS_USE_PKG_CONFIG=1

However, it appears that lmdb-master-sys does not utilize pkg-config for its configuration. This results in the generation of object files for the host architecture instead of the target architecture.

Steps to Reproduce

  1. Set up a cross-compilation environment for aarch64-unknown-linux-gnu.
  2. Attempt to build a project that includes the heed crate with the following command:
cargo build --target aarch64-unknown-linux-gnu
  1. Observe the generated object files and the resulting linking error.

Expected Behavior

The lmdb-master-sys package should correctly generate object files for the target architecture (aarch64-unknown-linux-gnu) and link them without errors.

Actual Behavior

The package generates object files for the host architecture (x86-64), leading to a linking error.

Additional Information

  • cargo version: cargo 1.80.1 (376290515 2024-07-16)
  • rustc version: rustc 1.80.1 (3f5fd8dd4 2024-08-06)
  • Target: aarch64-unknown-linux-gnu
  • Host: x86_64-unknown-linux-gnu

Thank you for your attention to this issue. Please let me know if you need any further information or assistance in reproducing the problem.

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