-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Qt] Use -fvisibility=hidden for gcc > 6.3 #10499
Conversation
platform/qt/qt.cmake
Outdated
@@ -5,8 +5,13 @@ option(WITH_QT_DECODERS "Use builtin Qt image decoders" OFF) | |||
option(WITH_QT_I18N "Use builtin Qt i18n support" OFF) | |||
option(WITH_QT_4 "Use Qt4 instead of Qt5" OFF) | |||
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -D__QT__") | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -D__QT__") | |||
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will disable the visibility for GCC < 6.3 and Clang. I build with GCC 5.4 and 4.9 just fine. Can we make sure that only affected GCC versions won't have -fvisibility=hidden
2c0a2c3
to
f737285
Compare
@tmpsantos i have updated the condition to 6.1-6.4 and 7.2 as stated in the gcc bug report |
@@ -5,8 +5,15 @@ option(WITH_QT_DECODERS "Use builtin Qt image decoders" OFF) | |||
option(WITH_QT_I18N "Use builtin Qt i18n support" OFF) | |||
option(WITH_QT_4 "Use Qt4 instead of Qt5" OFF) | |||
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -D__QT__") | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -D__QT__") | |||
if (CMAKE_COMPILER_IS_GNUCC AND NOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still disable -fvisibility=hidden
for clang because it only sets it when CMAKE_COMPILER_IS_GNUCC
.
I think you could always do set(USE_DEFAULT_VISIBILITY "-fvisibility=hidden")
and override with set(USE_DEFAULT_VISIBILITY "")
when the broken compiler is detected.
See #10592 for an alternative fix that doesn't require changing visibility settings. |
Fixed in #10592. Thanks for reporting this build issue and for finding the GCC bug report, it was very helpful for finding a workaround! |
For gcc 6.3 building with default settings errors with
The patch hides gcc bug