Skip to content

Various fixes - #1

Open
angerman wants to merge 57 commits into
masterfrom
iserv-syms
Open

Various fixes#1
angerman wants to merge 57 commits into
masterfrom
iserv-syms

Conversation

@angerman

Copy link
Copy Markdown

This restores most of the iserv functionality. It also crucially adds support for iserv-symbols. This requires a GHC patch, and will only work with haskell.nix.

angerman and others added 8 commits November 29, 2023 13:50
(cherry picked from commit 650ebfc2363ced3e102b7a32f2266655e31c4593)
(cherry picked from commit 4c58525d98c1b09b41a9dcba02e616987a8fea2e)
(cherry picked from commit 50d0abb3317ac439a4e7495b185a64af9b7b9300)
(cherry picked from commit 5a545fd94dc19cb1ec1853ecb9bd313e56f34516)
(cherry picked from commit b3a865acd224e2773e3f16caceb83ad9b4100fc3)
(cherry picked from commit 9151db2a9a61d7f5fe52ff8836f18bbd0fd8933c)
(cherry picked from commit 43a979272d9addc29fbffc2e8542c5d96e993d73)
@angerman angerman self-assigned this Nov 29, 2023
@wolfgangwalther

Copy link
Copy Markdown

This requires a GHC patch, and will only work with haskell.nix.

Is this still true? It looks like @alexfmpe makes use of this PR in NixOS/nixpkgs#445672, but I don't see any additional GHC patches added there.

What's missing to actually merge this?

@alexfmpe

Copy link
Copy Markdown

I think that refers to iserv-syms.patch and that it was upstreamed on https://gitlab.haskell.org/ghc/ghc/-/merge_requests/13129

Note it's not applied for 9.12
https://github.com/input-output-hk/haskell.nix/blob/f68833bd43441ae136fa3b65b4cdcd93baf22f9e/overlays/bootstrap.nix#L237

Not sure about the other part

will only work with haskell.nix.

hamishmack and others added 8 commits October 25, 2025 17:46
Fix iserv-proxy build on windows
TCP networking inside nix-linux-builder VMs is unreliable, causing
iserv-proxy to hang or fail when connecting to the interpreter via
sockets. This adds two new modes:

- Interpreter --stdio: reads/writes protocol data on stdin/stdout
  instead of TCP. Uses hDuplicate/hDuplicateTo to redirect the
  Haskell stdout handle to stderr, preventing library code from
  corrupting the data channel.

- Proxy --pipe <cmd>: spawns the interpreter as a subprocess and
  communicates via its stdin/stdout pipes, bypassing TCP entirely.

Both modes are opt-in; the original TCP mode is unchanged.

Also redirects all diagnostic output (trace, hook messages) to stderr
in both old and new code paths.
The dynamic linker fails to load this library when it sees
unresolved references via the `SYM(...)` table.  Provide
`MISSING_FUN` stubs for the symbols our current armv7a NDK's
bionic / libc++ don't ship; they're never expected to be
invoked at runtime — if any actually does, the stub exits with
a diagnostic.

Symbols covered: posix_spawn{,attr}_{init,destroy,setflags,
setsigdefault,addopen,adddup2,addclose,addchdir_np},
__cxa_guard_{abort,acquire,release}, __cxa_thread_finalize,
__libc_{stdio_cleanup,shared_globals}, getentropy, statx,
__fsetxattr, __arm_fadvise64_64.
A second pass surfaced this one too — same rationale as the
previous commit.
…_assert

mingw-w64 14.0.0 added an `_assert` member to `libmingwex.a` (13.0.0 had
none, so `_assert` came from the UCRT import library).  That member calls
`fileno` and imports `__msvcrt_assert`.  wine's ucrtbase implements both
but only exports the underscore spellings, so `GetProcAddress` returns
NULL for the aliases.  GHC's runtime linker loads every member of an
archive, so the unresolvable `fileno` fails all of `libmingwex.a`, and
template haskell then dies with

  libmingwex.a: unknown symbol `fileno'
  HSghc-bignum-...-inplace.o: unknown symbol `_assert'
  <no location info>: error: unable to load unit `ghc-bignum-1.3'

`strncasecmp` is the same story one level up, via unix-time's object.

The extra symbol table is consulted before objects and DLLs and is in
place before anything is loaded, so it is the right place for these: a
`-l` archive is loaded only after `initLoaderState` has already resolved
the command-line packages.

`__imp___msvcrt_assert` gets an indirection entry (the shape of GHC's
Note [_iob_func symbol]) pointing at a local implementation rather than
at `_assert`, which is the caller here and would recurse.

Verified on x86_64-linux with `--builders ""`: haskell.nix's
ucrt64 th-dlls-minimal (all six variants) against GHC 9.6.7, 9.8.4,
9.10.3, 9.12.4 and 9.14.1, plus ucrt64 th-dlls, all of which the
mingw-w64 14 bump had broken.

Claude-Session: https://claude.ai/code/session_015iMn9nFmfb5DPqqW5a12co
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.

4 participants