Bug 256064

Summary: dns/unbound: Installs broken .pc file:
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Some People CC: jaap
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: jaap: maintainer-feedback+
koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Yuri Victorovich freebsd_committer 2021-05-22 00:47:24 UTC
libunbound.pc installed by unbound-1.13.1 prints this:

> $ pkg-config --cflags libunbound
> Package libcrypto was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libcrypto.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libcrypto', required by 'virtual:world', not found
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-22 00:54:40 UTC
^Triage: Note, any change fixing this issue is:

Approved by: portmgr (blanket: bugfix)
MFH: <branch> (blanket: bugfix)
Comment 2 Jaap Akkerhuis 2021-05-22 12:10:19 UTC
(In reply to Yuri Victorovich from comment #0)
I don't see this with the default package, there I get:

  $ pkg-config --cflags libunbound
  -I/usr/local/include

Are you building the port yourself with chnaged options? Can you tell which options you use (by using "unbound -V" and/or "pkg info unbound-1.13.1).
Comment 3 Yuri Victorovich freebsd_committer 2021-05-22 17:27:24 UTC
(In reply to Jaap Akkerhuis from comment #2)

> Are you building the port yourself with chnaged options?

No, I installed from a FreeBSD server-built package.

Options are default:
Options        :
	DNSCRYPT       : off
	DNSTAP         : off
	DOCS           : on
	DOH            : on
	ECDSA          : on
	EVAPI          : off
	FILTER_AAAA    : off
	GOST           : on
	HIREDIS        : off
	LIBEVENT       : on
	MUNIN_PLUGIN   : off
	PYTHON         : off
	SUBNET         : off
	TFOCL          : off
	TFOSE          : off
	THREADS        : on
Comment 4 Yuri Victorovich freebsd_committer 2021-05-22 17:33:15 UTC
In the kernel log obtained with:
> $ ktrace -di pkg-config --cflags libunbound
> $ kdump

it prints failed attempts to open libcrypto*.pc:
>  38586 pkgconf  CALL  open(0x7ffffffecb40,0<O_RDONLY>)
>  38586 pkgconf  NAMI  "/usr/local/libdata/pkgconfig/libcrypto-uninstalled.pc"
>  38586 pkgconf  RET   open -1 errno 2 No such file or directory
>  38586 pkgconf  CALL  open(0x7ffffffed340,0<O_RDONLY>)
>  38586 pkgconf  NAMI  "/usr/local/libdata/pkgconfig/libcrypto.pc"
>  38586 pkgconf  RET   open -1 errno 2 No such file or directory
>  38586 pkgconf  CALL  open(0x7ffffffecb40,0<O_RDONLY>)
>  38586 pkgconf  NAMI  "/usr/libdata/pkgconfig/libcrypto-uninstalled.pc"
>  38586 pkgconf  RET   open -1 errno 2 No such file or directory
>  38586 pkgconf  CALL  open(0x7ffffffed340,0<O_RDONLY>)
>  38586 pkgconf  NAMI  "/usr/libdata/pkgconfig/libcrypto.pc"
>  38586 pkgconf  RET   open -1 errno 2 No such file or directory

Do you have these files on your system?
Comment 5 Jaap Akkerhuis 2021-05-23 08:54:22 UTC
(In reply to Yuri Victorovich from comment #4)

No, I don't have these files but do have:
> /usr/local/libdata/pkgconfig/libcrypto.pc

This is installed by openssl:
> $ pkg which /usr/local/libdata/pkgconfig/libcrypto.pc
> /usr/local/libdata/pkgconfig/libcrypto.pc was installed by package openssl-1.1.1k_1,1

So to me it looks it ain't an unbound problem. My suggestion is to reinstall openssl.
Comment 6 Yuri Victorovich freebsd_committer 2021-05-23 09:14:55 UTC
(In reply to Jaap Akkerhuis from comment #5)

The openssl port isn't supposed to be installed normally because base OpenSSL should be used.

The correct solution is to remove all mentions of openssl from the .pc file because OpenSSL flags on FreeBSD are added by USES=ssl and ports aren't supposed to obtain them in any other way.
Comment 7 Jaap Akkerhuis 2021-05-23 10:21:49 UTC
(In reply to Yuri Victorovich from comment #6)

Plain USES=ssl is used and I don't touch the .pc files, so have to take this up with upstairs.
Comment 8 Yuri Victorovich freebsd_committer 2021-05-23 10:25:40 UTC
(In reply to Jaap Akkerhuis from comment #7)

When in other systems libcrypto.pc exists and is legitimately expected to be present, on FreeBSD it doesn't exist.

This is why it should be removed from unbound.pc by the port.
Comment 9 Yuri Victorovich freebsd_committer 2021-05-23 22:28:57 UTC
Created attachment 225209 [details]
patch

The attached patch removes OpenSSL-related values from .pc file.
Comment 10 Jaap Akkerhuis 2021-05-26 12:40:40 UTC
(In reply to Yuri Victorovich from comment #9)
Patch is fine.

We might consider to drop the whole ps file for FreeBSD, but others might complain about that. Meanwhile, upstairs is looking for a more generic solution.