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

Warning on Corrade #53

Closed
AndySomogyi opened this issue Oct 2, 2018 · 8 comments

Comments

Projects
2 participants
@AndySomogyi
Copy link

commented Oct 2, 2018

Corrade build on OSX results in this somewhat annoying linker warning. This warning has been around since I first started using Corrade.

The warning shows up in both Eclipse (Unix Makefile) and Xcode builds.

I've haven't been bothered enough to try to track it down, but just reporting it here if anyone has a quick fix.

This warning does not seem to effect functionality or usage, it's just kind of annoying to see the warning on each build.

ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::addGroup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Corrade::Utility::ConfigurationGroup*)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::setValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::addValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
@mosra

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2018

Hmm. I did't encounter this warning myself -- reminds me of those dreaded warnings about DLL interface for STL classes that MSVC likes to warn about. Looking at the Travis build, it prints two warnings but these are completely different and unrelated to this. Checked also the iOS build and my local Linux Clang/libc++ build, but no warning there either.

Anything special you have enabled? Debug build or Release? I see this is a static build? Looking at it, it seems to be caused by a particular STL implementation (libc++), where it has some attributes that trigger this. But no idea why just here and not elsewhere.

As a completely random idea, could you try compiling with this patch applied?

diff --git a/src/Corrade/Utility/VisibilityMacros.h b/src/Corrade/Utility/VisibilityMacros.h
index e741f559..16fb1a73 100644
--- a/src/Corrade/Utility/VisibilityMacros.h
+++ b/src/Corrade/Utility/VisibilityMacros.h
@@ -50,13 +50,11 @@
 #endif
 
 /** @hideinitializer
  * @brief Public symbol in a static library
  */
-#ifdef CORRADE_TARGET_WINDOWS
 #define CORRADE_VISIBILITY_STATIC
-#else
-#define CORRADE_VISIBILITY_STATIC __attribute__ ((visibility ("default")))
-#endif
 
 /** @hideinitializer
 @brief Local symbol
@mosra

This comment has been minimized.

Copy link
Owner

commented Oct 4, 2018

Hmm. I'm getting a similar warning on Travis when compiling Magnum:

ld: warning: direct access in function 'Magnum::Shaders::AbstractVector<2u>::AbstractVector()' from file 'src/Magnum/Shaders/CMakeFiles/MagnumShadersObjects.dir/DistanceFieldVector.cpp.o' to global weak symbol 'vtable for Magnum::Shaders::AbstractVector<2u>' from file 'src/Magnum/Shaders/CMakeFiles/MagnumShadersObjects.dir/AbstractVector.cpp.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'Magnum::Shaders::AbstractVector<3u>::AbstractVector()' from file 'src/Magnum/Shaders/CMakeFiles/MagnumShadersObjects.dir/DistanceFieldVector.cpp.o' to global weak symbol 'vtable for Magnum::Shaders::AbstractVector<3u>' from file 'src/Magnum/Shaders/CMakeFiles/MagnumShadersObjects.dir/AbstractVector.cpp.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
...

If you would have a chance testing with the above patch, that would be great 👍 I only have macOS on Travis and doing any trial-and-error testing there is fairly time consuming ;)

@mosra mosra added this to TODO in Platforms via automation Oct 4, 2018

@AndySomogyi

This comment has been minimized.

Copy link
Author

commented Oct 9, 2018

I’ll give it a shot tomorrow, I was buried very deep in message pumps, interrupt requests, signal handlers and all that fun stuff last few days, just now looking around.

@mosra mosra added this to the 2018.1d milestone Oct 15, 2018

@AndySomogyi

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

Hi,

Just pulled latest from master, and still get a LOT of those visibility warnings:

[ 99%] Linking CXX executable MeshTest.app/Contents/MacOS/MeshTest
ld: warning: text-based stub file /System/Library/Frameworks//AppKit.framework/AppKit.tbd and library file /System/Library/Frameworks//AppKit.framework/AppKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AppKit.framework/AppKit.tbd and library file /System/Library/Frameworks//AppKit.framework/AppKit are out of sync. Falling back to library file for linking.
ld: warning: ld: warning: text-based stub file /System/Library/Frameworks//Cocoa.framework/Cocoa.tbd and library file /System/Library/Frameworks//Cocoa.framework/Cocoa are out of sync. Falling back to library file for linking.text-based stub file /System/Library/Frameworks//Cocoa.framework/Cocoa.tbd and library file /System/Library/Frameworks//Cocoa.framework/Cocoa are out of sync. Falling back to library file for linking.

ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/IOKit are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Foundation.framework/Foundation.tbd and library file /System/Library/Frameworks//Foundation.framework/Foundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//OpenGL.framework/OpenGL.tbd and library file /System/Library/Frameworks//OpenGL.framework/OpenGL are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation.tbd and library file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation.tbd and library file /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices.tbd and library file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices.tbd and library file /System/Library/Frameworks//ApplicationServices.framework/Versions/A/ApplicationServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGLU.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.tbd and library file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics.tbd and library file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics.tbd and library file /System/Library/Frameworks//CoreGraphics.framework/Versions/A/CoreGraphics are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText.tbd and library file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText.tbd and library file /System/Library/Frameworks//CoreText.framework/Versions/A/CoreText are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO.tbd and library file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO.tbd and library file /System/Library/Frameworks//ImageIO.framework/Versions/A/ImageIO are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.framework/Versions/A/ATS are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices.tbd and library file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices.tbd and library file /System/Library/Frameworks//CoreServices.framework/Versions/A/CoreServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HIServices.framework/Versions/A/HIServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis.tbd and library file /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork.tbd and library file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork.tbd and library file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList are out of sync. Falling back to library file for linking.
ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::addGroup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Corrade::Utility::ConfigurationGroup*)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::addGroup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Corrade::Utility::ConfigurationGroup*)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/MeshTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
direct access in function 'Corrade::Utility::ConfigurationGroup::setValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'Corrade::Utility::ConfigurationGroup::setValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned int, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/MeshTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.ld: warning:
direct access in function 'Corrade::Utility::ConfigurationGroup::addValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/CylinderTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.ld: warning:
direct access in function 'Corrade::Utility::ConfigurationGroup::addValueInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Corrade::Containers::EnumSet<Corrade::Utility::ConfigurationValueFlag, (unsigned char)255>)' from file '../../extern/corrade/src/Corrade/Utility/libCorradeUtility.a(ConfigurationGroup.cpp.o)' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'CMakeFiles/MeshTest.dir/AppDelegate.mm.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
@mosra

This comment has been minimized.

Copy link
Owner

commented Oct 23, 2018

Well, I didn't apply the above patch because I was not sure if it fixes anything for you ;) Could you try applying it locally and building again, to see if it makes any difference? Thanks!

For the text-based stub file warnings I have no idea. Not a problem of Corrade, I think.

@AndySomogyi

This comment has been minimized.

Copy link
Author

commented Oct 23, 2018

Just tried it, basically what you're doing is defining the CORRADE_VISIBILITY_STATIC to always be set.

Does not seem to do anything, no change.

@mosra

This comment has been minimized.

Copy link
Owner

commented Oct 25, 2018

The stable release is out, so we can experiment again :)

I googled around and this popped up: avast/retdec@0f90931. Could you try building the whole project (maybe Corrade as well) with -fvisibility-inlines-hidden added to CMAKE_CXX_FLAGS?

@mosra mosra modified the milestones: 2019.01, 2019.0b Jan 29, 2019

@mosra mosra removed this from the 2019.0b milestone Mar 16, 2019

@mosra mosra added this to the 2019.0b milestone Jun 16, 2019

@mosra mosra self-assigned this Jun 16, 2019

@mosra

This comment has been minimized.

Copy link
Owner

commented Jun 16, 2019

Should be fixed in 7ae9031.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.