-
Notifications
You must be signed in to change notification settings - Fork 481
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
Python symbols are resolved at link-time instead of run-time #3892
Comments
I think For background, we use |
That I guess this bug report technically isn't a cocotb issue, but I'm still curious to know if other users are hitting the same issue or if there's some magic in the cocotb makefiles that I haven't seen that addresses this. |
This is the first I'm hearing about it. We can keep this issue open to potentially gather other users having issues. Have you set up |
Yep.
and that dir is |
And why distutils doesn't add Perhaps this is something cocotb can do. We would need to compute the libpython name (includes the Python version) and add that to the |
I've noticed that newer Python versions do not link extensions against
libpython. While this should make extensions a bit more flexible (ideally,
not strictly tied to a single Python version), not doing so also introduces
some challenges.
One approach you could take with Verilator is to explicitly link the
simulation-image binary against libpython. I suppose the good news is that
cocotb-config makes it easy to identify libpython.
On a related note, is there any interest in enhancing the Verilator runtime
'main' to support dynamically loading a PLI/VPI library? The goal would be
to enable cocotb to be directly loaded by a simulation image produced by
`verilator --binary`, and remove the need for cocotb to develop and
maintain verilator.cpp.
…-Matthew
On Thu, May 16, 2024 at 5:07 PM Kaleb Barrett ***@***.***> wrote:
And why distutils doesn't add -lpython itself considering we are using
its Extension class.
Perhaps this is something cocotb can do. We would need to compute the
libpython name (includes the Python version) and add that to the libraries
argument of Extension for those libraries that depend upon Python.
—
Reply to this email directly, view it on GitHub
<#3892 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKHLBPA24EECDYMLJZG6LLZCVC33AVCNFSM6AAAAABHTVQU6CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJWGQYDEOBZGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hmm.. shouldn't we simply add a |
@olofk I don't think anyone is manually building cocotb sources, so I don't understand the point of that. There might be an assumption here that wasn't communicated. What are you building where it's failing to link? I'm thinking you're talking about using |
Ah no. I'm using a pip-installed 1.8.1 This is for having Edalize launch simulations with cocotb. Basically doing https://docs.cocotb.org/en/stable/custom_flows.html#verilator . But my problem is that these instructions don't work for me unless I ignore unresolved symbols or explicitly pass -lpython3.11 in the LDFLAGS. I'm attaching an example build directory that was created by fusesoc run my FuseSoC+cocotb example. In the attached archive I have added The idea with adding a |
Ah. I thought it was weird you were linking all those libraries in your project. The libraries were rearchitected to avoid this problem, but the custom flows docs weren't updated. See what's actually linked here. |
Yes! That works just fine. So the problem was actually overlinking rather than underlinking :) PR for docs here #3901 Closing this now. |
I'm adding cocotb support for the verilator backend in Edalize, using the excellent https://docs.cocotb.org/en/stable/custom_flows.html guide.
With this, however, I'm hitting issues of unresolved symbols during link-time, like:
As I understand it, the cocotb libs are loaded at runtime, so we shouldn't need to bother checking this at link-time. Adding
-Wl,--unresolved-symbols=ignore-all
to LDFLAGS seems to get around this, but I'm not sure it's the best solution. I guess there is some common way to do this for projects that load stuff at runtime, but it's a bit outside of my wheelhouse.The text was updated successfully, but these errors were encountered: