You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it would be useful if the system include path is included when compiling for a compatible target e.g. compiling for x86_64-linux-gnu.2.17 when running on a x86_64-linux.4.19...6.5.7-gnu.2.39 machine.
the people working on lite-xl ran into this while trying out zig cc as an alternative to compiling on an old CentOS machine specifically so that they can build binaries that run on older distros.
lite-xl uses meson (which can handle zig cc and detects zld since 1.5.0)
meson deals with dependencies similar to zig, it calls pkg-config and if it can't find anything it will just pick something with the right enough name.
pkg-config omits system paths such as /usr/include from being included directly
this results in headers that are directly in the system include directory from not being able to be included such as wayland-util.h which is required by any code generated by wayland-scanner.
pkg-config does have a flag which makes it add system paths PKG_CONFIG_ALLOW_SYSTEM_CFLAGS but doing so will put /usr/include ahead of the zig included C headers, resulting in linking errors down the line because some functions are macros to others in newer glibc verisons (e.g. fcntl -> fcntl64 in glibc 2.28)
the current workaround is to add the cflag -idirafter /usr/include, which is essentially what I am advocating for here.
In the zulip thread there was some concern about ABI sensitive libc types being exchanged however this issue also affects projects that are statically compiled and in some cases its even commonplace, most notably SDL where it uses the header of whatever library version at compile time and then dynamically loads the dependency at runtime, regardless of version.
it would be useful if the system include path is included when compiling for a compatible target e.g. compiling for
x86_64-linux-gnu.2.17
when running on ax86_64-linux.4.19...6.5.7-gnu.2.39
machine.the people working on lite-xl ran into this while trying out
zig cc
as an alternative to compiling on an old CentOS machine specifically so that they can build binaries that run on older distros.lite-xl uses meson (which can handle zig cc and detects zld since 1.5.0)
meson deals with dependencies similar to zig, it calls pkg-config and if it can't find anything it will just pick something with the right enough name.
pkg-config omits system paths such as /usr/include from being included directly
this results in headers that are directly in the system include directory from not being able to be included such as
wayland-util.h
which is required by any code generated bywayland-scanner
.pkg-config does have a flag which makes it add system paths
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
but doing so will put /usr/include ahead of the zig included C headers, resulting in linking errors down the line because some functions are macros to others in newer glibc verisons (e.g. fcntl -> fcntl64 in glibc 2.28)the current workaround is to add the cflag
-idirafter /usr/include
, which is essentially what I am advocating for here.In the zulip thread there was some concern about ABI sensitive libc types being exchanged however this issue also affects projects that are statically compiled and in some cases its even commonplace, most notably SDL where it uses the header of whatever library version at compile time and then dynamically loads the dependency at runtime, regardless of version.
zulip thread
https://zsf.zulipchat.com/#narrow/channel/454360-compiler/topic/including.20system.20include.20directory.20on.20native.20compatible.20targ
The text was updated successfully, but these errors were encountered: