Failed to compile vyconf from source code

I met an error when I compile vyconf from source code. Error message are as follows.

File “src/vyconfd.ml”, line 149, characters 17-41:
149 | with Protobuf.Decoder.Failure e → Lwt.return (Error (Protobuf.Decoder.error_to_string e))
^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module Protobuf
Command exited with code 2.

I guess I need to install protobuf package. But I fail to install protobuf package. I report an issue on github. Failed to install protobuf · Issue #15979 · ocaml/opam-repository · GitHub

I also fail to compile ocaml-protobuf from souce code. Error messages are as follows.

ocamlfind: Package `bitstring.syntax’ not found

Thanks for pointing this out!
The correct module name is Pbrt. The one named “protobuf” is a different project, maybe that’s why maintainers of ocaml-protoc renamed their modules—to avoid possible confusion.
I’ve pushed a fix and it should build now.

The vyconf codebase sure needs some love. The problem is that working on the still missing parts like commit algorithm will remain an academic exercise until the last script that relies on the old Perl API behaviour is gone. That point is much closer now than even a year ago, but it’s still at least a year ahead, by the most optimistic estimate.

GitHub - vyos/libvyosconfig: Shared library for VyOS config files parsing and manipulation that powers the vyos.configtree Python module already powers all new migration script and make writing them easy, so the already working parts of vyconf already had a positive impact.

If you want to work on the still missing parts, that’s much apprecited, but getting that even to a rolling release will take time. If your motivation is to make your own appliance based on it, that’s even better because it will faciliate testing vyconf algorithms in a way VyOS codebase can’t, yet.

I still fail to compile it. But I met a new error.

ocamlfind: [WARNING] Package `threads’: Linking problems may arise because of the missing -thread or -vmthread switch
File “none”, line 1:
Error: No implementations provided for the following modules:
Mutex referenced from /home/zi/.opam/4.07.0/lib/lwt/unix/lwt_unix.cmxa(Lwt_main)
Command exited with code 2.

So you mean I can switch to libvyosconfig? I love vyconf for it can generate node.def automatical and It provides http api.

vyconf doesn’t generate node.def’s. It doesn’t know what node.def’s are—it’s meant to replace the old config backend completely when the codebase is ready for it.

What generates node.def’s is a script in GitHub - vyos/vyos-1x: VyOS command definitions, scripts, and utilities Those XML command definition files in vyos-1x use the same format as vyconf will use in the future, so when the last handwritten node.def and last Perl script from Vyatta times is gone, we can start using vyconf in VyOS. Until that point, vyconf is useless because it doesn’t know anything about the old formats!

You cannot switch to libvyosconfig. That library provides ability to parse, VyOS configs, manipulate them in memory, and write back to disk. However, it doesn’t know what a “commit” is. All functionality still relies on the old code, except the migration scripts that convert old config option syntax to new after upgrade.

Could you tell us what you actually want to do?

I want to integrate the packages of vyos into my system (based on Linux) , so I can use vyos CLI and router features. I also want to develop a web GUI for it. That’s why I choose vyconf.

One more question, if I only use vyconf as CLI and http bridge for remote api calls, no other packages of vyos, is that possible?

Hi smartdabao,

I am also trying to build libvyosconfig package but it depends on vyconf package. Hence I am trying to install vyconf package.
I also get stuck at the same error you mentioned here,

ocamlfind: [WARNING] Package `threads’: Linking problems may arise because of the missing -thread or -vmthread switch
File “none”, line 1:
Error: No implementations provided for the following modules:
Mutex referenced from /root/.opam/4.07.0/lib/lwt/unix/lwt_unix.cmxa(Lwt_main)
Command exited with code 2.
Compilation unsuccessful after building 99 targets (95 cached) in 00:00:04.
E: Failure(“Command ‘’/root/.opam/4.07.0/bin/ocamlbuild’ src/vyconf.cma src/vyconf.cmxa src/vyconf.a src/vyconf.cmxs src/vyconfd-config.cma src/vyconfd-config.cmxa src/vyconfd-config.a src/vyconfd-config.cmxs src/client.cma src/client.cmxa src/client.a src/client.cmxs src/vyconfd.native src/vycli.native test/vytree_test.native test/reference_tree_test.native test/config_tree_test.native test/vylist_test.native test/value_checker_test.native test/util_test.native test/vyconf_config_test.native test/curly_parser_test.native test/session_test.native test/vytree_load_test.native -tag debug -tag tests’ terminated with error code 10”)
Makefile:7: recipe for target ‘build’ failed

Can you tell me how you have resolved this error?

Maybe you can try to add ‘-thread’ option after ocamlfind command in Makefile. For example:
ocamlfind opt -o $@ -thread …

I tried adding -thread but ended up having the same error.
no change.
Do you remember anything else you have done in order to resolve the error?
I am asking you because it is exactly the same error and after even doing multiple efforts I am not able to resolve it.