Open chudur-budur opened 5 months ago
At a guess, this is either related to the c compiler version used or the standard library that comes with your OS.
I don't know anything about conda. Can you please confirm clang --version
with the clang and clang++ binary you are passing to configure. Also your OS.
It seems likely that something about system headers on your system is causing assert.h to not be available in this source file. For a quick fix, you can try adding #include <assert.h>
to alignment.h. It is possible that on other systems it is being picked up transitively. If that fixes it, we can just land that change.
See: https://en.cppreference.com/w/c/language/_Static_assert
At a guess, this is either related to the c compiler version used or the standard library that comes with your OS.
gcc --version gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I don't know anything about conda. Can you please confirm
clang --version
with the clang and clang++ binary you are passing to configure. Also your OS.clang --version clang version 18.1.7 (https://github.com/conda-forge/clangdev-feedstock 1b91969d0c6b64ef555f9c04fc02d7758335f4b3) Target: x86_64-conda-linux-gnu Thread model: posix InstalledDir: /localdisk/$USER/opt/miniforge3/envs/iree-build/bin Configuration file: /localdisk/$USER/opt/miniforge3/envs/iree-build/bin/x86_64-conda-linux-gnu-clang.cfg
clang++ --version clang version 18.1.7 (https://github.com/conda-forge/clangdev-feedstock 1b91969d0c6b64ef555f9c04fc02d7758335f4b3) Target: x86_64-conda-linux-gnu Thread model: posix InstalledDir: /localdisk/$USER/opt/miniforge3/envs/iree-build/bin Configuration file: /localdisk/$USER/opt/miniforge3/envs/iree-build/bin/x86_64-conda-linux-gnu-clang++.cfg
cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
It seems likely that something about system headers on your system is causing assert.h to not be available in this source file. For a quick fix, you can try adding
#include <assert.h>
to alignment.h. It is possible that on other systems it is being picked up transitively. If that fixes it, we can just land that change.
I just checked, #include <assert.h>
is already in runtime/src/iree/base/alignment.h
See: https://en.cppreference.com/w/c/language/_Static_assert
If we look at the compilation command, it's using -std=gnu11
, but the above link says static_assert()
is supported after C23
. So shouldn't we use -std=c23
instead? Or maybe just use _Static_assert()
there?
It's tricky: it becomes a keyword in c23 but it's define'd in assert.h until then.
I suspect this is trying to be compatible as both a c and c++ header. This is weird. We compile regularly on both ununtu 22.04 (although CI is older) and clang (an old version on CI but a lot of use of newer). But we probably don't have much/any use of clang 18 yet, and maybe there is a compatibility issue. Someone will need to investigate.
If you want the easy way to unblock immediately, you will likely have better success with GCC or an older version of clang but I'm just guessing until someone can look at this more.
Thanks for the issue report: it seems there is a recent breakage here.
If you want the easy way to unblock immediately, you will likely have better success with GCC or an older version of clang but I'm just guessing until someone can look at this more.
I have tried with older version of clang
(15, 16, 17) and getting the same error. I think it's the problem with how conda (or x86_64-conda-linux-gnu
package) manages all the c/c++ headers. Maybe I should ditch conda altogether and try it on a fresh system (i.e. docker).
What happened?
I don't have admin access to the machine that I am working on. Therefore I was trying to build iree through conda environment.
I am compiling like this:
But I am getting this error:
Steps to reproduce your issue
Setup a conda/mamba env
Install compiler
List packages
Configure and compile
What component(s) does this issue relate to?
Other
Version information
831da7c
Additional context
No response