Skip to content

Add -fcommon to CFLAGS for GCC 10+ compatibility#7

Open
Luyoung0001 wants to merge 1 commit intoNJU-ProjectN:masterfrom
Luyoung0001:master
Open

Add -fcommon to CFLAGS for GCC 10+ compatibility#7
Luyoung0001 wants to merge 1 commit intoNJU-ProjectN:masterfrom
Luyoung0001:master

Conversation

@Luyoung0001
Copy link

Summary

This change adds the -fcommon flag to our build configuration to maintain compatibility with GCC version 10 and above. The newer versions of GCC default to -fno-common, which leads to multiple definition errors for projects that relied on the older -fcommon behavior.

Details

  • GCC 10 and later versions have changed the default setting from -fcommon to -fno-common. This affects the handling of multiple definitions of the same global variable across different files, which previously were silently merged but now cause build errors.
  • By explicitly setting -fcommon in our build scripts, we ensure that our code will continue to compile without errors across all supported versions of GCC.
  • This is particularly important for legacy codebases or projects with multiple definitions of the same variables across different files.

Impact

  • Ensures build stability and backward compatibility with older GCC versions.
  • Prevents multiple definition errors during the linking phase when using GCC 10 or newer.

Please review the changes and merge if everything is in order. Feedback is welcome!

…rting from GCC 10, the default behavior is -fno-common, which can cause multiple definition errors in some projects.

Signed-off-by: luyoung0001 <luyoung0001@gmail.com>
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