Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: kernel_context_options_set_validation_interface #8

Open
ismaelsadeeq opened this issue Dec 20, 2024 · 3 comments
Open

Comments

@ismaelsadeeq
Copy link

ismaelsadeeq commented Dec 20, 2024

Running this wrapper on the current main branch top commit 67463f3cb367fea2509041f64b8d0f704cdc9c54 results in the following failure:

Traceback (most recent call last):
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/src/main.py", line 1, in <module>
    import pbk
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/.venv/lib/python3.10/site-packages/pbk/__init__.py", line 1, in <module>
    from pbk.block import Block, BlockHash, BlockIndex, BlockUndo
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/.venv/lib/python3.10/site-packages/pbk/block.py", line 4, in <module>
    import pbk.capi.bindings as k
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/.venv/lib/python3.10/site-packages/pbk/capi/__init__.py", line 1, in <module>
    from pbk.capi.base import KernelOpaquePtr, KernelPtr
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/.venv/lib/python3.10/site-packages/pbk/capi/base.py", line 3, in <module>
    import pbk.capi.bindings
  File "/home/abubakar-dev/py-bitcoinkernel/block_parser/.venv/lib/python3.10/site-packages/pbk/capi/bindings.py", line 527, in <module>
    kernel_context_options_set_validation_interface = BITCOINKERNEL_LIB.kernel_context_options_set_validation_interface
  File "/usr/lib/python3.10/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.10/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/local/lib/libbitcoinkernel.so: undefined symbol: kernel_context_options_set_validation_interface

After bisecting the code, I found that this failure does not occur in commit 59332f4
The issue seems to begin with commit 4103e2c

@stickies-v
Copy link
Owner

stickies-v commented Dec 20, 2024

This behaviour is loosely documented in the README:

[!WARNING] While libbitcoinkernel and py-bitcoinkernel are in very early and experimental phases of development, no version management is done, and you must install the libbitcoinkernel version that is shipped with this library in depend/bitcoin/.

You need to install the bitcoinkernel version that is shipped in depend/bitcoin/ (done automatically when installed with pip, if you remove the system-installed bitcoinkernel which I'm guessing you have)

Perhaps it'd be useful to add some extra error handling when importing pbk.capi.bindings fails to report to the user that they probably have the wrong bitcoinkernel version installed.

@ismaelsadeeq
Copy link
Author

done automatically when installed with pip

The issue is when you have installed this library previously and are now updating, the auto installation will detect the previously installed libbitcoinkernel library and then won't install the one that comes with the library.

Perhaps it'd be useful to add some extra error handling when importing pbk.capi.bindings fails to report to the user that they probably have the wrong bitcoinkernel version installed.

Prior to that at least recommending users to compile manually when updating the library is a good idea?
Something like ismaelsadeeq@130a0a0

@ismaelsadeeq
Copy link
Author

I see that https://github.com/TheCharlatan/rust-bitcoinkernel seems to recompile aggressively after any update. While this can be redundant when there are no changes to the libbitcoinkernel library, but IMO it's better than the alternatives:

  1. Manually compiling
  2. Skipping compilation altogether (like py-bitcoinkernel does), which can lead to failures

Of course the best solution is recompiling only when the version on system is not the same with the one that comes with the library :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants