Skip to content

Failure to install in Debian trixie: #error libgit2 version is not compatible #990

Description

@jbpextra

Updating the Docker image we use from bullseye-slim to newly released trixie-slim, rugged is failing to install.

The installation log

checking for gmake... -------------------- yes



--------------------



pkg_config: checking for pkg-config for libgit2... -------------------- [" ", "", "-lgit2"]



LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --exists libgit2

LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --libs libgit2 |

=> "-lgit2 \n"

LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 "gcc -o conftest -I/usr/local/include/ruby-3.4.0/x86_64-linux -I/usr/local/include/ruby-3.4.0/ruby/backward -I/usr/local/include/ruby-3.4.0 -I.    -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC  -g -O3 -Wall -Wno-comment conftest.c -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm -lpthread  -lc"

checked program was:

/* begin */

1: #include "ruby.h"

2: 

3: int main(int argc, char **argv)

4: {

5:   return !!argv[argc];

6: }

/* end */



LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 "gcc -o conftest -I/usr/local/include/ruby-3.4.0/x86_64-linux -I/usr/local/include/ruby-3.4.0/ruby/backward -I/usr/local/include/ruby-3.4.0 -I.    -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC  -g -O3 -Wall -Wno-comment conftest.c -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lgit2    -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm -lpthread  -lc"

checked program was:

/* begin */

1: #include "ruby.h"

2: 

3: int main(int argc, char **argv)

4: {

5:   return !!argv[argc];

6: }

/* end */



LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --cflags-only-I libgit2 |

=> "\n"

LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --cflags-only-other libgit2 |

=> "\n"

LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --libs-only-l libgit2 |

=> "-lgit2 \n"

package configuration for libgit2

incflags: 

cflags: 

ldflags: 

libs: -lgit2



--------------------



LD_LIBRARY_PATH=.:/usr/local/lib ASAN_OPTIONS=detect_leaks=0 "gcc -I/usr/local/include/ruby-3.4.0/x86_64-linux -I/usr/local/include/ruby-3.4.0/ruby/backward -I/usr/local/include/ruby-3.4.0 -I.     -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef  -fPIC  -g -O3 -Wall -Wno-comment    -c conftest.c"

In file included from conftest.c:3:

/usr/include/git2/version.h:16:1: error: unknown type name ‘GIT_BEGIN_DECL’

   16 | GIT_BEGIN_DECL

      | ^~~~~~~~~~~~~~

conftest.c:5:5: warning: "LIBGIT2_VER_MAJOR" is not defined, evaluates to 0 [-Wundef]

    5 | #if LIBGIT2_VER_MAJOR !=  || LIBGIT2_VER_MINOR !=

      |     ^~~~~~~~~~~~~~~~~

conftest.c:5:27: error: operator '!=' has no right operand

    5 | #if LIBGIT2_VER_MAJOR !=  || LIBGIT2_VER_MINOR !=

      |                           ^~

conftest.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ at end of input

    4 | 

cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics

cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics

cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics

checked program was:

/* begin */

1: #include "ruby.h"

2: 

3: #include <git2/version.h>

4: 

5: #if LIBGIT2_VER_MAJOR !=  || LIBGIT2_VER_MINOR !=

6: #error libgit2 version is not compatible

7: #endif

/* end */

Activity

  1. jbpextra commented on Aug 15, 2025

    @jbpextra
    Author

    For anyone else encountering this issue, I managed to compile by adding this packages to the apt-get install command:
    libssl-dev libssh2-1-dev libzstd-dev

  2. strugee commented on Dec 7, 2025

    @strugee

    Related/possible duplicate: #986

  3. Viktor-Ivliev commented on Mar 11, 2026

    @Viktor-Ivliev

    For anyone else encountering this issue, I managed to compile by adding this packages to the apt-get install command: libssl-dev libssh2-1-dev libzstd-dev

    Installing the libssl-dev, libssh2-1-dev, and libzstd-dev libraries also helped for Ruby 3.4.9 on Ubuntu 25.10 and version 1. Thank you.

    For 'Alpine': cmake pkgconfig openssl-dev libssh2-dev zstd-dev zlib-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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