build: pass C/C++ compiler to FetchContent projects#145
Open
ingomueller-net wants to merge 1 commit intosubstrait-io:mainfrom
Open
build: pass C/C++ compiler to FetchContent projects#145ingomueller-net wants to merge 1 commit intosubstrait-io:mainfrom
ingomueller-net wants to merge 1 commit intosubstrait-io:mainfrom
Conversation
This PR passes the `CMAKE_(C|CXX)_COMPILER` variables from the current project to the projects fetched with `FetchContent`. By default, the compiler will be chosen from scratch, which may be the content of the `CC` or `CXX` variables or the system default. This is problematic because it may change depending on the evironment where the build is run -- not the configuration. Furthermore, if different compilers and LTO are used, the build may break. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Mar 30, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Mar 31, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Mar 31, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Mar 31, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Apr 1, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to ingomueller-net/substrait-mlir-contrib
that referenced
this pull request
Apr 1, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
ingomueller-net
added a commit
to substrait-io/substrait-mlir-contrib
that referenced
this pull request
Apr 1, 2026
This PR removes a work-around I thought would fix a problem with sframes I ran into on my machine leading to linker errors while compiling ANTLR (a dependency of substrait-cpp). Turns out that the root cause is that CMake uses the system default compiler for dependencies fetched with `FetchContent`, which is g++ on my machine (which emits sframes), which may then linked with compilation units compiled by a different compiler, which may break of LTO is enabled. The short-term solution is to set the `CC? and `CXX` environment variables to the same values as `CMAKE_*_COMPILER` when configuring. I have submitted a better mid-term solution as substrait-io/substrait-cpp#145. Signed-off-by: Ingo Müller <ingomueller@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR passes the
CMAKE_(C|CXX)_COMPILERvariables from the current project to the projects fetched withFetchContent. By default, the compiler will be chosen from scratch, which may be the content of theCCorCXXvariables or the system default. This is problematic because it may change depending on the evironment where the build is run -- not the configuration. Furthermore, if different compilers and LTO are used, the build may break.