-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ubuntu 20.04 missing libffi 6 causing bundled python 3 to fail on ctypes import #16
Comments
I'm unsure of how to correctly handle this. We don't actually include Python. We include enough of Python to support nextpnr, which requires Python to support multiple clock domains. Unfortunately, Python appears to be very difficult to embed, and it looks like it's leaking into your environment somehow. I'm open to suggestions on how to fix this. |
I'm also not sure the correct way to handle this. I tried a few things:
Number 2 seems the cleanest but does make setting up the tool chain a bit more involved. It would require changes to toolchain-nextpnr-ice40 (adding the libffi deb) and this repo. Number 3 should only require changes to toolchain-nextpnr-ice40 but leaves the toolchain with a less-than complete python and could have unintended consequences. If you're happy with either option I can make the changes and pull requests. |
@xobs Rather than maintaining our own toolchain, maybe we should change the instructions to use the tools from https://github.com/open-tool-forge/fpga-toolchain? |
I do think @mithro has a good idea here. Does that package have the same issues for you, @braingram ? |
@xobs It looks like fpga-toolchain builds python against libffi 7 so it works on Ubuntu 20.04. I'm not if it'll work with 18.04 which may only have libffi 6 (from the repos): >>ldd fpga-toolchain/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007fffbbdf9000)
libffi.so.7 => /usr/lib/x86_64-linux-gnu/libffi.so.7 (0x00007f55f8cc1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f55f8cbb000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f55f8c98000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f55f8aa6000)
/lib64/ld-linux-x86-64.so.2 (0x00007f55f8d1b000) I was able to build the migen and litex portions of the workshop with fpga-toolchain. I did not test it with the hardware. dfu-util is included with fpga-toolchain but wishbone-tool is not. I'm not sure about other parts of the workshop. |
I had the same problem and resolved it via straight manual install of You can download one for your architecture on https://packages.ubuntu.com/bionic/libffi6 and then Generally, mixing packages from different releases is not a good idea. In some cases it works very well. A cleaner alternative would be to compile from source, so far it just works as is. |
I hit this issue too, and this worked for me. |
In #20, the inclusion of Python3 is removed. Instead, open-tool-forge/fpga-toolchain is included and the user is expected to have Python3 available on the system. I'd be glad to have some feedback. In the PR you will find links to the artifacts. |
From my reading of the build outputs, doesn't On Windows, they rename On Linux, they also include I do agree that it's a good idea to assume Linux users have Python installed, due to widely varying installations, ABIs, and path settings. I'm less certain about assuming Mac users have Python installed. |
@xobs, you are correct. The main point is that, because fpga-toolchain adds python privately, merging it with the one currently in this toolchain would produce lots of conflicts. Hence, I "decided" to drop the one from here in favour of the "private" one in fpga-toolchain (which comes in the "pack"), and move this discussion to I tested it on Windows 10 (MINGW64 from MSYS2), and there I did need to install Python3 for running LiteX examples. Note: that's a different Python install from the one used in CI. Nonetheless, both of them work as expected. This is to say that, even if Windows users don't have Python installed, all they need to do is download the regular zip/exe from https://www.python.org/, or use their preferred package manager (pacman, chocolatey, ninite...). Anyway, I would expect almost all users nowadays to have Python because of any other project/tool. |
Hmm, as @xobs says I'm using a very similar method to fomu-toolchain for embedding python for nextpnr. I deliberately didn't put the python executable in the path to try and avoid this sort of thing, (except on windows where I added it as Is the problem that python searches |
No, I think @edbordin is doing it correctly -- I had forgotten that I ended up shipping |
I installed fomu-toolchain-linux_x86_64-v1.5.6 on Ubuntu 20.04 which lacks libffi 6 (7 is the only package in the repos). Working through the workshop I encountered an error building blink.py in the migen section. The same error can be seen when trying to import ctypes with the python3 included in the toolchain.
Some other system information:
Also, I can successfully run the blink.py script with my system python.
The text was updated successfully, but these errors were encountered: