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

Build fails on GCC 10 #519

Closed
Gaelan opened this issue Jan 21, 2021 · 3 comments
Closed

Build fails on GCC 10 #519

Gaelan opened this issue Jan 21, 2021 · 3 comments

Comments

@Gaelan
Copy link

Gaelan commented Jan 21, 2021

GCC 10 contains a breaking change: it defaults to -fno-common, which requires globals to be declared in exactly one C file, and referenced elsewhere with extern. This causes openal-soft to fail to build with a linker error:

ld: CMakeFiles/OpenAL.dir/Alc/ALu.c.o:(.rodata+0x3bf60): multiple definition of `FuMa2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf40): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/ALu.c.o:(.rodata+0x3bfa0): multiple definition of `SN3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf80): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/ALu.c.o:(.rodata+0x3bfe0): multiple definition of `N3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xfc0): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/bformatdec.c.o:(.rodata+0x2e0): multiple definition of `SN3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf80): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/bformatdec.c.o:(.rodata+0x320): multiple definition of `N3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xfc0): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/bformatdec.c.o:(.rodata+0x2a0): multiple definition of `FuMa2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf40): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/panning.c.o:(.rodata+0x1360): multiple definition of `FuMa2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf40): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/panning.c.o:(.rodata+0x13e0): multiple definition of `N3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xfc0): first defined here
ld: CMakeFiles/OpenAL.dir/Alc/panning.c.o:(.rodata+0x13a0): multiple definition of `SN3D2N3DScale'; CMakeFiles/OpenAL.dir/Alc/ALc.c.o:(.rodata+0xf80): first defined here
collect2: error: ld returned 1 exit status

This could be fixed by declaring globals in exactly one place as noted above, or by explicitly passing -fcommon to gcc.

@kcat
Copy link
Owner

kcat commented Jan 21, 2021

How is it supposed to work for global constexpr values/arrays? Inline variables are a C++17 feature, but it should be possible to have global constexpr variables in C++14.

@Gaelan
Copy link
Author

Gaelan commented Jan 21, 2021 via email

@kcat
Copy link
Owner

kcat commented Jan 31, 2021

Fixed with commit 20f5e7c.

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