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

Can't build on GCC 14 #677

Open
lachesis opened this issue Nov 20, 2024 · 2 comments
Open

Can't build on GCC 14 #677

lachesis opened this issue Nov 20, 2024 · 2 comments

Comments

@lachesis
Copy link

Hi!

I was checking out libpostal, and saw something that could be improved.


My country is USA


Here's how I'm using libpostal

I'm trying to canonicalize addresses.


Here's what I did

make


Here's what I got

$ make
make[2]: Entering directory '/home/user/projects/libpostal/libpostal/src'
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.. -I/usr/local/include    -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"/home/user/projects/libpostal/libpostal_data/libpostal"' -g -mfpmath=sse -msse2 -DUSE_SSE -g -O2 -O2 -D LIBPOSTAL_EXPORTS  -MT libpostal_la-libpostal.lo -MD -MP -MF .deps/libpostal_la-libpostal.Tpo -c -o libpostal_la-libpostal.lo `test -f 'libpostal.c' || echo './'`libpostal.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -I/usr/local/include -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR=\"/home/user/projects/libpostal/libpostal_data/libpostal\" -g -mfpmath=sse -msse2 -DUSE_SSE -g -O2 -O2 -D LIBPOSTAL_EXPORTS -MT libpostal_la-libpostal.lo -MD -MP -MF .deps/libpostal_la-libpostal.Tpo -c libpostal.c  -fPIC -DPIC -o .libs/libpostal_la-libpostal.o
libpostal.c: In function ‘libpostal_classify_language’:
libpostal.c:217:58: error: initialization of ‘libpostal_language_classifier_response_t *’ {aka ‘struct libpostal_language_classifier_response *’} from incompatible pointer type ‘language_classifier_response_t *’ {aka ‘struct language_classifier_response *’} [-Wincompatible-pointer-types]
  217 |     libpostal_language_classifier_response_t *response = classify_languages(address);
      |                                                          ^~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:1417: libpostal_la-libpostal.lo] Error 1
make[2]: Leaving directory '/home/user/projects/libpostal/libpostal/src'
make[1]: *** [Makefile:470: all-recursive] Error 1
make[1]: Leaving directory '/home/user/projects/libpostal/libpostal'
make: *** [Makefile:379: all] Error 2


$ gcc --version
gcc (GCC) 14.2.1 20240910
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here's what I was expecting

The package to build successfully.


For parsing issues, please answer "yes" or "no" to all that apply.

Does not apply.


Here's what I think could be improved

GCC no longer allows implicitly casting all pointer types to all other pointer types. This behavior is now restricted to the void * type and its qualified variations.

https://gcc.gnu.org/gcc-14/porting_to.html

Instead, libpostal should probably just export the other type.

@lachesis
Copy link
Author

lachesis commented Nov 20, 2024

Alternatively, you could explicitly cast with a void* in the way:

libpostal_language_classifier_response_t *response = (void*)classify_languages(address);

@mikicz
Copy link

mikicz commented Jan 4, 2025

I managed a workaround, I updated the Makefiles, updated CFLAGS_BASE to have -Wno-incompatible-pointer-types and that got me past that 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