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

Error: Build error: Failed compiling object src/pre_generated-git2.nobj.o #7

Open
asbjornu opened this issue Jul 14, 2015 · 9 comments

Comments

@asbjornu
Copy link

When I tried to install luagit on my OS X 10.10.4 machine (with Homebrewed libgit2 in place), I got the following errors:

$ luarocks install https://raw.github.com/libgit2/luagit2/master/lua-git2-scm-0.rockspec
Using https://raw.github.com/libgit2/luagit2/master/lua-git2-scm-0.rockspec... switching to 'build' mode
Cloning into 'luagit2'...
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 85 (delta 38), reused 64 (delta 27), pack-reused 0
Receiving objects: 100% (85/85), 144.23 KiB | 0 bytes/s, done.
Resolving deltas: 100% (38/38), done.
Checking connectivity... done.
export MACOSX_DEPLOYMENT_TARGET=10.8; gcc -O2 -fPIC -I/usr/local/include -c src/pre_generated-git2.nobj.c -o src/pre_generated-git2.nobj.o -I/usr/local/include
src/pre_generated-git2.nobj.c:187:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg  *pub_funcs;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:188:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg  *methods;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:189:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg  *metas;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:427:3: warning: implicit declaration of function 'luaL_typerror' is invalid in C99 [-Wimplicit-function-declaration]
                luaL_typerror(L, _index, "userdata"); /* is not a userdata value. */
                ^
src/pre_generated-git2.nobj.c:430:8: warning: implicit declaration of function 'lua_objlen' is invalid in C99 [-Wimplicit-function-declaration]
        len = lua_objlen(L, _index);
              ^
src/pre_generated-git2.nobj.c:881:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg *reg_list = type_reg->pub_funcs;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:886:3: warning: implicit declaration of function 'luaL_register' is invalid in C99 [-Wimplicit-function-declaration]
                luaL_register(L, NULL, reg_list);
                ^
src/pre_generated-git2.nobj.c:895:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg *reg_list;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:919:8: error: unknown type name 'luaL_reg'; did you mean 'luaL_Reg'?
        const luaL_reg *reg_list;
              ^~~~~~~~
              luaL_Reg
/usr/local/include/lauxlib.h:26:3: note: 'luaL_Reg' declared here
} luaL_Reg;
  ^
src/pre_generated-git2.nobj.c:1214:18: error: field has incomplete type 'git_odb_backend' (aka 'struct git_odb_backend')
        git_odb_backend backend;
                        ^
/usr/local/include/git2/types.h:84:16: note: forward declaration of 'struct git_odb_backend'
typedef struct git_odb_backend git_odb_backend;
               ^
src/pre_generated-git2.nobj.c:1399:9: error: unknown type name 'git_index_entry_unmerged'
typedef git_index_entry_unmerged IndexEntryUnmerged;
        ^
src/pre_generated-git2.nobj.c:1526:7: error: use of undeclared identifier 'GIT_REVWALKOVER'
        case GIT_REVWALKOVER:
             ^
src/pre_generated-git2.nobj.c:1614:40: warning: implicit declaration of function 'git_repository_head_orphan' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_repository_head_orphan_idx1 = git_repository_head_orphan(this_idx1);
                                       ^
