[haiku-development] Re: Trouble loading LibGit2 library

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 15 May 2018 11:26:27 +0000

15 mai 2018 10:08 "Stephan Aßmus" <superstippi@xxxxxx> a écrit:

I've installed the GCC2 libgit2 package, but I am having trouble getting the 
compile of the add-on
to work. It seems code from the addon should "#include <git2.h>" and nothing 
else. That header is
found at /boot/system/develop/headers/ and itself includes all the relevant 
headers from a
sub-directory "git2" in /boot/system/develop/headers. These headers in turn 
include sibling headers
which are located in that same subdirectory. But the compiler does not find 
them. If I add
SYSTEM_INCLUDE_PATHS = /boot/system/develop/headers/git2 in the Makefile for 
TrackGit, then the
compiler finds the sibling headers. However, it also finds headers in there 
that are clearly not
intended to be there such as stdint.h, or should contain different 
conditions, since this header
for example is to be used as a fallback when compiling with MSVC.

When I install a development package and it puts its headers in the common 
header location, am I
supposed to do something in the Makefile to make these headers work, or 
should they just work as
is? To phrase differently: Is the package broken or are we missing something?

How the include files should be used is a decision from upstream. Possible 
cases are:
- Nothing to do, headers installed in default includ paths
- Custom -I... added to compiler options as documented by the package
- Use of "pkg-config --cflags" or similar tools to help determine the compiler 
options

Libgit2 seems to come with a pkg-config file 
(https://github.com/libgit2/libgit2/blob/f9cf9a04ba61cba7b1112764dd25c0e4638bed75/libgit2.pc.in)
 so the third option should apply here.

I see that examples from libgit2 are using includes with quotes, not with 
brackets. So I'm not sure if it's possible to put the libgit headers in the 
system include path. Maybe we should at least remove the MSVC specific headers 
from our package.

-- 
Adrien.

Other related posts: