NLnetLabs / unbound

Unbound is a validating, recursive, and caching DNS resolver.
https://nlnetlabs.nl/unbound
BSD 3-Clause "New" or "Revised" License
3.15k stars 359 forks source link

How to configure unbound with --enable-dnstap: Issue protoc-c... no #1180

Closed sunbearc22 closed 1 week ago

sunbearc22 commented 1 week ago

Describe the bug When configuring unbound with --enable-dnstap, it can't locate protobuf-c.

$ ./configure --enable-dnstap
...
...
...
checking for protoc-c... no
configure: error: The protoc-c program was not found. Please install protobuf-c!

I have checked that protobuf-c is installed.

$ dpkg -l | grep protobuf
ii  libprotobuf-c-dev:armhf              1.4.1-1+b1                              armhf        Protocol Buffers C static library and headers (protobuf-c)
ii  libprotobuf-c1:armhf                 1.4.1-1+b1                              armhf        Protocol Buffers C shared library (protobuf-c)
$ sudo find / -name libprotobuf-c1
/usr/share/doc/libprotobuf-c1
$ sudo find / -name libprotobuf-c-dev
/usr/share/doc/libprotobuf-c-dev

I discovered from this answer that the library name is libprotobuf-c.so.1. Its location was found using:

$ sudo find / -name libprotobuf-c.so.1
/usr/lib/arm-linux-gnueabihf/libprotobuf-c.so.1
$ ls -la /usr/lib/arm-linux-gnueabihf | grep libprotobuf-c.so.1
lrwxrwxrwx  1 root root       22 Nov 23  2022 libprotobuf-c.so -> libprotobuf-c.so.1.0.0
lrwxrwxrwx  1 root root       22 Nov 23  2022 libprotobuf-c.so.1 -> libprotobuf-c.so.1.0.0
-rw-r--r--  1 root root    66892 Nov 23  2022 libprotobuf-c.so.1.0.0

I have also tried these commands:

./configure --enable-dnstap --with-protobuf-c=/usr/lib/arm-linux-gnueabihf/libprotobuf-c.so.1

and

./configure --enable-dnstap --with-protobuf-c="/usr/lib/arm-linux-gnueabihf/libprotobuf-c.so.1"

However, I am still getting the same error msgs:

checking for protoc-c... no
configure: error: The protoc-c program was not found. Please install protobuf-c!

The unbound version that I am trying to configure is 1.22.0.

To reproduce Steps to reproduce the behavior: As described above.

Expected behavior The configuration should have worked.

System:

Additional information Nil.

wcawijngaards commented 1 week ago

Apart from the libprotobuf-c, unbound also uses the protoc-c program. The packages for that could be separated. Also development versions of the library packages need to be installed, since the compilation uses the development headers to link to the library. Perhaps it is called protobuf-c-dev or protobuf-c-devel, or the protoc-c application has its own package.

wcawijngaards commented 1 week ago

Since libprotobuf-c-dev is installed, this is likely about the /usr/bin/protoc-c program that is needed. It compiles the protocol buffers annotation for the format that is used. The program is used during the compilation to create the header that is used with the library. If it is installed in a different place, PROTOC_C=/path/to/protoc-c can be used to set the program location at the configure call.

sunbearc22 commented 1 week ago

@wcawijngaards These are what I found. Which should I install?

$ sudo apt search protobuf-c
Sorting... Done
Full Text Search... Done
libprotobuf-c-dev/stable,now 1.4.1-1+b1 armhf [installed]
  Protocol Buffers C static library and headers (protobuf-c)

libprotobuf-c1/stable,now 1.4.1-1+b1 armhf [installed,automatic]
  Protocol Buffers C shared library (protobuf-c)

librust-prometheus+protobuf-codegen-pure-dev/stable 0.13.3-1 armhf
  Prometheus instrumentation library for Rust applications - feature "protobuf-codegen-pure" and 1 more

librust-protobuf-codegen-dev/stable 2.27.1-1+b2 armhf
  Code generator for rust-protobuf - Rust source code

librust-protobuf-codegen-pure-dev/stable 2.27.1-1 armhf
  Pure-rust codegen for protobuf using protobuf-parser crate - Rust source code

protobuf-c-compiler/stable 1.4.1-1+b1 armhf
  Protocol Buffers C compiler (protobuf-c)

protobuf-codegen/stable 2.27.1-1+b2 armhf
  Code generator for rust-protobuf

protobuf-compiler/stable 3.21.12-3 armhf
  compiler for protocol buffer definition files

protobuf-compiler-grpc/stable 1.51.1-3+b1 armhf
  high performance general RPC framework - protobuf plugin

protobuf-compiler-grpc-java-plugin/stable 1.41.3+ds-1 armhf
  high performance general RPC framework - protobuf Java plugin

$ sudo apt search protoc-c
Sorting... Done
Full Text Search... Done
$ sudo find / -name protoc-c
$ sudo apt search protobuf-c
Sorting... Done
Full Text Search... Done
libprotobuf-c-dev/stable,now 1.4.1-1+b1 armhf [installed]
  Protocol Buffers C static library and headers (protobuf-c)

libprotobuf-c1/stable,now 1.4.1-1+b1 armhf [installed,automatic]
  Protocol Buffers C shared library (protobuf-c)

librust-prometheus+protobuf-codegen-pure-dev/stable 0.13.3-1 armhf
  Prometheus instrumentation library for Rust applications - feature "protobuf-codegen-pure" and 1 more

librust-protobuf-codegen-dev/stable 2.27.1-1+b2 armhf
  Code generator for rust-protobuf - Rust source code

librust-protobuf-codegen-pure-dev/stable 2.27.1-1 armhf
  Pure-rust codegen for protobuf using protobuf-parser crate - Rust source code

protobuf-c-compiler/stable 1.4.1-1+b1 armhf
  Protocol Buffers C compiler (protobuf-c)

protobuf-codegen/stable 2.27.1-1+b2 armhf
  Code generator for rust-protobuf

protobuf-compiler/stable 3.21.12-3 armhf
  compiler for protocol buffer definition files

protobuf-compiler-grpc/stable 1.51.1-3+b1 armhf
  high performance general RPC framework - protobuf plugin

protobuf-compiler-grpc-java-plugin/stable 1.41.3+ds-1 armhf
  high performance general RPC framework - protobuf Java plugin

$ sudo apt search protoc-c
Sorting... Done
Full Text Search... Done
$ sudo find / -name protoc-c
$ sudo find / -name protobuf-c-dev
$ sudo find / -name protobuf-c-devel
$

I can't seem to find a program called protoc-c.

wcawijngaards commented 1 week ago

The protoc-c is a code generator that generates the headers that unbound is going to use, so I guess the packages protobuf-c-compiler/stable and protobuf-compiler/stable make the most sense. Probably one relies on the other, with the c specific one needed, possibly.

The package system may be able to answer what package provides an executable by name, as a search method.

sunbearc22 commented 1 week ago

@wcawijngaards Thanks. After sudo apt install protobuf-c-compiler protobuf-compiler, ./configure --enable-dnstap worked.

wcawijngaards commented 1 week ago

Nice to hear that. There is also a test dnstap service program, make with make unbound-dnstap-socket, and with -u socketpath -l it can print out the dnstap information, it is used for tests.