src/pre_generated-git2.nobj.c:1661:90: error: too few arguments to function call, expected 3, have 2
  rc_git_repository_set_workdir_idx1 = git_repository_set_workdir(this_idx1, workdir_idx2);
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~                        ^
/usr/local/include/git2/repository.h:393:1: note: 'git_repository_set_workdir' declared here
GIT_EXTERN(int) git_repository_set_workdir(
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:1693:3: warning: implicit declaration of function 'git_repository_set_config' is invalid in C99 [-Wimplicit-function-declaration]
  git_repository_set_config(this_idx1, config_idx2);
  ^
src/pre_generated-git2.nobj.c:1717:3: warning: implicit declaration of function 'git_repository_set_odb' is invalid in C99 [-Wimplicit-function-declaration]
  git_repository_set_odb(this_idx1, odb_idx2);
  ^
src/pre_generated-git2.nobj.c:1741:3: warning: implicit declaration of function 'git_repository_set_index' is invalid in C99 [-Wimplicit-function-declaration]
  git_repository_set_index(this_idx1, index_idx2);
  ^
src/pre_generated-git2.nobj.c:1793:76: error: too few arguments to function call, expected 4, have 3
  err_idx1 = git_config_add_file_ondisk(this_idx1, path_idx2, priority_idx3);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~                                    ^
/usr/local/include/git2/config.h:182:1: note: 'git_config_add_file_ondisk' declared here
GIT_EXTERN(int) git_config_add_file_ondisk(
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:1962:14: warning: implicit declaration of function 'git_config_delete' is invalid in C99 [-Wimplicit-function-declaration]
  err_idx1 = git_config_delete(this_idx1, name_idx2);
             ^
src/pre_generated-git2.nobj.c:2433:52: error: too few arguments to function call, expected 2, have 1
  rc_git_index_read_idx1 = git_index_read(this_idx1);
                           ~~~~~~~~~~~~~~          ^
/usr/local/include/git2/index.h:252:1: note: 'git_index_read' declared here
GIT_EXTERN(int) git_index_read(git_index *index, int force);
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:2467:63: error: too few arguments to function call, expected 3, have 2
  rc_git_index_find_idx1 = git_index_find(this_idx1, path_idx2);
                           ~~~~~~~~~~~~~~                     ^
/usr/local/include/git2/index.h:586:1: note: 'git_index_find' declared here
GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:2475:3: warning: implicit declaration of function 'git_index_uniq' is invalid in C99 [-Wimplicit-function-declaration]
  git_index_uniq(this_idx1);
  ^
src/pre_generated-git2.nobj.c:2486:63: error: too many arguments to function call, expected 2, have 3
  rc_git_index_add_idx1 = git_index_add(this_idx1, path_idx2, stage_idx3);
                          ~~~~~~~~~~~~~                       ^~~~~~~~~~
/usr/local/include/git2/index.h:414:1: note: 'git_index_add' declared here
GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_entry);
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:2503:28: warning: implicit declaration of function 'git_index_add2' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_add2_idx1 = git_index_add2(this_idx1, source_entry_idx2);
                           ^
src/pre_generated-git2.nobj.c:2522:30: warning: implicit declaration of function 'git_index_append' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_append_idx1 = git_index_append(this_idx1, path_idx2, stage_idx3);
                             ^
src/pre_generated-git2.nobj.c:2539:31: warning: implicit declaration of function 'git_index_append2' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_append2_idx1 = git_index_append2(this_idx1, source_entry_idx2);
                              ^
src/pre_generated-git2.nobj.c:2556:71: error: too few arguments to function call, expected 3, have 2
  rc_git_index_remove_idx1 = git_index_remove(this_idx1, position_idx2);
                             ~~~~~~~~~~~~~~~~                         ^
/usr/local/include/git2/index.h:387:1: note: 'git_index_remove' declared here
GIT_EXTERN(int) git_index_remove(git_index *index, const char *path, int stage);
^
/usr/local/include/git2/common.h:31:27: note: expanded from macro 'GIT_EXTERN'
# define GIT_EXTERN(type) extern \
                          ^
src/pre_generated-git2.nobj.c:2573:27: warning: implicit declaration of function 'git_index_get' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_get_idx1 = git_index_get(this_idx1, n_idx2);
                          ^
src/pre_generated-git2.nobj.c:2573:25: warning: incompatible integer to pointer conversion assigning to 'IndexEntry *' (aka 'struct git_index_entry *') from 'int' [-Wint-conversion]
  rc_git_index_get_idx1 = git_index_get(this_idx1, n_idx2);
                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pre_generated-git2.nobj.c:2591:43: warning: implicit declaration of function 'git_index_entrycount_unmerged' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_entrycount_unmerged_idx1 = git_index_entrycount_unmerged(this_idx1);
                                          ^
src/pre_generated-git2.nobj.c:2602:43: warning: implicit declaration of function 'git_index_get_unmerged_bypath' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_get_unmerged_bypath_idx1 = git_index_get_unmerged_bypath(this_idx1, path_idx2);
                                          ^
src/pre_generated-git2.nobj.c:2602:41: warning: incompatible integer to pointer conversion assigning to 'const IndexEntryUnmerged *' (aka 'const int *') from 'int' [-Wint-conversion]
  rc_git_index_get_unmerged_bypath_idx1 = git_index_get_unmerged_bypath(this_idx1, path_idx2);
                                        ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pre_generated-git2.nobj.c:2612:44: warning: implicit declaration of function 'git_index_get_unmerged_byindex' is invalid in C99 [-Wimplicit-function-declaration]
  rc_git_index_get_unmerged_byindex_idx1 = git_index_get_unmerged_byindex(this_idx1, n_idx2);
                                           ^
src/pre_generated-git2.nobj.c:2612:42: warning: incompatible integer to pointer conversion assigning to 'const IndexEntryUnmerged *' (aka 'const int *') from 'int' [-Wint-conversion]
  rc_git_index_get_unmerged_byindex_idx1 = git_index_get_unmerged_byindex(this_idx1, n_idx2);
                                         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/pre_generated-git2.nobj.c:2650:8: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                free(this_idx1->path);
                     ^~~~~~~~~~~~~~~
/usr/include/stdlib.h:143:18: note: passing argument to parameter here
void     free(void *);
                    ^
src/pre_generated-git2.nobj.c:2729:8: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                free(this_idx1->path);
                     ^~~~~~~~~~~~~~~
/usr/include/stdlib.h:143:18: note: passing argument to parameter here
void     free(void *);
                    ^
src/pre_generated-git2.nobj.c:2732:10: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        strncpy(this_idx1->path, val_idx2, val_len_idx2);
                ^~~~~~~~~~~~~~~
/usr/include/secure/_string.h:119:28: note: expanded from macro 'strncpy'
  __builtin___strncpy_chk (dest, src, len, __darwin_obsz (dest))
                           ^
src/pre_generated-git2.nobj.c:2733:32: error: read-only variable is not assignable
        this_idx1->path[val_len_idx2] = 0;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
src/pre_generated-git2.nobj.c:2802:26: error: no member named 'oid' in 'struct git_index_entry'
        field_idx1 = this_idx1->oid;
                     ~~~~~~~~~  ^
src/pre_generated-git2.nobj.c:2836:23: error: member reference base type 'IndexEntryUnmerged' (aka 'int') is not a structure or union
        mode_idx1 = this_idx1->mode[idx_idx2];
                    ~~~~~~~~~^ ~~~~
src/pre_generated-git2.nobj.c:2850:22: error: member reference base type 'IndexEntryUnmerged' (aka 'int') is not a structure or union
        oid_idx1 = this_idx1->oid[idx_idx2];
                   ~~~~~~~~~^ ~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
22 warnings and 20 errors generated.

Error: Build error: Failed compiling object src/pre_generated-git2.nobj.o

I'm not sure how to proceed. Ideas?

@virullius
Copy link

Despite being 3 years old, this issue is still valid.
The best I can tell, the generated source file used Lua 5.0, contrary to the rockspec file which claims Lua 5.1+ is required.
I have yet to successfully regenerate the bindings.

@webhive
Copy link

webhive commented Jun 29, 2019

Same issue - Lua 5.3

@ghost
Copy link

ghost commented Nov 16, 2022

Pretty obvious that it would be, but this is still the case for Lua 5.4.

@Neopallium
Copy link
Member

Now supports Lua 5.2, 5.3 and 5.4. CMake should compile/link against what is installed.

@Freed-Wu
Copy link

Cannot work for lua 5.1. many projects use lua 5.1 (luajit) such as neovim. such as https://github.com/SuperBo/fugit2.nvim

lua-git2 scm-0 depends on lua >= 5.1 (5.1-1 provided by VM: success)
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/pre_generated-git2.nobj.c -o src/pre_generated-git2.nobj.o -I/usr/include
src/pre_generated-git2.nobj.c: In function ‘IndexEntry__delete__meth’:
src/pre_generated-git2.nobj.c:3186:31: warning: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 3186 |                 free(this_idx1->path);
      |                      ~~~~~~~~~^~~~~~
In file included from /usr/include/git2/common.h:11,
                 from /usr/include/git2/annotated_commit.h:10,
                 from /usr/include/git2.h:11,
                 from src/pre_generated-git2.nobj.c:69:
/usr/include/stdlib.h:687:25: note: expected ‘void *’ but argument is of type ‘const char *’
  687 | extern void free (void *__ptr) __THROW;
      |                   ~~~~~~^~~~~
src/pre_generated-git2.nobj.c: In function ‘IndexEntry__set_path__meth’:
src/pre_generated-git2.nobj.c:3277:31: warning: passing argument 1 of ‘free’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 3277 |                 free(this_idx1->path);
      |                      ~~~~~~~~~^~~~~~
/usr/include/stdlib.h:687:25: note: expected ‘void *’ but argument is of type ‘const char *’
  687 | extern void free (void *__ptr) __THROW;
      |                   ~~~~~~^~~~~
src/pre_generated-git2.nobj.c: In function ‘Commit__create__func’:
src/pre_generated-git2.nobj.c:3742:42: error: passing argument 10 of ‘git_commit_create’ from incompatible pointer type [-Wincompatible-pointer-types]
 3742 |                 tree_idx8, parent_count, parents);
      |                                          ^~~~~~~
      |                                          |
      |                                          const git_commit **
