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

Fails to build with GCC 14 due to -Wimplicit-function-declaration #158

Closed
glaubitz opened this issue May 29, 2024 · 1 comment · Fixed by #159
Closed

Fails to build with GCC 14 due to -Wimplicit-function-declaration #158

glaubitz opened this issue May 29, 2024 · 1 comment · Fixed by #159

Comments

@glaubitz
Copy link

Trying to build python-crfsuite with GCC 14 fails because of the enforced -Wimplicit-function-declaration:

[   42s] gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -Icrfsuite/include/ -Icrfsuite/lib/cqdb/include -Iliblbfgs/include -Ipycrfsuite -I/usr/include/python3.10 -c -std=c99 crfsuite/lib/crf/src/crf1d_context.c -o build/temp.linux-x86_64-cpython-310/crfsuite/lib/crf/src/crf1d_context.o
[   42s] In file included from crfsuite/lib/crf/src/crf1d_context.c:47:
[   42s] crfsuite/lib/crf/src/vecmath.h: In function ‘_aligned_malloc’:
[   42s] crfsuite/lib/crf/src/vecmath.h:50:15: error: implicit declaration of function ‘posix_memalign’ [-Wimplicit-function-declaration]
[   42s]    50 |     int ret = posix_memalign(&p, alignment, size);
[   42s]       |               ^~~~~~~~~~~~~~
[   42s] crfsuite/lib/crf/src/crf1d_context.c: In function ‘crf1dc_new’:
[   42s] crfsuite/lib/crf/src/crf1d_context.c:71:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
[   42s]    71 |         if (ret = crf1dc_set_num_items(ctx, T)) {
[   42s]       |             ^~~
[   42s] crfsuite/lib/crf/src/crf1d_context.c: In function ‘crf1dc_score’:
[   42s] crfsuite/lib/crf/src/crf1d_context.c:440:15: warning: unused variable ‘L’ [-Wunused-variable]
[   42s]   440 |     const int L = ctx->num_labels;
[   42s]       |               ^
[   42s] crfsuite/lib/crf/src/crf1d_context.c:438:38: warning: unused variable ‘cur’ [-Wunused-variable]
[   42s]   438 |     const floatval_t *state = NULL, *cur = NULL, *trans = NULL;
[   42s]       |                                      ^~~
[   42s] error: command '/usr/bin/gcc' failed with exit code 1

To reproduce, build with GCC 14 as the default C/C++ compiler.

@glaubitz
Copy link
Author

As a heads-up, this is fixed by adding -D_POSIX_C_SOURCE=200112L to CFLAGS.

The proper fix would probably be not using posix_memalloc() until Python upstream switches to a newer _POSIX_C_SOURCE.

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 a pull request may close this issue.

1 participant