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

Building with Xcode 15 emits warning: Ignoring duplicate libraries: '-lc++' #410

Open
herzbube opened this issue Jan 12, 2024 · 0 comments
Assignees

Comments

@herzbube
Copy link
Owner

A standard build of this project with Xcode 15 generates the following warning:

ld: warning: ignoring duplicate libraries: '-lc++'

What does the warning mean?

Xcode 15 introduced a new linker (see the Xcode 15 release notes). Apparently with this linker it is no longer necessary to explicitly link the C++ standard library runtime. If you do add the -lc++ linker flag, though, then the linker emits the warning above.

Apparently somewhere, somehow, the project seems to pick up the -lc++ flag.

Analysis

The project itself no longer sets the -lc++ linker flag, but it inherits this flag from the generated CocoaPods project. It is currently not clear why CocoaPods sets the -lc++ flag, but in any case the flag can be found in the various generated .xcconfig files. Search for the flag like this:

$ grep -ri -- c++ Pods | grep -- -l | cut -d":" -f1 | sort | uniq
Pods/Target Support Files/Pods-All Targets-Little Go/Pods-All Targets-Little Go.debug.xcconfig
Pods/Target Support Files/Pods-All Targets-Little Go/Pods-All Targets-Little Go.distribute_adhoc.xcconfig
Pods/Target Support Files/Pods-All Targets-Little Go/Pods-All Targets-Little Go.distribute_appstore.xcconfig
Pods/Target Support Files/Pods-All Targets-Little Go/Pods-All Targets-Little Go.release.xcconfig
Pods/Target Support Files/Pods-All Targets-Unit tests/Pods-All Targets-Unit tests.debug.xcconfig
Pods/Target Support Files/Pods-All Targets-Unit tests/Pods-All Targets-Unit tests.distribute_adhoc.xcconfig
Pods/Target Support Files/Pods-All Targets-Unit tests/Pods-All Targets-Unit tests.distribute_appstore.xcconfig
Pods/Target Support Files/Pods-All Targets-Unit tests/Pods-All Targets-Unit tests.release.xcconfig

Example line from one of the files:

OTHER_LDFLAGS = $(inherited) [...] -l"c++" [...]

Status / Workaround

The linker warning is nothing serious and can effectively be ignored.

To get rid of the warning temporarily you can manually edit the .xcconfig files and remove the -l"c++".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant