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

Linker warning "direct access to global weak symbol" #3

Closed
herzbube opened this issue Dec 9, 2012 · 6 comments
Closed

Linker warning "direct access to global weak symbol" #3

herzbube opened this issue Dec 9, 2012 · 6 comments
Assignees
Labels
Milestone

Comments

@herzbube
Copy link
Owner

herzbube commented Dec 9, 2012

Since upgrading from Xcode 3 to Xcode 4, and the accompanying compiler upgrade,
the build produces the following linker warning:

ld: warning: direct access in __ZN5boost6system12system_errorD2Ev to global
weak symbol __ZTVN5boost6system12system_errorE means the weak symbol cannot be
overridden at runtime. This was likely caused by different translation units
being compiled with different visibility settings.

Note: This issue was moved here from the old bugtracker.

@herzbube
Copy link
Owner Author

herzbube commented Dec 9, 2012

The mangled names mentioned in the warning can be "decrypted" using c++filt:

__ZN5boost6system12system_errorD2Ev
boost::system::system_error::~system_error()

and

__ZTVN5boost6system12system_errorE
vtable for boost::system::system_error

@herzbube
Copy link
Owner Author

herzbube commented Dec 9, 2012

It is pretty clear that there must be some sort of discrepancy between the 3rdparty software build (via command line) and the Little Go application build (via Xcode).

A first comparison of the command line options used to compile a given .cpp file in both environments did not provide any useful clues. Specifically, the options "-fvisibility=hidden" and "-fvisibility-inlines-hidden" are present in both builds.

Note that in the Xcode build the compiler options of an .mm file need to be examined, because .mm files contain C++ code while .m files contain only Objective-C code. For instance, "-fvisibility-inlines-hidden" is missing when .m files are compiled.

@herzbube
Copy link
Owner Author

herzbube commented Dec 9, 2012

More information:

  • The symbols mentioned in the linker warning are NOT part of libboost_system. Check this using the command
nm
~/Documents/dev/littlego/3rdparty/install/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk/lib/libboost_system.a
  • The 2nd symbol (__ZTVN5boost6system12system_errorE, or "vtable for boost::system::system_error") is part of Fuego, e.g. go/GoBook
  • It is not yet clear how the symbol can appear in Fuego, since system_error is not used directly anywhere in Fuego. Probably some sort of transitive dependency.
  • Looking at boost/system/system_error.hpp, one can see that the class system_error is marked using the preprocessor macro BOOST_SYMBOL_VISIBLE. To my knowledge, all class members inherit their visibility settings from the parent class, and I would hope that this is also true for the destructor and for the vtable (although I didn't realize that a vtable is a symbol). So it is still unclear what the actual problem is...
  • Recompiling the entire 3rdparty stuff did not fix the problem.

@herzbube
Copy link
Owner Author

herzbube commented Dec 9, 2012

Next steps:

  1. Reproduce the problem using a small test project on the command line. This will help getting rid of the complexity of Xcode.
  2. Analyze and understand the problem.

@herzbube
Copy link
Owner Author

herzbube commented Dec 9, 2012

Fixed the following 3rd party build issues:

  • The simulator build now uses llvm-gcc/llvm-g++ just like the iPhoneOS build (previously used gcc/g++)
  • Both builds now use IPHONEOS_DEPLOYMENT_TARGET=4.3 (previously used 4.2)

Despite these fixes, the linker warning is still printed in all builds, EXCEPT the simulator build for one of the release/distribute configurations. Maybe a clue can be found by comparing the simulator SDK build settings of the Debug and Release configurations...

@ghost ghost assigned herzbube Dec 9, 2012
@herzbube
Copy link
Owner Author

The linker warning disappeared after the Fuego build process was outsourced to the fuego-on-ios project (which includes building Boost and Fuego with clang).

herzbube added a commit that referenced this issue Mar 12, 2021
linked crash reports
- Xcode Organizer
  - None
- Crashlytics
  - Crash report batch #3, consisting of 4 crash reports from a single
    device (a 6th generation iPad) running iOS 14.4.

all crashes occurred in method updateAutoLayoutConstraints of
StatusViewController, on this line:
  self.activityIndicatorSpacingConstraint.constant = 0.0f;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant