projectDirPath not respected in Xcode 9's new build system
| Originator: | ryan.brown | ||
| Number: | rdar://32724065 | Date Originated: | June 13 2017 |
| Status: | Closed | Resolved: | Fixed in Xcode 9 Beta 2 |
| Product: | Xcode | Product Version: | 9.0 beta (9M136h) |
| Classification: | Serious | Reproducible: | Always |
Summary:
Gyp makes use of the projectDirPath variable in project.pbxproj to specify the location of the root source directory relative to the Xcode project. This makes it possible to store the project in a subdirectory (e.g in <repo>/ide/mac/myProject.xcodeproj), while still specifying paths relative to the root (e.g HEADER_SEARCH_PATHS=<repo>/modules/some_library/include).
Xcode 9's standard build system executes the compiler from a directory derived using projectDirPath. When the new build system is enabled, however, the compiler is executed from the directory containing the Xcode project. The new build system appears to ignore projectDirPath. This can cause existing projects to no longer build.
-----
Steps to Reproduce:
- Clone the example: https://github.com/ryb-ableton/XcodeProjectDirPathBug
- Run the build.sh script
The script generates an Xcode project with gyp and then runs xcodebuild twice: first with the standard build system, which succeeds, and then with the new build system, which fails.
-----
Expected Results:
The project successfully builds with the new build system.
-----
Observed Results:
The project doesn't build. The build log shows that the compiler is executed from different directories:
Standard:
CompileC build/test.build/Default/test.build/Objects-normal/x86_64/main.o main.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /tmp/XcodeProjectDirPathBug
New:
CompileC /tmp/XcodeProjectDirPathBug/build/test.build/Default/test.build/Objects-normal/x86_64/main.o /tmp/XcodeProjectDirPathBug/main.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /tmp/XcodeProjectDirPathBug/ide
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!