Mysterious linker warning "direct access … to global weak symbol … cannot be overridden at runtime"
Mysterious linker warning "direct access … to global weak symbol … cannot be overridden at runtime"
- Subject: Mysterious linker warning "direct access … to global weak symbol … cannot be overridden at runtime"
- From: Jens Alfke <email@hidden>
- Date: Wed, 19 Oct 2016 09:41:15 -0700
I’ve been getting about ten copies of the following linker warning every time I build one of the targets in my project, and today I’m trying to get rid of it, but to no avail. This is when building a simple 64-bit Mac command-line tool target (with Xcode 8.0), which imports a static library built by another target. I’ve never seen this particular warning before…
First to make it more readable, here’s the warning with the details redacted:
> ld: warning: direct access in function ‘…' from file ‘…' to global weak symbol ‘…' from file ‘…' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
And here’s the full warning with the filenames and symbol names:
> ld: warning: direct access in function 'Catch::extractClassName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' from file 'Build/Intermediates/LiteCore.build/Debug/LiteCoreCppTests.build/Objects-normal-asan/x86_64/main.o' to global weak symbol 'std::__1::char_traits<char>::eq(char, char)' from file 'Build/Products/Debug/libLiteCore-static.a(Tokenizer.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
I get ten copies of this warning, all identical except for the “direct access in function ‘…’” naming a different function, i.e. they all name the same global weak symbol (which looks like part of the STL.)
I have looked at the symbol visibility setting (GCC_SYMBOLS_PRIVATE_EXTERN) but changing it in either target has no effect.
This isn’t preventing the program from running, but I hate warnings on principle and would like to fix this one. Thanks for any help.
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden