gradle / gradle/gradle-native

Injected include paths cause build failures on Mac/Clang

Open
#720 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
94
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Expected Behavior
Clean compilation. /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/include not added to path on a Mac.

### Current Behavior
/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/include is being added to the paths and that causes a compilation failure.

### Context
I just want to use an unordered_map.

### Steps to Reproduce (for bugs)
On a Mac running latest tools
Clone this project: https://github.com/rogerdubbs/GradleCPPIncludePathIssue
Try to build it.

Now cd to src/main/cpp
run:
c++ --std=c++17 -v main.cpp 2> without.txt
Note that it works. You can run a.out if you like.
Now try:
c++ --std=c++17 -v -I /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/usr/include main.cpp 2> with.txt
diff with.txt without.txt
The only difference between the files before the errors is the include path gradle added. If that's not quite the right path on your system, please check for a similar item in build/tmp/compileDebugCpp/options.txt and use that.
Note that you get the same compiler errors as gradle gives.

### Your Environment
Running on a Macbook Pro that is up to date.
c++ version:
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

* Build scan URL: https://scans.gradle.com/s/4lwpahcqzi3am

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the linked GradleCPPIncludePathIssue project and compare the compiler commands and build/tmp/compileDebugCpp/options.txt. Trace where the Mac SDK include path is added to the native compilation arguments; done means the path is no longer injected and the project compiles successfully with the affected Clang toolchain.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.