Skip to content

lsp: Fix build without gio-unix-2.0 headers in gio-2.0 include path - #1617

Open
techee wants to merge 1 commit into
geany:masterfrom
techee:lsp_gio_unix
Open

techee wants to merge 1 commit into
geany:masterfrom
techee:lsp_gio_unix

Conversation

@techee

@techee techee commented Oct 15, 2026

Copy link
Copy Markdown
Member

The GUnixInputStream and GUnixOutputStream types are provided by the gio-unix-2.0 pkg-config module, whose headers are not necessarily part of the gio-2.0 include path (e.g. on Nix or macOS). The build failed on such systems because <gio/gunixinputstream.h> and <gio/gunixoutputstream.h> could not be found.

Check for gio-unix-2.0 at configure time and only use the system implementation when it is available, falling back to the plugin's own Unix stream implementation otherwise.

Written by Frank using AI (but looks good at least to someone who doesn't really know autotools).

@b4n b4n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably works, and autotools part look OK (maybe it could use PKG_HAVE_DEFINE_WITH_MODULES but that might be fairly recent).

Otherwise, see inline comments.

Comment thread lsp/src/lsp-server.c Outdated
#include <jsonrpc-glib.h>

#ifdef G_OS_UNIX
#if defined(G_OS_UNIX) && defined(HAVE_GIO_UNIX)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is redundant, is it not?

Suggested change
#if defined(G_OS_UNIX) && defined(HAVE_GIO_UNIX)
#if defined(HAVE_GIO_UNIX)

Comment thread lsp/src/lsp-server.c Outdated
}

#ifdef G_OS_UNIX
#if defined(G_OS_UNIX) && defined(HAVE_GIO_UNIX)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Suggested change
#if defined(G_OS_UNIX) && defined(HAVE_GIO_UNIX)
#if defined(HAVE_GIO_UNIX)

Comment thread build/lsp.m4 Outdated

dnl gio-2.0 doesn't necessarily ship the unix-specific headers
dnl (GUnixInputStream/GUnixOutputStream) in its include path; on some
dnl setups (e.g. nix, macOS) they live in the separate gio-unix-2.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to merely depend on gio-unix-2.0 on Unices?

Comment thread build/lsp.m4 Outdated
Comment on lines +31 to +34
dnl gio-2.0 doesn't necessarily ship the unix-specific headers
dnl (GUnixInputStream/GUnixOutputStream) in its include path; on some
dnl setups (e.g. nix, macOS) they live in the separate gio-unix-2.0
dnl include directory. Use the plugin's own implementation as fallback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is a bit over-the top. Also, the part "Use the plugin's own implementation as fallback." sounds kind of irrelevant at this level, is it not?

The GUnixInputStream and GUnixOutputStream types are provided by the
gio-unix-2.0 pkg-config module, whose headers are not necessarily part of
the gio-2.0 include path (e.g. on Nix or macOS). The build failed on such
systems because <gio/gunixinputstream.h> and <gio/gunixoutputstream.h>
could not be found.

Require gio-unix-2.0 on non-Windows hosts and use its compiler and linker
flags when building the plugin.

Co-authored-by: Frank Lanitz <frank@frank.uvena.de>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@techee

techee commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Thanks @b4n - nice to have a real human who understands autotools ;-).

I confess, I fed your suggestions to Claude Opus (anyone and anything knows autotools better than me), mainly the

any reason not to merely depend on gio-unix-2.0 on Unices?

comment.

I've re-pushed the result. Does it look good to you? Is the non-windowsness check correct? Is this what you had in mind?

@b4n

b4n commented Oct 15, 2026

Copy link
Copy Markdown
Member

I've re-pushed the result. Does it look good to you? […] Is this what you had in mind?

Yes (but the PR title is wrong now, yet the commit message is OK)

Is the non-windowsness check correct?

That I'm not 100% sure, but that's what we do for Geany, so I guess that's at least good enough. Maybe MSYS2 doesn't have host ~= mingw, but I couldn't tell.

@techee techee changed the title lsp: Fix build without gio-unix-2.0 headers lsp: Fix build without gio-unix-2.0 headers in gio-2.0 include path Oct 15, 2026
@techee

techee commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Yes (but the PR title is wrong now, yet the commit message is OK)

I've changed the title to match the commit message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants