#989958 libopencv-*-dev: Missing pkg-config file (.pc)

Package:
libopencv-core-dev
Source:
opencv
Description:
development files for libopencv-core4.5d
Submitter:
Alejandro Colomar
Date:
2025-02-24 21:54:01 UTC
Severity:
wishlist
Tags:
#989958#5
Date:
2021-06-16 15:31:31 UTC
From:
To:
Dear Maintainer,

This bug actually does apply to all of the *-dev libopencv packages.

None of them contain the needed pkg-conig files for their use, making
necessary to install 'libopencv', and making useless the separation into
smaller packages.

If you can't install that file in every binary package, you may
create a new binary package that only contains the .pc file,
let's say libopencv-pc, and make all packages depend on it.


Thanks,

Alex

#989958#10
Date:
2021-06-21 15:35:21 UTC
From:
To:
Hi Jochen,
The problem in the first place is that opencv doesn't provide separate
pkg-config files for every module.

Maybe Debian could write separate pkg-config files, and maybe offer them
to upstream OpenCV (I offer myself to help write them if you decide it's
a good idea).

Yes, for linking against the shared libraries, that's all you need: link
against the module you want.  BUT, if you want to try to link against
the static library (and now I'm talking from memory (it's been a year
since I tried to do that, and I don't remember the result, I only
remember a bunch of errors)), you'll need to know which libraries you
need, which is the magic of pkg-config.
Moving everything into libopencv-dev would create a very big package
when developers may not need all of opencv (I for example only depend on
a few modules to build my programs).  One thing that I love of Debian
packages is that they tend to be very modular compared to other distros.
  Please don't put everything in one single pkg :-).

Thanks!

Cheers,

Alex

#989958#15
Date:
2021-06-21 12:33:09 UTC
From:
To:
Hi Alejandro,

* Alejandro Colomar <alx.manpages@gmail.com> [2021-06-16 17:31]:

You don't need to use pkg-config to build against an OpenCV module, just
running gcc with the flags you need will work. Adjusting severity
accordingly.

This sounds overly complicated to me. I think we should move all
development files into one libopencv-dev if we want to fix this.
But that's choice of the maintainers.

Cheers Jochen

#989958#22
Date:
2021-06-21 18:43:14 UTC
From:
To:
* Alejandro Colomar (man-pages) <alx.manpages@gmail.com> [2021-06-21 17:35]:

It's easier if you talk to upstream about this directly. Adding them to
Debian only would be incompatible with other distros and be of limited
use.

Static linking should work fine without pkg-config as well, except that
you would have to list all dependencies, but looking at the opencv4.pc I
guess they are incomplete anyhow ;).

Cheers Jochen

#989958#27
Date:
2021-07-03 17:13:45 UTC
From:
To:
Hi Jochen,

It seems that they decided long ago to drop support for pkg-config
files.  See
<https://github.com/opencv/opencv/issues/20269#event-4970006284> and
<https://github.com/opencv/opencv/issues/13154>

Their only response is "consider using cmake's `find_package()`", which
is not an option for me, and BTW not an option also in many other
important projects.

What should we do about it?  Maintain our pkg-config files in Debian?

Yep, I meant that it's insane adding all of the -l... manually.  That's
the "magic" of pkg-config :).

Cheers,

Alex

#989958#32
Date:
2021-07-21 15:32:20 UTC
From:
To:
Hi Alejandro,

* Alejandro Colomar (man-pages) <alx.manpages@gmail.com> [2021-07-03 19:13]:

I talked to them and the agreed to accept patches if the pkg-config
files are generated automatically. Would you be interested to provide a
patch? There is some code in PCL for this you could borrow, maybe.

I think that would be to big of a patch.

Cheers Jochen

#989958#37
Date:
2021-07-25 19:38:24 UTC
From:
To:
Hi Jochen,

Hmmm, I'd like to, but I have zero idea of cmake (I guess they want to
autogenerate it with cmake), so I'm not sure I could do that.

Yes.  What is Fedora doing?  Do you know?


Cheers,

Alex

#989958#42
Date:
2021-07-25 21:31:38 UTC
From:
To:
* Alejandro Colomar (man-pages) <alx.manpages@gmail.com> [2021-07-25 21:38]:

They provide a opencv.pc:

https://fedora.pkgs.org/rawhide/fedora-x86_64/opencv-devel-4.5.3-1.fc35.x86_64.rpm.html

The opencv4.pc is a symbolic link:

https://src.fedoraproject.org/rpms/opencv/blob/rawhide/f/opencv.spec#_350

Cheers Jochen

#989958#47
Date:
2021-07-26 10:26:12 UTC
From:
To:
Hi Nicolas,

I'm adding you to this thread, as you commented on opencv's thread about
pkg-config files.

I'd like to know if you forked opencv's .pc file and are maintaining it,
or if you just renamed it to opencv.pc, or what you decided to do at all.

I've had a lot of problems with their .pc file.  The last one being that
it uses -I instead of -isystem so I have a lot of warnings from their code.

I'd like to patch opencv with a correct pc file, but they want it
autogenerated and I don't know cmake...  So I'm considering all options
available.

Thanks,

Alex