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

Use externs in common.h #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

synthead
Copy link

This PR fixes an issue when compiling with gcc 10. extern statements are required when declaring variables in header files, so this adds these.

Without this PR, this is what is seen when compiling with gcc 10:

linking shared-object rpi_gpio/rpi_gpio.so
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: multiple definition of `gpio_mode'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: multiple definition of `rpiinfo'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: multiple definition of `pin_to_gpio'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: multiple definition of `module_setup'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: multiple definition of `setup_error'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: multiple definition of `gpio_direction'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: multiple definition of `pin_to_gpio_rev3'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: multiple definition of `pin_to_gpio_rev2'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: first defined here
/usr/bin/ld: rb_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: multiple definition of `pin_to_gpio_rev1'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: multiple definition of `gpio_direction'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: multiple definition of `module_setup'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: multiple definition of `setup_error'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: multiple definition of `rpiinfo'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: multiple definition of `pin_to_gpio'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: multiple definition of `pin_to_gpio_rev3'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: multiple definition of `pin_to_gpio_rev2'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: multiple definition of `pin_to_gpio_rev1'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: first defined here
/usr/bin/ld: rb_pwm.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: multiple definition of `gpio_mode'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: multiple definition of `module_setup'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:45: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: multiple definition of `setup_error'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:44: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: multiple definition of `rpiinfo'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:43: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: multiple definition of `gpio_direction'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:42: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: multiple definition of `pin_to_gpio'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:41: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: multiple definition of `pin_to_gpio_rev3'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:40: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: multiple definition of `pin_to_gpio_rev2'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:39: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: multiple definition of `pin_to_gpio_rev1'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:38: first defined here
/usr/bin/ld: rpi_gpio.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: multiple definition of `gpio_mode'; common.o:/home/deploy/on-air/.misc/rpi_gpio/tmp/armv7l-linux-eabihf/rpi_gpio/3.0.2/../../../../ext/rpi_gpio/common.h:37: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:262: rpi_gpio.so] Error 1

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 this pull request may close these issues.

1 participant