Skip to content
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

ncurses: make build ABI-compatible with version 5 #83

Closed
wants to merge 1 commit into from

Conversation

martinvonz
Copy link

I built Mercurial on Mac with PyOxidizer. I then ran hg commit -i and quit without changing anything. That resulted in a segfault. It seems that the issue is an ABI compatibility between the ncurses version compiled against (6.1 or 6.2, I don't remember which) and the version dynamically linked on macOS. On Big Sur, the ncurses version seems to be 5.4. Adding --with-abi-version=5 to the configure script fixed the problem for me.

I built Mercurial on Mac with PyOxidizer. I then ran `hg commit -i` and quit without changing anything. That resulted in a segfault. It seems that the issue is an ABI compatibility between the ncurses version compiled against (6.1 or 6.2, I don't remember which) and the version dynamically linked on macOS. On Big Sur, the ncurses  version seems to be 5.4. Adding `--with-abi-version=5` to the `configure` script fixed the problem for me.
@indygreg
Copy link
Owner

This patch surprises me because we are supposed to be building our own ncurses for macOS and not relying on the system library!

However, both /usr/lib/libedit.3.dylib and /usr/lib/libncurses.5.4.dylib are annotated as allowed libraries in the Rust validation code. They are likely listed because something is referencing them.

Either we should be linking against the system libraries and not building libedit/ncurses or we should be building these libraries and not linking against the system libraries. More investigation is needed.

@indygreg
Copy link
Owner

Ahh - I think the root cause is macOS linker arguments are referencing -lncurses instead of -lncursesw. I'd say this was an oversight from 102fb0d. However, that commit explicitly says we purposefully link against the system ncurses on macOS.

So I guess we have a choice: drop libedit/ncurses from our macOS builds or prevent linking against the system variants.

indygreg added a commit that referenced this pull request Jul 17, 2021
Our static-modules files link against the system ncurses. But
we were building a custom ncurses. This could lead to confusion where
our modern ncurses was "leaking" into build state / configuration,
leading to run-time crashes (see #83).

This commit drops building ncurses for macOS.

Because libedit and ncurses are closely related and we were also
linking against the system libedit, we drop building modern libedit
as well.
@indygreg
Copy link
Owner

I think 07a9f22 will fix this by removing the modern ncurses from the macOS build.

I'm open to using a modern ncurses and libedit on macOS. But since the system libraries were the intended versions in existing code, I decided to preserve that behavior for the time being.

@indygreg indygreg closed this Jul 17, 2021
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.

None yet

2 participants