cargo-c-0.10.24

#### Beyond Linux® From Scratch (systemd Edition) - Version r13.0-1357

### Chapter 13. Programming

- Prev

  Programming

- Next

  Cbindgen-0.29.4

- Up
- Home

# cargo-c-0.10.24

## Introduction to cargo-c

The cargo-c package creates a cargo subcommand to build and install C-ABI compatible dynamic and static libraries.

### Note

This package is known to build and work properly using an LFS 13.1 platform.

### Package Information

- Download (HTTP): https://github.com/lu-zero/cargo-c/archive/v0.10.24/cargo-c-0.10.24.tar.gz

- Download MD5 sum: b6247bf8f5eac962f001ee8a37f1c25f

- Download size: 38 KB

- Estimated disk space required: 1.4 GB (with tests)

- Estimated build time: 0.7 SBU (add 5.2 SBU for tests)

### cargo-c Dependencies

#### Required

rustc-1.97.1

#### Recommended

libssh2-1.11.1

### Note

An Internet connection is needed for building this package. The system certificate store may need to be set up with make-ca-1.16.1 before building this package.

## Installation of cargo-c

First, download a file to ensure that cargo uses the dependency versions specified by the upstream developers when this cargo-c version (0.10.24) was released. Without this, the latest versions of the dependencies would be used and they might cause breakages:

    curl -fLO https://github.com/lu-zero/cargo-c/releases/download/v0.10.24/Cargo.lock

### Note

Normally we would put such a download into an “Additional Downloads” section. But in this case we cannot tell the package name and version from the file name `Cargo.lock`, so it's better not to put the ambiguously-named file outside the `cargo-c-0.10.24` directory. We use curl here because the cURL-8.21.0 package should have been installed as a required dependency of rustc-1.97.1.

The md5sum of the file should be `fd58412b6d608a57a7d9a7bf384dca03`.

Install cargo-c by running the following commands:

    export LIBSSH2_SYS_USE_PKG_CONFIG=1    &&
    export LIBSQLITE3_SYS_USE_PKG_CONFIG=1 &&

    cargo build --release

To test the results, issue: cargo test --release.

Now, as the `root` user:

    install -vm755 target/release/cargo-{capi,cbuild,cinstall,ctest} /usr/bin/

Finally, unset the exported environment variables:

    unset LIB{SSH2,SQLITE3}_SYS_USE_PKG_CONFIG

## Command Explanations

export LIBSSH2_SYS_USE_PKG_CONFIG=1: Allow cargo to link to system libssh2. Omit this command if you've not installed libssh2-1.11.1.

export LIBSQLITE3_SYS_USE_PKG_CONFIG=1: Allow cargo to link to system sqlite.

## Contents

Installed Programs: cargo-capi, cargo-cbuild, cargo-cinstall, and cargo-ctest
Installed Libraries: None
Installed Directories: None

- Prev

  Programming

- Next

  Cbindgen-0.29.4

- Up
- Home