View previous topic :: View next topic |
Author |
Message |
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6171 Location: Dallas area
|
Posted: Thu May 14, 2020 12:30 pm Post subject: gcc10 compiling/linking problems |
|
|
There seem to be several programs that won't compile without errors with the gcc-10 compiler, and the key is complaining during the linking phase about multiple definitions. These are mostly caused by default behavior of the compile changing, specifically the "common" flag.
From the release notes
Code: | GCC now defaults to -fno-common. As a result, global variable accesses are more efficient on various targets. In C, global variables with multiple tentative definitions now result in linker errors. With -fcommon such definitions are silently merged during linking. |
What this means is that if you have multiple definitions in your code, and the common flag is set, you'll get a linking error.
Two ways to get things to compile.
1. add the common flag to your CFLAGS, the makes the behavior similar to pre-gcc10 compilers OR use an "env" override of "common" per package.
2. fix the code to get rid of multiple definitions.
Note: There are other problems with some packages (who thought that the gcc version would be over a single digit ) that need a code change.
Edit to add: changed no-common to common, *doh* _________________ UM780, 6.1 zen kernel, gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Last edited by Anon-E-moose on Thu May 28, 2020 10:40 am; edited 2 times in total |
|
Back to top |
|
|
thumper Guru
Joined: 06 Dec 2002 Posts: 554 Location: Venice FL
|
Posted: Thu May 28, 2020 1:55 am Post subject: |
|
|
Don't you mean makes the behavior similar to pre-gcc10 compilers.
And gives linker errors for unfixed code, which is now the default.
??? |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6171 Location: Dallas area
|
Posted: Thu May 28, 2020 10:38 am Post subject: |
|
|
Indeed, I wrote it backwards. _________________ UM780, 6.1 zen kernel, gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2739 Location: Here and Away Again
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|