Apparent Dis-improvement - new dependency on pkg-config

19 views
Skip to first unread message

gbulmer

unread,
Mar 5, 2012, 5:19:37 PM3/5/12
to stm32
I'd like to understand why an extra dependency on pkg-config has been
added to stlink.
Previously the only requirements were a working gcc toolchain and
lubusb-1.0.
IMHO, that was superb.

It has now been dis-improved by 50%.
AFAICT pkg-config is only to give the include file path and library
path for libusb-1.0.

This seems like a disproportionate level of complication. Especially
if I've just downloaded and built libusb-1.0, which AFAIK, installs in
a fixed location, unless I take action.

Put another way, either:
1. the location of libusb-1.0 is well defined on a Mac if I just let
it take its defaults, so there is no need for pkg-config, or
2. if libusb-1.0 is not installed in its default location, I
consciously took that decision, so I know where I put it, and I can
fill in the value in the Makefile, and still don't need pkg-config.

Am I missing something?

Uwe Bonnes

unread,
Mar 6, 2012, 4:43:19 AM3/6/12
to stm3...@googlegroups.com
>>>>> "gbulmer" == gbulmer <gbu...@gmail.com> writes:

gbulmer> I'd like to understand why an extra dependency on pkg-config
gbulmer> has been added to stlink. Previously the only requirements
gbulmer> were a working gcc toolchain and lubusb-1.0. IMHO, that was
gbulmer> superb.

What files are you talking about:
stlink-texane> find |grep pkg
doesn't give any hits...

Bye
--
Uwe Bonnes b...@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

G Bulmer

unread,
Mar 6, 2012, 6:26:51 AM3/6/12
to stm3...@googlegroups.com
The command:
  stlink-texane> find |grep pkg
is likely incorrect.

The command:
  stlink-texane> find
would produce:
  usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
              find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
so the '| grep pkg' won't match anything.

Maybe you meant to type:
   stlink $ find . | xargs grep pkg
which produces:

./doc/tutorial/tutorial.tex:\item pkg-config
./flash/Makefile:LDFLAGS+=`pkg-config --libs libusb-1.0`
./flash/Makefile:CFLAGS+=`pkg-config --cflags libusb-1.0`
./gdbserver/Makefile:LDFLAGS+=`pkg-config --libs libusb-1.0`
./gdbserver/Makefile:CFLAGS+=`pkg-config --cflags libusb-1.0`
./Makefile:LDFLAGS+=`pkg-config --libs libusb-1.0`
./Makefile:CFLAGS+=`pkg-config --cflags libusb-1.0`
./README:. pkg-config

The important lines are in the Makefiles.

The line in, for example, ./flash/Makefile:
  LDFLAGS+=`pkg-config --libs libusb-1.0`
replaces
  LDFLAGS+= -lusb-1.0

The effect of the new lines in the Makefile is to introduce a dependency on pkg-config.
pkg-config is not installed on a Mac. So the dependencies have gone from gcc and libusb-1.0, only two dependencies, to three, by adding pkg-config, which is 50% worse.

As I explained in my initial posting, pkg-config doesn't seem to add much value.
Either libusb-1.0 is in the default place, and is set up correctly, in which case the Makefile can say:
  LDFLAGS+= -lusb-1.0
or I must have installed it somewhere else, in which case I will likely know where it is, and can change the Makefile.

So, I am trying to understand why Mac users are forced to install another piece of software (pkg-config), to resolve a dependency.
IMHO, it is more work to install pkg-config than to change a line in a Makefile.
I think it is likely no work for most people, who will likely accept the default install location for libusb-1.0.

GB

Uwe Bonnes

unread,
Mar 6, 2012, 8:15:06 AM3/6/12
to stm3...@googlegroups.com
>>>>> "G" == G Bulmer <gbu...@gmail.com> writes:

G> The command:
stlink-texane> find |grep pkg
G> is likely incorrect.

Is is correct to find files contaning "pkg" in their name..

...

G> The important lines are in the Makefiles.

G> The line in, for example, ./flash/Makefile: LDFLAGS+=`pkg-config
G> --libs libusb-1.0` replaces LDFLAGS+= -lusb-1.0

G> The effect of the new lines in the Makefile is to introduce a
G> dependency on pkg-config. pkg-config is not installed on a Mac. So
G> the dependencies have gone from gcc and libusb-1.0, only two
G> dependencies, to three, by adding pkg-config, which is 50% worse.

Cross platform library management is always a
headache. http://en.wikipedia.org/wiki/Pkg-config tells that Pkg-config is a
crossplatform tool to help this task.

G> As I explained in my initial posting, pkg-config doesn't seem to add
G> much value. Either libusb-1.0 is in the default place, and is set up
G> correctly, in which case the Makefile can say: LDFLAGS+= -lusb-1.0 or
G> I must have installed it somewhere else, in which case I will likely
G> know where it is, and can change the Makefile.

Pkg-config helps at least on Linux and is available on MAC

G> So, I am trying to understand why Mac users are forced to install
G> another piece of software (pkg-config), to resolve a dependency.
G> IMHO, it is more work to install pkg-config than to change a line in
G> a Makefile. I think it is likely no work for most people, who will
G> likely accept the default install location for libusb-1.0.

So if you don't feel like installing Pkg-config which will probably ease
installation of other open source projects too, you are free to edit the
Makefile too. Or if you have other ideas , beside everybody editing the
Makefile, tell your ideas here.

G Bulmer

unread,
Mar 6, 2012, 8:54:09 AM3/6/12
to stm3...@googlegroups.com
On Tue, Mar 6, 2012 at 1:15 PM, Uwe Bonnes <b...@elektron.ikp.physik.tu-darmstadt.de> wrote:
>>>>> "G" == G Bulmer <gbu...@gmail.com> writes:

   G> The command:
   stlink-texane> find |grep pkg
   G> is likely incorrect.

Is is correct to find files contaning "pkg" in their name..
Have you tried that command on a Mac?

As I wrote
  stlink-texane> find
gives the error message:

  usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
              find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
so it really doesn't matter what the command after the pipe is.

Assuming you mean:
    stlink-texane> find . | grep pkg
That doesn't find dependencies, i.e parts which must be separately downloaded or installed.

It does find files with pkg in their name, but that, I think by definition, doesn't find any dependencies. For stlink to be dependent on it, it **must not** be part of the stlink repository.

The very simple solution is to use the line:
  LDFLAGS+= -lusb-1.0
on the basis that the vast majority of people will install libusb-1.0 in a default location.

If you firmly believe pkg-config helps on LINUX, make the Makefile conditional on the platform being Linux, or even the result of
which -s pkg-config

I can only test the case where pkg-config is not installed, but I am very happy to do that.
GB


Reply all
Reply to author
Forward
0 new messages