# Feature Request: add to shard support for manage C/C++ deps

**URL:** <https://forum.crystal-lang.org/t/feature-request-add-to-shard-support-for-manage-c-c-deps/9154>\
**Category:** Community\
**Created:** [September 18, 2026, 3:37pm UTC](https://forum.crystal-lang.org/t/feature-request-add-to-shard-support-for-manage-c-c-deps/9154 "2026-09-18T15:37:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![synacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/synacker/32/3258_2.png) [@synacker](https://forum.crystal-lang.org/u/synacker)\
**Post date:** [September 18, 2026, 3:37pm UTC](https://forum.crystal-lang.org/t/feature-request-add-to-shard-support-for-manage-c-c-deps/9154/1 "2026-09-18T15:37:44Z")

</div>

Hi all,

The crystal lang provides good way for binding with C, but not provides way to manage a sets of C/C++ deps.

For example, I want to create a crystal lib for works with ffmpeg. The ffmpeg has a lot of deps. I can to bind with hope that system lib is exists, but there are next problems:

1. Versions mismatch. I can write crystal lib based on ffmpeg 9, but the system has only ffmpeg 8
2. No way to check that needed libs are exists (postscript don’t provide a way to do this perfectly)

From other side, the shard can manage also C/C++ deps with next limits:

1. Only static build
2. No binary storage, only a recipes for compilation
3. The compilation flags cann’t change
4. The compiler requirements cann’t change and auto d

My suggestion is add support to shard C/C++ deps in next way:

```auto
name: ffmpeg_crystal
version: 0.1.0
description: Crystal bindings for FFmpeg with self-compiling static dependencies.

# 1. Normal Crystal Shard dependencies
dependencies:
  kemal:
    github: kemalcr/kemal
    version: ~> 1.5.0

# 2. The New Proposed C/C++ Static Dependencies Block
native_dependencies:
  # Dependency name used as the linking identifier (e.g., -lopus)
  opus:
    git: https://github.com
    branch: master
    build_system: autotools
    # Immutable flags predefined by the shard author for static linking
    flags:
      - --enable-static
      - --disable-shared
      - --disable-extra-programs
      - --with-pic

  x264:
    git: https://videolan.org
    tag: stable
    build_system: makefile
    flags:
      - --enable-static
      - --enable-pic
      - --disable-cli

  # Target library depends on the upstream static libs
  libavcodec:
    git: https://github.com
    tag: n7.0
    build_system: autotools
    # Ensures opus and x264 are compiled and paths are mapped BEFORE building ffmpeg
    requires:
      - opus
      - x264
    flags:
      - --enable-static
      - --disable-shared
      - --enable-pic
      - --enable-libopus
      - --enable-libx264
      - --disable-programs
      - --disable-doc

```

What do you think about this proposal?

---

<div class="post-metadata">

**Author:** ![synacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/synacker/32/3258_2.png) [@synacker](https://forum.crystal-lang.org/u/synacker)\
**Post date:** [September 18, 2026, 3:49pm UTC](https://forum.crystal-lang.org/t/feature-request-add-to-shard-support-for-manage-c-c-deps/9154/2 "2026-09-18T15:49:32Z")

</div>

Or better way to reuse the vcpkg for c/c++ in shard like this:

```auto
name: core_service
version: 1.0.0

# 1. Global Native Orchestration Block
vcpkg:
  triplet: x64-windows-static # Enforces strict static binaries globally
  dependencies:
    - openssl # Declared by the root project

dependencies:
  sqlite_driver:
    github: crystal-lang/sqlite-driver

targets:
  server:
    main: src/server.cr

```

```auto
name: sqlite_driver
version: 2.1.0

# 2. Local Library Declaration Block
vcpkg:
  dependencies:
    - sqlite3 # Transitive C dependency

```

---

<div class="post-metadata">

**Author:** ![synacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/synacker/32/3258_2.png) [@synacker](https://forum.crystal-lang.org/u/synacker)\
**Post date:** [September 18, 2026, 3:55pm UTC](https://forum.crystal-lang.org/t/feature-request-add-to-shard-support-for-manage-c-c-deps/9154/3 "2026-09-18T15:55:57Z")

</div>

I also start discussion here: [Reddit](https://www.reddit.com/r/crystal_programming/comments/1wju1vc/rfcproposal_native_vcpkg_integration_for_shards/)
