Fix a build issue from iocore cleanup#12000
Merged
moonchen merged 8 commits intoapache:masterfrom Feb 4, 2025
Merged
Conversation
The build of test_net was broken on Mac when the build mode is set to release. Root cause: We support two kinds of linkers. One kind will only search for symbols that are to the left of the object being linked. Another kind will search the list of libraries repeatedly until the no new undefined references are created. Both are sensitive to the order of libraries on the command line. In order to work with both, we have to carefully order our dependencies in cmake. See the build rule for traffic_server for a working list of dependencies. In this case, libinknet_stub.cc provides some symbols that are also provided by ts::proxy, in order to fix an issue of cyclic dependency between ts::inknet and ts::proxy. However, this causes the link to have duplicate symbols when libraries are not ordered correctly, on linkers that repeat through the list. References: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc
bneradt
approved these changes
Feb 3, 2025
yannk
pushed a commit
to yannk/trafficserver
that referenced
this pull request
Feb 6, 2025
* Fix a build issue from iocore cleanup The build of test_net was broken on Mac when the build mode is set to release. Root cause: We support two kinds of linkers. One kind will only search for symbols that are to the left of the object being linked. Another kind will search the list of libraries repeatedly until the no new undefined references are created. Both are sensitive to the order of libraries on the command line. In order to work with both, we have to carefully order our dependencies in cmake. See the build rule for traffic_server for a working list of dependencies. In this case, libinknet_stub.cc provides some symbols that are also provided by ts::proxy, in order to fix an issue of cyclic dependency between ts::inknet and ts::proxy. However, this causes the link to have duplicate symbols when libraries are not ordered correctly, on linkers that repeat through the list. References: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc Solution: For ld, use link groups so the linker searches the group repeatedly until symbols are resolved. For other linkers, carefully order the static libraries so the duplicate symbols are resolved before their stubs are seen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The build of test_net was broken on Mac when the build mode is set to release.
Root cause:
We support two kinds of linkers. One kind will only search for symbols that are to the left of the object being linked. Another kind will search the list of libraries repeatedly until the no new undefined references are created. Both are sensitive to the order of libraries on the command line.
In order to work with both, we have to carefully order our dependencies in cmake. See the build rule for traffic_server for a working list of dependencies.
In this case, libinknet_stub.cc provides some symbols that are also provided by ts::proxy, in order to fix an issue of cyclic dependency between ts::inknet and ts::proxy. However, this causes the link to have duplicate symbols when libraries are not ordered correctly, on linkers that repeat through the list.
References:
https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc