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

Building without threads gives linking error for: git___load #5663

Closed
jeroen opened this issue Oct 13, 2020 · 0 comments · Fixed by #5664
Closed

Building without threads gives linking error for: git___load #5663

jeroen opened this issue Oct 13, 2020 · 0 comments · Fixed by #5664

Comments

@jeroen
Copy link
Contributor

jeroen commented Oct 13, 2020

I run into a bug introduced by #5594 when building -DTHREADSAFE=OFF.

[ 47%] Building C object src/CMakeFiles/git2internal.dir/index.c.obj
In file included from C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/common.h:81,
                 from C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/index.h:10,
                 from C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/index.c:8:
C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/index.c: In function 'git_index_set_caps':
C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/thread-utils.h:344:32: warning: implicit declaration of function 'git___load'; did you mean 'git__load'? [-Wimplicit-function-declaration]
 #define git__load(ptr) (void *)git___load((void * volatile *)&ptr)
                                ^~~~~~~~~~
C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/thread-utils.h:344:32: note: in definition of macro 'git__load'
 #define git__load(ptr) (void *)git___load((void * volatile *)&ptr)
                                ^~~~~~~~~~
C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/index.c:50:46: note: in expansion of macro 'GIT_REFCOUNT_OWNER'
 #define INDEX_OWNER(idx) ((git_repository *)(GIT_REFCOUNT_OWNER(idx)))
                                              ^~~~~~~~~~~~~~~~~~
C:/msys64/home/mingw-packages/mingw-w64-libgit2/src/libgit2-1.1.0/src/index.c:574:26: note: in expansion of macro 'INDEX_OWNER'
   git_repository *repo = INDEX_OWNER(index);
                          ^~~~~~~~~~~

Eventually the build succeeds, however the libgit2.a library gives linking errors looking for git___load. I think the problem is that git___load is defined within a #ifdef GIT_THREADS block, but not the macro that uses it.

This is libgit2 1.1.0 on mingw-w64 with gcc 8.3.0.
cc @lhchavez

lhchavez added a commit to lhchavez/libgit2 that referenced this issue Oct 13, 2020
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: libgit2#5663
lhchavez added a commit to lhchavez/libgit2 that referenced this issue Oct 13, 2020
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: libgit2#5663
ethomson pushed a commit that referenced this issue Jun 20, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
ethomson pushed a commit that referenced this issue Jun 29, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
ethomson pushed a commit that referenced this issue Jun 29, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
ethomson pushed a commit that referenced this issue Jun 29, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
ethomson pushed a commit that referenced this issue Jun 29, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
ethomson pushed a commit that referenced this issue Jun 30, 2021
This should allow folks that build in non-thread-safe environments to
still be able to build the library.

Fixes: #5663
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

Successfully merging a pull request may close this issue.

1 participant