-
Notifications
You must be signed in to change notification settings - Fork 355
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
Unable to compile a statically linked wheel #1033
Comments
We build statically linked wheels for release on pypi. We use the pip wheel . --no-deps
auditwheel repair qiskit_aer-*.whl The auditwheel repair command there vendors the shared libs into the binary. Although it may only work if the system has a version of system libs (like glibc) that is compatible with a manylinux python packaging spec (which is the other thing cibuildwheel does for us, it runs everything in the manylinux docker images). |
Thanks a lot for the information! I went ahead and tried it out and as slightly anticipated by your comment about
From reading a little bit through |
Under the hood we use manylinux2010 to build the linux wheels. Not sure if you can in your system, but maybe you can follow the workflow @mtreinish described, using the |
On this compute server where I would like to compile Aer I do not have access to docker. And I would like to avoid having to compile this on a different system just to push the wheel onto the server every time I want to update it. Is there no way of statically linking the libraries into this specific wheel? It doesn't need to support any platform but just the compute nodes which should be identical to the login node (but apparantly missing the libraries because otherwise the dynamic linking should work...) |
Can you compile with static_linking enabled (but forget about |
Here is the ouptut of what you described:
|
So I took a closer look at |
ok, let us know. In any case, not sure if the problem comes from |
This comment has been minimized.
This comment has been minimized.
Actually scratch the above. I did not notice that
|
When I compile with
However, I don't understand why |
And now for a final test with
Come to think of it, now that I see this, I probably understand that in the previous case those libraries were not included since the static linking directly incorporated these libraries into the wrapper |
Okay I think I found the solution. The same happened to another user of I will compile |
I'm actually going to reopen this. I think this is a potentially common use case and we should have something in our CONTRIBUTING.md about building a statically linked wheel from master. |
As discussed in Qiskit#1033 we should document how to compile a static wheel of Qiskit Aer. This commit adds such documentation to `CONTRIBUTING.md`. I have attempted to make the explanation easy to follow but also easily searchable for potential pitfalls (thus, the inclusion of possible error messages). Hopefully, this will help with the visibility of this section and guide users through the process more easily. Closes Qiskit#1033
@mtreinish I opened a PR with to update |
As discussed in Qiskit#1033 we should document how to compile a static wheel of Qiskit Aer. This commit adds such documentation to `CONTRIBUTING.md`. I have attempted to make the explanation easy to follow but also easily searchable for potential pitfalls (thus, the inclusion of possible error messages). Hopefully, this will help with the visibility of this section and guide users through the process more easily. Closes Qiskit#1033
As discussed in #1033 we should document how to compile a static wheel of Qiskit Aer. This commit adds such documentation to `CONTRIBUTING.md`. I have attempted to make the explanation easy to follow but also easily searchable for potential pitfalls (thus, the inclusion of possible error messages). Hopefully, this will help with the visibility of this section and guide users through the process more easily.
Please apologize the length of this bug report in advance, but I am trying to provide as much information as possible.
Informations
master
3.6.9
uname -a
provides:To provide some context: I am trying to compile Aer from source on a compute server to allow multiple users to access the same master-branch installation from a centrally managed virtualenv. While doing so I ran into the problem of not being able to produce a correctly statically linked wheel.
Specifically this means that I log in onto a login node, create a virtualenv there and expect all computations on the respective compute nodes to work normally.
I am using the following Python script for testing:
and the following bash script for testing the execution on the compute nodes:
What is the current behavior?
In order to explain the problem at hand I will step through a number of different scenarios and explain the results which I have achieved with each:
A stable installation using
pip install qiskit-terra qiskit-aer
Starting from a clean virtualenv and running the above pip installation command everything works fine.
On the login node I obtain:
And on the compute nodes:
A master installation using
python setup.py bdist_wheel
When trying to compile Aer manually from
master
everything works as expected on the login node (i.e. same as above) but on the compute node I obtain the following error:This was to be expected as the first line of the bash script (
locate libopenblas.so.0
) does not return anything which shows that OpenBLAS cannot be found on the compute nodes (while it is available normally on the login node).Having talked to the system administrator, we agreed that it would be best if, thus, we can compile Aer with static linking (as this appears to work with the
stable
installation usingpip install
which ships a Python wheel bundled withlibopenblas
).Static linking:
python setup.py bdist_wheel -- -DSTATIC_LINKING=True
This attempt causes even the installation on the login node to break with the following error:
Static linking with
FindBLAS.cmake.fix-static-linking
I then found out about this patch: https://github.com/Qiskit/qiskit-aer/blob/master/cmake/FindBLAS.cmake.fix-static-linking
But after applying that and trying the same
-DSTATIC_LINKING=True
compilation as above, I still obtain the same error.Steps to reproduce the problem
The following summarizes the steps necessary to reproduce this issue. However, your mileage may vary as I have tried to reproduce this on my Fedora laptop where I am unable to do so. Both of the last two steps do not result in the problem but I am not sure how to verify that this is because the static linking was successful or whether it falls back to dynamic linking.
The Fedora laptop specs are:
What is the expected behavior?
I would expect to be able to compile a statically linked Python wheel of Aer
Suggested solutions
I am at a loss to be honest, which is why I came here 🙂
The text was updated successfully, but these errors were encountered: