Skip to content

build: do not define _POSIX_C_SOURCE on NetBSD#4181

Merged
amaanq merged 4 commits intotree-sitter:masterfrom
0-wiz-0:master
Feb 2, 2025
Merged

build: do not define _POSIX_C_SOURCE on NetBSD#4181
amaanq merged 4 commits intotree-sitter:masterfrom
0-wiz-0:master

Conversation

@0-wiz-0
Copy link
Contributor

@0-wiz-0 0-wiz-0 commented Feb 2, 2025

It leads to missing symbols, see #4180.

@clason
Copy link
Contributor

clason commented Feb 2, 2025

Unfortunately, this is not the only build system in this repo... (far from it).

So modifying endian.h would be preferred.

@ObserverOfTime
Copy link
Member

ObserverOfTime commented Feb 2, 2025

Can we move both defines to endian.h?

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 2, 2025

Can we move both defines to endian.h?

I'd really appreciate that since when I just add the define in endian.h it still fails when building query.c and I haven't tracked down the inclusion chain yet (where endian.h seems to be included some other way, perhaps via time.h or another system header).

@amaanq
Copy link
Member

amaanq commented Feb 2, 2025

Probably because by default, the Makefile compiles each C file individually, so you'd have to define this in every source file that needs it. Would adding #undef _POSIX_C_SOURCE work for NetBSD?

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 2, 2025

I pushed a different version that I think follows your suggestions. I think it's ugly, but it works.

@amaanq
Copy link
Member

amaanq commented Feb 2, 2025

Yeah, that's a little ugly but I guess it's fine. I'm a little confused though, because lexer.c also includes endian.h (through unicode.h) - does the library build just fine on NetBSD as this PR is? Also, if you could add a short comment above the NetBSD undef in query.c explaining why that's there, that'd be great

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 2, 2025

I've added a comment about the #undef.
Yes, the git head of my fork builds without warnings on NetBSD.
lexer.c has fewer includes than query.c, I guess that's the reason.

@amaanq amaanq merged commit 14647b2 into tree-sitter:master Feb 2, 2025
13 checks passed
@clason
Copy link
Contributor

clason commented Feb 3, 2025

Might have wanted to squash that...

@clason clason added the ci:backport release-0.25 Backport label label Feb 9, 2025
@tree-sitter-ci-bot
Copy link

Successfully created backport PR for release-0.25:

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants