Building LLVM from source fails on Debian 12 -- compiler can't invoke cc1 (file not found) #6294
Replies: 2 comments 1 reply
-
And the bizarre behavior is - if I create a wrapper bash script that "just" executes the same gcc, and replace gcc executable with it in Homebrew folder, it starts to compile properly. So somehow if CMake calls gcc directly, it can't find cc1, but if gcc is wrapped in a bash script, it can. And another bizarre thing is, I can't reliably reproduce it - a fresh Debian 12 install with gcc + build-essential and Homebrew does install and build LLVM right out of the box. |
Beta Was this translation helpful? Give feedback.
-
The Homebrew build environment does indeed unset environment variables. As far as forcing the build to occur with brewed GCC instead of system GCC, you can try the As you've pointed out, it would be nicer to understand the root cause; the fact that changing the compiler fixes it likely points to some other issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Additional Info
Output of
brew config
Output of
brew doctor
Description of issue
I am trying to build LLVM from source on Debian 12.
All dependencies do install correctly, but build persistently fails while looking for
liblzma
like so:My (muti-hour) investigation narrowed it down to
CheckSymbolExists.cmake
behavior, and particularly totry_compile()
function. It feels like when CMake is invoking compiler from this function, it's stripped of all environment variables (or many, at least), which makes it fallback to system gcc, which is 12.2 as opposed to gcc-15 that's installed by brew.What DOES work is if I correct environment right before
try_compile()
incheck_symbol_exists()
inCheckSymbolExists.cmake
Then it compiles correctly → finds the library correctly → proceeds with compiling LLVM.
So it's definitely some sort of an environment issue, but I can't find a way to set these variables "the right way" for Homebrew so that CMake then sees them and respects them.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions