Xcode 10 linking wrong dylib when using per-configuration product names

Originator:mathew
Number:rdar://46791649 Date Originated:18/12/2018
Status:Open Resolved:No
Product:Xcode Product Version:10.1 (10B61)
Classification:Bug Reproducible:Always
 
Summary:
If a dependent project configures the product name and thus the resulting file name of a dylib to be different for debug and release when linking into a parent project the wrong filename can be chosen.

NOTE: Switching to the legacy build system works around this issue.

Steps to Reproduce:
1. Set up two Xcode projects, both for MacOS dylibs, I named mine "Test_Parent" and "Test_Child".
2. Add a single cpp source file to each, default content is fine.
2. Nest them such that the parent depends on the child, i.e. "target dependency" and "link binary with libraries".
3. Build, you should see both child and parent build successfully and link correctly.
4. Edit the child project such that for debug configuration the Product Name is test_debug, and for release configuration the Product Name is test_release.
5. Build for release, note everything works fine.
6. Switch the scheme to debug, note that while compilation is correct (both compile as debug), when linking test_release is used, which cannot be found.

Expected Results:
The correct file name for the child should be determined by evaluating the correct configuration at link time.

Actual Results:
The linker selects the wrong file name.

Version/Build:
Xcode Version 10.1 (10B61)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!