Skip to content

GH-36379: [C++] Bundled dependency include paths should override system include dirs - #37612

Merged
kou merged 2 commits into
apache:mainfrom
bkietz:36379-bundled-headers-should-override
Sep 8, 2023
Merged

GH-36379: [C++] Bundled dependency include paths should override system include dirs#37612
kou merged 2 commits into
apache:mainfrom
bkietz:36379-bundled-headers-should-override

Conversation

@bkietz

@bkietzbkietz commented Sep 7, 2023

Copy link
Copy Markdown
Member

Rationale for this change

Bundled dependencies' include directories should override system include dirs. Otherwise an incompatible header in the system might be included when we wanted a header from the bundled dependency.

What changes are included in this PR?

bundled dependencies explicitly insert their own include dirs ahead of others

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #36379has been automatically assigned in GitHub to PR creator.

Comment threadcpp/cmake_modules/ThirdpartyToolchain.cmake Outdated
@github-actionsgithub-actionsBot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Sep 7, 2023
@pitroupitrou changed the title GH-36379: [C++] Bundled dependency include paths should overrideGH-36379: [C++] Bundled dependency include paths should override system include dirsSep 7, 2023
@pitrou

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g cpp

@github-actions

Copy link
Copy Markdown

Revision: 7073a98

Submitted crossbow builds: ursacomputing/crossbow @ actions-1750e0d372

TaskStatus
test-alpine-linux-cppGithub Actions
test-build-cpp-fuzzGithub Actions
test-conda-cppGithub Actions
test-conda-cpp-valgrindAzure
test-cuda-cppGithub Actions
test-debian-11-cpp-amd64Github Actions
test-debian-11-cpp-i386Github Actions
test-fedora-35-cppGithub Actions
test-ubuntu-20.04-cppGithub Actions
test-ubuntu-20.04-cpp-bundledGithub Actions
test-ubuntu-20.04-cpp-minimal-with-formatsGithub Actions
test-ubuntu-20.04-cpp-thread-sanitizerGithub Actions
test-ubuntu-22.04-cppGithub Actions
test-ubuntu-22.04-cpp-20Github Actions
test-ubuntu-22.04-cpp-no-threadingGithub Actions

kou
kou approved these changes Sep 8, 2023

@koukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

We need to run cmake-format before we merge this.

Comment threadcpp/cmake_modules/ThirdpartyToolchain.cmake Outdated
@github-actionsgithub-actionsBot added awaiting merge Awaiting merge and removed awaiting changes Awaiting changes labels Sep 8, 2023

@assignUserassignUser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense imo, a more involved (and brittle) alternative might be to move gtest to the front in target_link_libraries calls. I tried to reproduce the error but failed, where you able to test the fix with the error locally @bkietz ?

@pitrou

Copy link
Copy Markdown
Member

Should we try to revert #37483 in this PR?

@kou

kou commented Sep 8, 2023

Copy link
Copy Markdown
Member

Should we try to revert #37483 in this PR?

Is it just for confirming whether this fixes the #36379 problem or not? Do we re-revert #37483 after we confirm it?

#37483 is needed to fix #37067. So we should not revert #37483 from main.

@pitrou

Copy link
Copy Markdown
Member

Ah, I thought the two approaches were alternatives. If not then nevermind.

@bkietz

Copy link
Copy Markdown
MemberAuthor

FetchContent_MakeAvailable automatically adds include directories and (at least while I was testing this) seems to prepend the -I flags by default. If I'm correct, then #37483 actually resolved this issue for bundled GTest (but the other bundled dependencies are still vulnerable).

@kou

kou commented Sep 8, 2023

Copy link
Copy Markdown
Member

the other bundled dependencies are still vulnerable

I think so too.
So we need both of #37483 and this.

I merge this.

@kou
kou merged commit 44811ba into apache:mainSep 8, 2023
@koukou removed the awaiting merge Awaiting merge label Sep 8, 2023
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 44811ba.

There were 5 benchmark results indicating a performance regression:

The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them.

loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…e system include dirs (apache#37612)
### Rationale for this change
Bundled dependencies' include directories should override system include dirs. Otherwise an incompatible header in the system might be included when we wanted a header from the bundled dependency.
### What changes are included in this PR?
bundled dependencies explicitly insert their own include dirs ahead of others
* Closes: apache#36379
Authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…e system include dirs (apache#37612)
### Rationale for this change
Bundled dependencies' include directories should override system include dirs. Otherwise an incompatible header in the system might be included when we wanted a header from the bundled dependency.
### What changes are included in this PR?
bundled dependencies explicitly insert their own include dirs ahead of others
* Closes: apache#36379
Authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[C++] Bundled GTest CI jobs seem to #includeing GTest headers from somewhere else

4 participants

@bkietz@pitrou@kou@assignUser