Skip to content

tools/jtag: libftdi from $T27_LIBFTDI or the platform default, so B2 reads on Linux (Closes #7927) - #8842

Open
dmitrii-f-t27 wants to merge 2 commits into
gHashTag:masterfrom
dmitrii-f-t27:fix/jtag-libftdi-env
Open

dmitrii-f-t27 wants to merge 2 commits into
gHashTag:masterfrom
dmitrii-f-t27:fix/jtag-libftdi-env

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Closes #7927

Description

tools/jtag/mpsse_jtag.py loaded libftdi from a fixed Homebrew path, so stage B2 of t27c silicon (read_verdict.py) failed on Linux with OSError: /opt/homebrew/lib/libftdi1.2.dylib: cannot open shared object file. Die C of R3-3 passed only with a symlink at that path inside the container (#7906, "Caveats").

This is step 2 of #7927. Step 1 was #7928 (merged): the owner-approved exception for this file in tools/policy/foreign-exceptions.txt.

Changes

tools/jtag/mpsse_jtag.py, 3 lines in, 3 lines out:

import ctypes, ctypes.util, os, sys, time
# libftdi1: $T27_LIBFTDI if set; else Homebrew on macOS; else the loader search, so B2 reads on Linux (#7927).
LIB = os.environ.get("T27_LIBFTDI") or ("/opt/homebrew/lib/libftdi1.2.dylib" if sys.platform == "darwin" else ctypes.util.find_library("ftdi1") or "libftdi1.so.2")
  • macOS keeps the existing path, so the current benches do not change.
  • The issue's version spans 4 lines. It is folded to replace exactly the 3 lines it removes (the blank line becomes the comment), because the foreign-line rule (check_budget, owner rule 2026-10-09) does not allow a foreign file to grow.

No .t27 for this change. There is no Python back end, so no spec can generate this file. The port specs/port/tools/jtag/mpsse_jtag.t27 is a stub. The route is the owner-approved exception from #7928. No spec, seal or conformance vector changes.

Testing

On the head commit (macOS 26, Python 3.14.3, libftdi 1.5_2 from Homebrew):

  • Only-t27 gate (gen/c/policy/own_language.c, --ci, exceptions read from the base): exit 0.
  • Foreign-line budget (check_budget from the base): exit 0 (3 3 tools/jtag/mpsse_jtag.py).
  • python3 -c "import sys; sys.path.insert(0,'tools/jtag'); import mpsse_jtag": exit 0, LIB = /opt/homebrew/lib/libftdi1.2.dylib, the same as on master.
  • T27_LIBFTDI=/opt/homebrew/Cellar/libftdi/1.5_2/lib/libftdi1.2.dylib: the module loads that exact path.
  • T27_LIBFTDI=/nonexistent/...: OSError that names the given path, so a bad override is reported, not hidden.
  • py_compile on mpsse_jtag.py, read_verdict.py, read_user1.py, link_relay.py: OK.
  • Path-resolution check with ctypes.CDLL stubbed (sys.platform, T27_LIBFTDI and find_library varied over 8 cases: darwin, linux, env set, env empty, find_library None): 8/8 PASS on this branch. Negative control on master's file: 2/8 (only the two darwin defaults pass).

Not verified

  • A real import on Linux without the symlink. Docker on this machine could not start a container (its storage is read-only), so the Linux cases above are covered only by the stubbed resolution check.
  • t27c silicon B2 on a Linux host with a board.

Review Notes

tools/policy/foreign-exceptions.txt:449 still says "owner approval pending". That is out of date since #7928 got owner-approved-foreign. It is not changed here: any edit to that file needs the label again. It can be updated in the next PR that has the label.

Dmitrii Fedorov (@dmitrii-f-t27)

…reads on Linux (Closes gHashTag#7927)

mpsse_jtag.py loaded libftdi from the fixed Homebrew path, so stage B2 of
t27c silicon (read_verdict.py) failed on Linux without a symlink (gHashTag#7906).
LIB is now $T27_LIBFTDI when set; else /opt/homebrew/lib/libftdi1.2.dylib
on macOS (unchanged); else ctypes.util.find_library("ftdi1") or
libftdi1.so.2. 3 lines in, 3 lines out: the file is listed in
tools/policy/foreign-exceptions.txt (gHashTag#7928) and foreign code does not grow.

Closes gHashTag#7927
@dmitrii-f-t27

dmitrii-f-t27 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated 2026-10-11. Head 0375bb7ee55dd62370a5383ebb90e397a79a91f6 merges master 5e5493cab into this branch, so CI now runs against the current master. The PR diff is still one file, tools/jtag/mpsse_jtag.py.

The required contexts (validate, check-linked-issue, parse-ratchet, own-language) pass. No conflicts with master.

Three checks are red. Each one fails the same way on master:

Check This PR Master, same failure
Corpus ratchet run 38147806957: types ratchet, Entry, Inputs, SkillMeta NEW conflict 5e5493cab run 38146939229: the same 3 names
coverage run 38147806832: queen_QueenHolds.json gen-drift (gen_hash_rust) 5e5493cab run 38146939200: the same seal
cli-tri run 38147806776: tri census pin --gate, quiet 185 to 188, shell 305 to 306 push to master a31427373 run 38145387223: the same two census moves

The earlier reds on head 868a3ffb5 (duplicate-bodies, Verilog widths) are green on this head.

Nothing to fix in this PR. These failures come from master.

Dmitrii Fedorov (@dmitrii-f-t27)

This was referenced Oct 10, 2026
This was referenced Oct 13, 2026

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

tools/jtag/mpsse_jtag.py: take the libftdi path from the environment, so B2 reads on Linux

1 participant