Building LLVM from source fails on Debian 12 -- compiler can't invoke cc1 (file not found) #6294
Replies: 3 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.
-
|
Why are you trying to build LLVM from source? You should be able to install it from a bottle. Homebrew should use your system compiler by default, unless it is is too old (which it isn't, in your case). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Additional Info
Output of
brew configOutput of
brew doctorDescription 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
liblzmalike so:My (muti-hour) investigation narrowed it down to
CheckSymbolExists.cmakebehavior, 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.cmakeThen 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