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

deps/glad: Fix build with GCC-10 #2864

Merged
merged 1 commit into from
May 4, 2020
Merged

Conversation

Chiitoo
Copy link
Contributor

@Chiitoo Chiitoo commented May 4, 2020

Description

Use 'extern' to turn the first definition of 'gladGetProcAddressPtr' into a declaration.

Motivation and Context

GCC-10 defaults to '-fno-common', which triggers issues with multiple definitions of global variables.

Without the changes, builds will fail like so:

FAILED: deps/glad/libobsglad.so.0 
: && /usr/bin/x86_64-pc-linux-gnu-gcc -fPIC -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers -march=znver1 -O2 -fomit-frame-pointer -pipe -mindirect-branch=thunk -std=gnu99 -fno-strict-aliasing  -Wl,-O1 -Wl,--as-needed -shared -Wl,-soname,libobsglad.so.0 -o deps/glad/libobsglad.so.0 deps/glad/CMakeFiles/glad.dir/src/glad.c.o deps/glad/CMakeFiles/glad.dir/src/glad_glx.c.o  /usr/lib64/libX11.so  -ldl  /usr/lib64/libGL.so && :
/usr/lib/gcc/x86_64-pc-linux-gnu/10.0.1/../../../../x86_64-pc-linux-gnu/bin/ld: deps/glad/CMakeFiles/glad.dir/src/glad_glx.c.o:(.bss+0x4b8): multiple definition of `gladGetProcAddressPtr'; deps/glad/CMakeFiles/glad.dir/src/glad.c.o:(.bss+0x5008): first defined here
collect2: error: ld returned 1 exit status

How Has This Been Tested?

Build tests ran with GCC 10.0.1 and 9.3.0 on Gentoo Linux.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.

GCC-10 defaults to '-fno-common' [1], which triggers issues with
defining global variables multiple times.  To fix the build, use
'extern' to turn the first definition of 'gladGetProcAddressPtr'
into a declaration.

1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678

Closes obsproject#2828
@jp9000 jp9000 merged commit 8a1429e into obsproject:master May 4, 2020
@kkartaltepe kkartaltepe mentioned this pull request Jun 14, 2020
8 tasks
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.

2 participants