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

CFLAGS provided by pkgconfig with warnings #224

Open
sergiusens opened this issue Jul 2, 2024 · 3 comments
Open

CFLAGS provided by pkgconfig with warnings #224

sergiusens opened this issue Jul 2, 2024 · 3 comments

Comments

@sergiusens
Copy link
Contributor

I have warnings which are errors in the provided pkgconfig files, which produce:

:: cc -Ilib/libspelling-1.a.p -Ilib -I../src/lib -I/snap/gnome-46-2404-sdk/current/usr/include -I/snap/gnome-46-2404-sdk/current/usr/include/glib-2.0 -I/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/snap/gnome-46-2404-sdk/current/usr/include/libmount -I/snap/gnome-46-2404-sdk/current/usr/include/blkid -I/snap/gnome-46-2404-sdk/current/usr/include/gtk-4.0 -I/snap/gnome-46-2404-sdk/current/usr/include/pango-1.0 -I/snap/gnome-46-2404-sdk/current/usr/include/harfbuzz -I/snap/gnome-46-2404-sdk/current/usr/include/freetype2 -I/snap/gnome-46-2404-sdk/current/usr/include/libpng16 -I/snap/gnome-46-2404-sdk/current/usr/include/fribidi -I/snap/gnome-46-2404-sdk/current/usr/include/cairo -I/snap/gnome-46-2404-sdk/current/usr/include/pixman-1 -I/snap/gnome-46-2404-sdk/current/usr/include/gdk-pixbuf-2.0 -I/snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu -I/snap/gnome-46-2404-sdk/current/usr/include/webp -I/snap/gnome-46-2404-sdk/current/usr/include/graphene-1.0 -I/snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/graphene-1.0/include -I/snap/gnome-46-2404-sdk/current/usr/include/gtksourceview-5 -I/snap/gnome-46-2404-sdk/current/usr/include/libxml2 -I/snap/gnome-46-2404-sdk/current/usr/include/enchant-2 -I/root/parts/spelling/build -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wcast-align -Wdeclaration-after-statement -Werror=address -Werror=array-bounds -Werror=empty-body -Werror=implicit -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=init-self -Werror=int-conversion -Werror=int-to-pointer-cast -Werror=main -Werror=misleading-indentation -Werror=missing-braces -Werror=missing-include-dirs -Werror=nonnull -Werror=overflow -Werror=pointer-arith -Werror=pointer-to-int-cast -Werror=redundant-decls -Werror=return-type -Werror=sequence-point -Werror=shadow -Werror=strict-prototypes -Werror=trigraphs -Werror=undef -Werror=write-strings -Wformat-nonliteral -Wignored-qualifiers -Wimplicit-function-declaration -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wno-cast-function-type -Wno-dangling-pointer -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wuninitialized -Wunused -fno-strict-aliasing -Werror=format-security -Werror=format=2 -fstack-protector-strong -fPIC -pthread -mfpmath=sse -msse -msse2 -mfpmath=sse -msse -msse2 -DLIBSPELLING_COMPILATION -MD -MQ lib/libspelling-1.a.p/spelling-text-buffer-adapter.c.o -MF lib/libspelling-1.a.p/spelling-text-buffer-adapter.c.o.d -o lib/libspelling-1.a.p/spelling-text-buffer-adapter.c.o -c ../src/lib/spelling-text-buffer-adapter.c
:: In file included from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib/gutils.h:426,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib/gthread.h:36,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib/gasyncqueue.h:34,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib.h:34,
::                  from ../src/lib/cjhtextregionprivate.h:23,
::                  from ../src/lib/spelling-text-buffer-adapter.c:24:
:: /snap/gnome-46-2404-sdk/current/usr/include/stdlib.h:701:14: error: redundant redeclaration of ‘reallocarray’ [-Werror=redundant-decls]
::   701 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
::       |              ^~~~~~~~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdlib.h:695:14: note: previous declaration of ‘reallocarray’ with type ‘void *(void *, size_t,  size_t)’ {aka ‘void *(void *, long unsigned int,  long unsigned int)’}
::   695 | extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
::       |              ^~~~~~~~~~~~
:: In file included from /snap/gnome-46-2404-sdk/current/usr/include/features.h:502,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/limits.h:26,
::                  from /snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:11,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib/gtypes.h:34,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib/galloca.h:34,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/glib-2.0/glib.h:32:
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:463:24: error: redundant redeclaration of ‘fscanf’ [-Werror=redundant-decls]
::   463 | extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
::       |                        ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:256:41: note: in definition of macro ‘__REDIRECT’
::   256 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
::       |                                         ^~~~
:: In file included from /snap/gnome-46-2404-sdk/current/usr/include/pango-1.0/pango/pango-utils.h:25,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/pango-1.0/pango/pango.h:51,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/gtk-4.0/gdk/gdktypes.h:37,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/gtk-4.0/gdk/gdkapplaunchcontext.h:27,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/gtk-4.0/gdk/gdk.h:29,
::                  from /snap/gnome-46-2404-sdk/current/usr/include/gtk-4.0/gtk/gtk.h:30,
::                  from ../src/lib/spelling-cursor-private.h:23,
::                  from ../src/lib/spelling-text-buffer-adapter.c:29:
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:422:12: note: previous declaration of ‘fscanf’ with type ‘int(FILE * restrict,  const char * restrict, ...)’ {aka ‘int(struct _IO_FILE * restrict,  const char * restrict, ...)’}
::   422 | extern int fscanf (FILE *__restrict __stream,
::       |            ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:466:24: error: redundant redeclaration of ‘scanf’ [-Werror=redundant-decls]
::   466 | extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
::       |                        ^~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:256:41: note: in definition of macro ‘__REDIRECT’
::   256 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
::       |                                         ^~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:428:12: note: previous declaration of ‘scanf’ with type ‘int(const char *, ...)’
::   428 | extern int scanf (const char *__restrict __format, ...) __wur;
::       |            ^~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:468:28: error: redundant redeclaration of ‘sscanf’ [-Werror=redundant-decls]
::   468 | extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
::       |                            ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:264:6: note: in definition of macro ‘__REDIRECT_NTH’
::   264 |      name proto __asm__ (__ASMNAME (#alias)) __THROW
::       |      ^~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:430:12: note: previous declaration of ‘sscanf’ with type ‘int(const char *, const char *, ...)’
::   430 | extern int sscanf (const char *__restrict __s,
::       |            ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:540:24: error: redundant redeclaration of ‘vfscanf’ [-Werror=redundant-decls]
::   540 | extern int __REDIRECT (vfscanf,
::       |                        ^~~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:256:41: note: in definition of macro ‘__REDIRECT’
::   256 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
::       |                                         ^~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:490:12: note: previous declaration of ‘vfscanf’ with type ‘int(FILE * restrict,  const char * restrict,  __va_list_tag *)’ {aka ‘int(struct _IO_FILE * restrict,  const char * restrict,  __va_list_tag *)’}
::   490 | extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
::       |            ^~~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:545:24: error: redundant redeclaration of ‘vscanf’ [-Werror=redundant-decls]
::   545 | extern int __REDIRECT (vscanf, (const char *__restrict __format,
::       |                        ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:256:41: note: in definition of macro ‘__REDIRECT’
::   256 | # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
::       |                                         ^~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:498:12: note: previous declaration of ‘vscanf’ with type ‘int(const char *, __va_list_tag *)’
::   498 | extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
::       |            ^~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:548:28: error: redundant redeclaration of ‘vsscanf’ [-Werror=redundant-decls]
::   548 | extern int __REDIRECT_NTH (vsscanf,
::       |                            ^~~~~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/x86_64-linux-gnu/sys/cdefs.h:264:6: note: in definition of macro ‘__REDIRECT_NTH’
::   264 |      name proto __asm__ (__ASMNAME (#alias)) __THROW
::       |      ^~~~
:: /snap/gnome-46-2404-sdk/current/usr/include/stdio.h:502:12: note: previous declaration of ‘vsscanf’ with type ‘int(const char *, const char *, __va_list_tag *)’
::   502 | extern int vsscanf (const char *__restrict __s,
::       |            ^~~~~~~
:: cc1: some warnings being treated as errors
:: ninja: build stopped: subcommand failed.

Would be great if we could experiment with changing the -I to -isystem to avoid this

snapcraft-apostrophe-on-amd64-for-amd64-21764214 ../project# cat /snap/gnome-46-2404-sdk/current/usr/lib/x86_64-linux-gnu/pkgconfig/gtk4.pc
prefix=/snap/gnome-46-2404-sdk/current/usr
includedir=${prefix}/include
libdir=${prefix}/lib/x86_64-linux-gnu

targets=broadway wayland x11
gtk_binary_version=4.0.0
gtk_host=x86_64-linux

Name: GTK
Description: GTK Graphical UI Library
Version: 4.14.1
Requires: pango >=  1.50.0, pangocairo >=  1.50.0, gdk-pixbuf-2.0 >=  2.30.0, cairo >=  1.14.0, cairo-gobject >=  1.14.0,  vulkan, graphene-gobject-1.0 >=  1.10.0, gio-2.0 >=  2.76.0
Libs: -L${libdir} -lgtk-4
Cflags: -I${includedir}/gtk-4.0

The other alternative could be to remove these std headers from the sdk snap

@sergio-costas
Copy link
Contributor

What are you trying to build?

@sergio-costas
Copy link
Contributor

The problem that I see is that both definitions are in the same header file... That's what I don't understand...

@sergiusens
Copy link
Contributor Author

  spelling:
    source: https://download.gnome.org/sources/libspelling/0.2/libspelling-0.2.1.tar.xz
    source-checksum: sha256/7a787b467bd493f6baffb44138dbc4bef78aaab60efb76a7db88b243bf0f6343
    plugin: meson
    meson-parameters:
      - --prefix=/usr
      - -Ddocs=false
      - -Dvapi=false
    build-environment:
      - CFLAGS: -Wno-error=redundant-decls

The CFLAGS avoid the error.

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