Skip to content

musl: fix cross building#2138

Merged
metux merged 2 commits intoX11Libre:masterfrom
ComputerCraftr:musl-sysroot-build
Mar 25, 2026
Merged

musl: fix cross building#2138
metux merged 2 commits intoX11Libre:masterfrom
ComputerCraftr:musl-sysroot-build

Conversation

@ComputerCraftr
Copy link
Copy Markdown
Contributor

This is a small step towards #1979 to get a musl sysroot building with clang. I tested the build works with xfbdev enabled too.

This should stop a lot of warning spam on any clang install, not just macOS/FreeBSD

Signed-off-by: John Studnicka <contact@zentec.dev>
This should make the busfault structs happy on both sides of the ifdef

Signed-off-by: John Studnicka <contact@zentec.dev>
@metux metux requested a review from a team March 16, 2026 12:03
@stefan11111
Copy link
Copy Markdown
Contributor

@b-aaz @cepelinas9000 ping

Comment thread include/os.h

#ifndef _X_ATTRIBUTE_VPRINTF
# if defined(__GNUC__) && (__GNUC__ >= 2) && (!defined(__APPLE__)) && (!defined(__FreeBSD__))
# if defined(__GNUC__) && (__GNUC__ >= 2) && !defined(__clang__)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we need to keep the apple and bsd checks here?
Does clang not support printf-like attributes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the else branch, this directive defines _X_ATTRIBUTE_VPRINTF to be the same as the _X_ATTRIBUTE_PRINTF macro which uses generic __printf__ format attribute instead of gnu_printf.

Right now, the attribute type checking does not work at all on Linux clang because it's just throwing up a bunch of warnings saying "I don't know what gnu_printf means." I tried to find if gnu_printf has some special behavior on GCC, but it looks like it does the same thing as regular printf anyways.

If we wanted to do a future cleanup on this, I would probably delete _X_ATTRIBUTE_VPRINTF altogether.

See here: https://github.com/X11Libre/mirror.fdo.xorgproto/blob/master/include/X11/Xfuncproto.h#L164

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also, there is a GCC port for FreeBSD, so this logic which gates gnu_printf behind the OS is wrong. I think it needs to check the compiler directly instead of guessing from the OS.

@ComputerCraftr
Copy link
Copy Markdown
Contributor Author

Is there anything I can do to keep this moving forward?

@stefan11111
Copy link
Copy Markdown
Contributor

LGTM, but I want to get one of the bsd users' thoughts on this.
@cepelinas9000 @b-aaz @metux ping

@cepelinas9000
Copy link
Copy Markdown
Contributor

It looks LGTM for me too, just I'm causal FreeBSD user (compiled in FreeBSD xserver and didn't throw errors)

@cepelinas9000 cepelinas9000 self-requested a review March 24, 2026 20:52
@stefan11111
Copy link
Copy Markdown
Contributor

I wonder if we could do away with gnu_printf entirely, and just use printf?

@metux metux merged commit cf7c358 into X11Libre:master Mar 25, 2026
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