Re: libtraceevent installing in wrong folder

From: Sudip Mukherjee
Date: Sat Nov 09 2019 - 19:44:30 EST


On Fri, Nov 08, 2019 at 12:05:48PM -0500, Steven Rostedt wrote:
>
> [ I also added linux-trace-devel, but it was good to Cc LKML too ]
>
> On Fri, 8 Nov 2019 16:11:57 +0000
> Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx> wrote:
>
> > Hi Steve,
> >
> > I tried to install libtraceevent. and I used the command:
> > "make DESTDIR=/home/sudip/test prefix=/usr install" from tool/lib/traceevent
> >

<snip>

> >
> > I am seeing two problems:
> > 1) It created another home/sudip/test folder inside /home/sudip/test and
> > the header files are installed in /home/sudip/test/home/sudip/test/usr/include folder.
> > They should have been in /home/sudip/test/usr/include.
> >
> > 2) I used prefix=/usr but the 'pkgconfig' still went to /usr/local
> >
> > Did I do something wrong?
>
> No, but you showed that the installation part is poorly tested. I
> mostly tested just the code from trace-cmd, and even the installation
> paths from that repo. I should have tested the kernel repo as well, but
> failed to do this.
>
> Thanks for reporting, I need to take a look, or if you want to have a go
> at it, that would be great too :-)

Attached is a patch for the wrong installation of header files.
For the pkgconfig, the problem is at:
pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) \
--variable pc_path pkg-config | tr ":" " "))

This is checking 'pc_path' which is the search path used by pkg-config
and then its taking the first path from that list and using in pkgconfig_dir,
which can be wrong.
A reliable way to get the pkg-config location is if I use:

pkg=$(pkg-config --list-all | head -1 | cut -d ' ' -f 1)
pkg-config --variable=pcfiledir $pkg

But I will need to see how I can use this in a Makefile, will send this
patch later, or if you can find a better way before me that will be great.

--
Regards
Sudip