cleishm / libneo4j-client

neo4j-client -- Neo4j Command Line Interface (CLI)
https://neo4j-client.net
Apache License 2.0
155 stars 38 forks source link

error: -Werror=stringop-truncation: no option -Wstringop-truncation #45

Closed davisford closed 4 years ago

davisford commented 4 years ago

I'm trying to build from master on Ubuntu 18.04.

Making check in src
make[2]: Entering directory '/opt/src/libneo4j-client-master-9190be3/lib/src'
/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..    -pthread  -Wpedantic -Wvla -g -O2 -std=gnu11 -fvisibility=hidden -pipe -Wall -W -Wno-unused-parameter     -Wno-missing-field-initializers -Wpointer-arith -Wstrict-prototypes     -Wcast-qual -Wcast-align -Wno-error=unused-function     -Wno-error=unused-variable -Wno-error=deprecated-declarations     -Wno-error=stringop-truncation -Wno-unknown-warning-option -Werror -MT libneo4j_client_la-error_handling.lo -MD -MP -MF .deps/libneo4j_client_la-error_handling.Tpo -c -o libneo4j_client_la-error_handling.lo `test -f 'error_handling.c' || echo './'`error_handling.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -pthread -Wpedantic -Wvla -g -O2 -std=gnu11 -fvisibility=hidden -pipe -Wall -W -Wno-unused-parameter -Wno-missing-field-initializers -Wpointer-arith -Wstrict-prototypes -Wcast-qual -Wcast-align -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=stringop-truncation -Wno-unknown-warning-option -Werror -MT libneo4j_client_la-error_handling.lo -MD -MP -MF .deps/libneo4j_client_la-error_handling.Tpo -c error_handling.c  -fPIC -DPIC -o .libs/libneo4j_client_la-error_handling.o
cc1: error: -Werror=stringop-truncation: no option -Wstringop-truncation
cc1: error: unrecognized command line option ‘-Wno-unknown-warning-option’ [-Werror]
cc1: all warnings being treated as errors
Makefile:586: recipe for target 'libneo4j_client_la-error_handling.lo' failed
make[2]: *** [libneo4j_client_la-error_handling.lo] Error 1
make[2]: Leaving directory '/opt/src/libneo4j-client-master-9190be3/lib/src'
Makefile:462: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/opt/src/libneo4j-client-master-9190be3/lib'
Makefile:472: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1
davisford commented 4 years ago
root@381fff992971:/opt/src/libneo4j-client-master-9190be3# gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 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.

Looks like this option was added in gcc 8, but current package manager only has 7.

davisford commented 4 years ago

Even if I try to force it, again libtool fails...

root@381fff992971:/opt/src/libneo4j-client-master-9190be3# make -i install
Making install in lib
make[1]: Entering directory '/opt/src/libneo4j-client-master-9190be3/lib'
Making install in src
make[2]: Entering directory '/opt/src/libneo4j-client-master-9190be3/lib/src'
/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..    -pthread  -Wpedantic -Wvla -g -O2 -std=gnu11 -fvisibility=hidden -pipe -Wall -W -Wno-unused-parameter     -Wno-missing-field-initializers -Wpointer-arith -Wstrict-prototypes     -Wcast-qual -Wcast-align -Wno-error=unused-function     -Wno-error=unused-variable -Wno-error=deprecated-declarations     -Wno-error=stringop-truncation -Wno-unknown-warning-option -Werror -MT libneo4j_client_la-error_handling.lo -MD -MP -MF .deps/libneo4j_client_la-error_handling.Tpo -c -o libneo4j_client_la-error_handling.lo `test -f 'error_handling.c' || echo './'`error_handling.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -pthread -Wpedantic -Wvla -g -O2 -std=gnu11 -fvisibility=hidden -pipe -Wall -W -Wno-unused-parameter -Wno-missing-field-initializers -Wpointer-arith -Wstrict-prototypes -Wcast-qual -Wcast-align -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=stringop-truncation -Wno-unknown-warning-option -Werror -MT libneo4j_client_la-error_handling.lo -MD -MP -MF .deps/libneo4j_client_la-error_handling.Tpo -c error_handling.c  -fPIC -DPIC -o .libs/libneo4j_client_la-error_handling.o
cc1: error: -Werror=stringop-truncation: no option -Wstringop-truncation
cc1: error: unrecognized command line option ‘-Wno-unknown-warning-option’ [-Werror]
cc1: all warnings being treated as errors
Makefile:586: recipe for target 'libneo4j_client_la-error_handling.lo' failed
make[2]: [libneo4j_client_la-error_handling.lo] Error 1 (ignored)
mv -f .deps/libneo4j_client_la-error_handling.Tpo .deps/libneo4j_client_la-error_handling.Plo
mv: cannot stat '.deps/libneo4j_client_la-error_handling.Tpo': No such file or directory
Makefile:586: recipe for target 'libneo4j_client_la-error_handling.lo' failed
cleishm commented 4 years ago

Ugh. So the problem is that some version of GCC started detecting invalid stringop truncations. To stop treating those as errors, I added -Wno-error=stringop-truncation. But earlier versions don't have that flag and fail with an error. So I added -Wno-unknown-warning-option to mitigate that... but it seems still earlier versions don't have that flag either.

Looks like it'll need to have an autoconf test for the flag(s) instead. How good are you at autoconf? Want to give it a go?

davisford commented 4 years ago

Sadly, not much of an autoconf wizard. I ended up moving past it by going with a different base container image -- using alpine work b/c they have gcc v9+

JensWalther commented 4 years ago

I fixed it by removing both flags from configure.ac (ln 32)