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

Incorrect usage of an internal Glibc header (sys/cdefs.h) #94

Open
xplshn opened this issue Apr 11, 2024 · 2 comments
Open

Incorrect usage of an internal Glibc header (sys/cdefs.h) #94

xplshn opened this issue Apr 11, 2024 · 2 comments

Comments

@xplshn
Copy link

xplshn commented Apr 11, 2024

/usr/include/sys/cdefs.h:4:2: warning: usage of non-standard #include <sys/cdefs.h> is deprecated [-W#warnings]
    4 | #warning usage of non-standard #include <sys/cdefs.h> is deprecated

Developers like to wrongly include sys/cdefs.h to use the _*_DECLS macros. This is a bug and the correct way to do it is to use:

#ifdef __cplusplus
extern "C" {
#endif

Instead of:

#ifdef __cplusplus
}
#endif

And instead of _END_DECLS

https://wiki.gentoo.org/wiki/Musl_porting_notes

This causes problems on other OSes, like Illumos based ones, such as OpenIndiana, and also when */Linux based distros that use Musl, uClibc, Bionic libc (Android libc) or anything other than glibc try to compile libxo

@philshafer
Copy link

Not sure what the problem here is, given that I don't include cdefs.h and the only place cplusplus is referenced is in xo_config.h.in::

% egrep 'cdefs|cplusplus' /.[hc]*
libxo/xo_config.h.in:#ifndef __cplusplus
libxo/xo_config.h.in~:#ifndef __cplusplus

Could you please give me some additional information? FWIW libxo compiles for FreeBSD, which is non-glibc based. Also for macos (clang).

Thanks,
Phil

@xplshn
Copy link
Author

xplshn commented Jul 2, 2024

The problem is that it won't compile in Musl, due to GETTEXT, the Chimera Linux OS has patched LIBXO to work on Musl-based Linuxes. They've also added support for BMAKE, tho that's not necessary.

--- a/configure
+++ b/configure
@@ -14375,11 +14375,11 @@ if test "$GETTEXT_ENABLE" != "no"; then
 printf %s "checking gettext in ${GETTEXT_PREFIX}... " >&6; }
 
   _save_cflags="$CFLAGS"
-  CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
+  CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <libintl.h>
-             int main() {char *cp = dgettext(NULL, "xx"); return 0; }
+             int main() {char *cp = dgettext(0, "xx"); return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
@@ -14401,11 +14401,11 @@ printf "%s\n" "$HAVE_GETTEXT" >&6; }
 printf %s "checking gettext in ${GETTEXT_PREFIX}... " >&6; }
 
       _save_cflags="$CFLAGS"
-      CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
+      CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror"
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <libintl.h>
-                 int main() {char *cp = dgettext(NULL, "xx"); return 0; }
+                 int main() {char *cp = dgettext(0, "xx"); return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
@@ -14428,11 +14428,11 @@ printf "%s\n" "$HAVE_GETTEXT" >&6; }
 printf %s "checking gettext in ${GETTEXT_PREFIX}... " >&6; }
 
       _save_cflags="$CFLAGS"
-      CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror -lintl"
+      CFLAGS="$CFLAGS -I${GETTEXT_PREFIX}/include -L${GETTEXT_PREFIX}/lib -Werror"
       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <libintl.h>
-                 int main() {char *cp = dgettext(NULL, "xx"); return 0; }
+                 int main() {char *cp = dgettext(0, "xx"); return 0; }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"
 then :
@@ -14455,7 +14455,7 @@ if test "$HAVE_GETTEXT" = "yes"; then
 printf "%s\n" "#define HAVE_GETTEXT 1" >>confdefs.h
 
     GETTEXT_CFLAGS="-I${GETTEXT_PREFIX}/include"
-    GETTEXT_LIBS="-L${GETTEXT_PREFIX}/lib -lintl"
+    GETTEXT_LIBS="-L${GETTEXT_PREFIX}/lib"
 else
     GETTEXT_PREFIX=none
     GETTEXT_CFLAGS=

https://github.com/chimera-linux/cports/tree/master/main/libxo/patches

Regards,
Xplshn

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

No branches or pull requests

2 participants