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

Don't understand why handling of globals fails while compiling under Linux #18

Closed
octetta opened this issue Feb 23, 2023 · 2 comments
Closed

Comments

@octetta
Copy link
Contributor

octetta commented Feb 23, 2023

Building AMY on Fedora Linux 37 yields the following errors:

gcc  src/amy-example.o  src/algorithms.o  src/amy.o  src/envelope.o  src/filters.o  src/oscillators.o  src/pcm.o  src/partials.o  src/libsoundio-audio.o  src/amy-example-esp32.o -Wall -lpthread -lsoundio -lm  -o amy-example
/usr/bin/ld: src/libsoundio-audio.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:9: multiple definition of `amy_channel'; src/amy-example.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:9: first defined here
/usr/bin/ld: src/libsoundio-audio.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:10: multiple definition of `amy_device_id'; src/amy-example.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:10: first defined here
/usr/bin/ld: src/libsoundio-audio.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:11: multiple definition of `amy_running'; src/amy-example.o:/home/stewartj/pr/amy/src/libsoundio-audio.h:11: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: amy-example] Error 1

I can change these three variables to extern in libsoundio-audio.h and the code compiles, but I'm worried this isn't the original intention and might lead to other problems as I work on getting the running on my Linux system.

@bwhitman
Copy link
Collaborator

Thanks for this. I ran into this problem myself just last night on a different gcc than we were using to develop AMY/alles.

You did the right fix; I will move all the global-ish decls out of the headers.

@bwhitman
Copy link
Collaborator

Just committed the fix that works for me so far. Thank you!

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