When I tried to run the interface_ipc.py
functional test it failed with the error:
02025-09-17T08:33:50.642653Z TestFramework (INFO): PRNG seed is: 5837581670543711780
12025-09-17T08:33:50.643144Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_qg32uhlp
2terminate called after throwing an instance of 'kj::ExceptionImpl'
3 what(): mp/proxy.capnp:0: failed: Duplicate ID [@0xcc316e3f71a040fb](/bitcoin-bitcoin/contributor/0xcc316e3f71a040fb/).
4Aborted (core dumped)
After further investigating the issue I found that when I have the libmultiprocess
library installed system wide this test is failing, and removing the library from the system will make the test run as normal.
The main reason for this is the load_capnp_modules
function, which imports certain files and libraries. Here is the breakdown for the issue:
- If you have already installed
capnp
globally on your system. The function will detect it and add the whole path of the/include
directory of your system. Which contains all other libraries of your system includingcapnp
andmp
(if installed system-wide) library.
- This line of code
mp_dir = src_dir / "ipc" / "libmultiprocess" / "include"
includes the path oflibmultiprocess
directory inside the Bitcoin source tree. - Now, when the
capnp.load()
function parses the imports, it will see multiple declarations of the same file. The first implementation was included from the/include
path (as this is also the default path for thelibmultiprocess
library when you install system-wide) and secondly from the Bitcoin internal source tree.
How to reproduce
To reproduce the error you must have capnp
and libmultiprocess
installed system wide.
Possible Solution
One possible solution is to track when we have libmultiprocess
installed system-wide or not. If it’s installed system-wide, then don’t add the one from the Bitcoin source tree.