In file included from /usr/include/git2/repository.h:14,
                 from /usr/include/git2/annotated_commit.h:11:
/usr/include/git2/commit.h:369:28: note: expected ‘git_commit * const*’ but argument is of type ‘const git_commit **’
  369 |         git_commit * const parents[]);
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~
                                                                                                                                                                                                                             
Error: Build error: Failed compiling object src/pre_generated-git2.nobj.o

@Neopallium
Copy link
Member

@Freed-Wu Which libgit2 version?
I was able to compile using Lua5.1 and libgit2 v1.1 on Ubuntu 22.04

@Neopallium Neopallium reopened this Sep 24, 2024
@Freed-Wu
Copy link

I test two machines. Bug is same.

  • ArchLinux:
    • lua: luajit 2.1.1720049189
    • libgit2: 1.8.1
  • NixOS:
    • lua: luajit 2.1.1713773202
    • libgit2: 1.8.1

@Neopallium
Copy link
Member

@Freed-Wu Please try the latest code and let me know if it fixes that compile error for you. libgit2 version 1.8 changed pointer const of the parents parameter. It looks like the latest HEAD version has reverted that change. For these bindings I have added a special case fix for 1.8.

@Freed-Wu
Copy link

Cloning into 'luagit2'...
src/pre_generated-git2.nobj.c:28:13: error: static declaration of ‘luaL_setfuncs’ follows non-static declaration
   28 | static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
      |             ^~~~~~~~~~~~~
In file included from src/pre_generated-git2.nobj.c:10:
/nix/store/48vxxhagdr2llpibwswk88cwlzvp3909-luajit-2.1.1713773202/include/luajit-2.1/lauxlib.h:88:18: note: previous declaration of ‘luaL_setfuncs’ with type ‘void(lua_State *, const luaL_Reg *, int)’
   88 | LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
      |                  ^~~~~~~~~~~~~

Error: Build error: Failed compiling object src/pre_generated-git2.nobj.o

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

5 participants