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

Compiler error in gcc 8.2.0 on Debian 10.x (buster) #308

Closed
pdp7 opened this issue Mar 30, 2019 · 6 comments
Closed

Compiler error in gcc 8.2.0 on Debian 10.x (buster) #308

pdp7 opened this issue Mar 30, 2019 · 6 comments

Comments

@pdp7
Copy link
Collaborator

pdp7 commented Mar 30, 2019

I was testing the new Debian "buster" image by @RobertCNelson and we noticed that the Adafruit_BBIO build was failing on compiler warnings. This seems to be due to the introduction of new compiler warnings in the more recent version of gcc that is on the buster image: https://rcn-ee.net/rootfs/bb.org/testing/2019-03-03/buster-iot/bone-debian-buster-iot-armhf-2019-03-03-4gb.img.xz a shot

NOTE: commit 0923b85 caused a regression in older versions of gcc. See issue #307

TODO: determine how to avoid compile failure in gcc 8.2.0 without causing a regression for gcc 6.3.0 in the current Debian 9.x "Stretch" images

@pdp7 pdp7 self-assigned this Mar 30, 2019
@pdp7 pdp7 added the bug label Mar 30, 2019
@pdp7 pdp7 changed the title Compiler error in gcc Compiler error in gcc 8.2.0 on Debian 10.x (buster) Mar 30, 2019
@eliasbakken
Copy link

Here is a workaround to get it to compile on Buster. Please note it has not been tested, just that the compilation passes.

CFLAGS="-Wno-cast-function-type -Wno-format-truncation -Wno-sizeof-pointer-memaccess -Wno-stringop-overflow" python setup.py install

@pdp7
Copy link
Collaborator Author

pdp7 commented Jul 12, 2019

@eliasbakken thanks, do you know if this would cause a regression in earlier versions of gcc where those options didn't exist yet?

@eliasbakken
Copy link

Sorry, I'm not familiar with the compiler options on older GCCs...

@jlinford
Copy link

You can cast via (PyCFunction)(void*) rather than just (PyCFunction) if you're worried about regression in earlier versions of GCC. FYI, this bug is breaking HomeAssistant support for BBB GPIO. Would be good to see it fixed soon!

pdp7 added a commit that referenced this issue Dec 11, 2019
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
pdp7 added a commit that referenced this issue Dec 11, 2019
Debian 10 (Buster) has gcc 8.2 which warns about:

error: ‘%s’ directive output may be truncated writing up to 19 bytes into a region of size between 10 and 59 [-Werror=format-truncation=]
  snprintf(path, sizeof(path), "%s/%s/state", ocp_dir, pinmux_dir);
pdp7 added a commit that referenced this issue Dec 11, 2019
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
pdp7 added a commit that referenced this issue Dec 11, 2019
Debian 10 (Buster) has gcc 8.2 which warns about:

source/c_pwm.c:459:65: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
source/c_pwm.c:396:43: error: ‘%s’ directive output may be truncated writing up to 199 bytes into a region of size 100 [-Werror=format-truncation=]
pdp7 added a commit that referenced this issue Dec 11, 2019
Debian 10 (Buster) has gcc 8.2 which warns about:

cast between incompatible function types from ‘PyObject * (*)(PyObject *, PyObject *, PyObject *)’

The solution is to cast to '(PyCFunction)(void *)'
@pdp7 pdp7 removed the help wanted label Dec 17, 2019
@pdp7
Copy link
Collaborator Author

pdp7 commented Dec 17, 2019

@jlinford I have merged #321. Please check if this resolves the build errors that you encountered. Thank you.

@jlinford
Copy link

jlinford commented Jan 5, 2020

It's fixed! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants