Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert.h is too old to support -std=c11 static_assert #44

Open
1 task done
jbms opened this issue Feb 18, 2023 · 3 comments
Open
1 task done

assert.h is too old to support -std=c11 static_assert #44

jbms opened this issue Feb 18, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@jbms
Copy link

jbms commented Feb 18, 2023

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

After installing the gcc package (gcc 12), attempting to compile C11 code that uses the static_assert macro that should be defined by assert.h fails.

echo -e "#include <assert.h>\nstatic_assert(1);" > test.c
gcc -std=c11 -c test.cc
t.c:2:15: error: expected declaration specifiers or '...' before numeric constant
    2 | static_assert(1);
      |               ^

The root cause seems to be that the version of assert.h in the sysroot is very old and does not support C11 static_assert.

Installed packages

_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
binutils_impl_linux-64    2.40                 hf600244_0    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1005    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.12.7            ha878542_0    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     22.11.1         py310hff52083_1    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.7.0              pyhd8ed1ab_1    conda-forge
cryptography              39.0.1          py310h34c0648_0    conda-forge
fmt                       9.1.0                h924138e_0    conda-forge
gcc                       12.2.0              h26027b1_11    conda-forge
gcc_impl_linux-64         12.2.0              hcc96c02_19    conda-forge
gxx                       12.2.0              h26027b1_11    conda-forge
gxx_impl_linux-64         12.2.0              hcc96c02_19    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libarchive                3.6.2                h3d51595_0    conda-forge
libcurl                   7.87.0               hdc1c0ab_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-devel_linux-64     12.2.0              h3b97bd3_19    conda-forge
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgomp                   12.2.0              h65d4601_19    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libmamba                  1.1.0                hde2b089_3    conda-forge
libmambapy                1.1.0           py310h1428755_3    conda-forge
libnghttp2                1.51.0               hff17c54_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libsanitizer              12.2.0              h46fd767_19    conda-forge
libsolv                   0.7.23               h3eb15da_0    conda-forge
libsqlite                 3.40.0               h753d276_0    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-devel_linux-64  12.2.0              h3b97bd3_19    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libxml2                   2.10.3               h7463322_0    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mamba                     1.1.0           py310h51d5547_3    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
openssl                   3.0.8                h0b41bf4_0    conda-forge
pip                       23.0               pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0              pyhd8ed1ab_5    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py310h5764c6d_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.9          he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
reproc                    14.2.4               h0b41bf4_0    conda-forge
reproc-cpp                14.2.4               hcb278e6_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.17.21         py310h5764c6d_2    conda-forge
ruamel.yaml.clib          0.2.7           py310h1fa729e_1    conda-forge
setuptools                65.6.3             pyhd8ed1ab_0    conda-forge
sysroot_linux-64          2.12                he073ed8_15    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.64.1             pyhd8ed1ab_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml-cpp                  0.7.0                h27087fc_2    conda-forge
zstandard                 0.19.0          py310hdeb6495_1    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge

Environment info

active environment : base
    active env location : /root/mambaforge
            shell level : 1
       user config file : /root/.condarc
 populated config files : /root/mambaforge/.condarc
          conda version : 22.11.1
    conda-build version : not installed
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.31=0
                          __linux=5.19.11=0
                          __unix=0=0
       base environment : /root/mambaforge  (writable)
      conda av data dir : /root/mambaforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /root/mambaforge/pkgs
                          /root/.conda/pkgs
       envs directories : /root/mambaforge/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/22.11.1 requests/2.28.2 CPython/3.10.9 Linux/5.19.11-1rodete1-amd64 ubuntu/20.04.4 glibc/2.31
                UID:GID : 0:0
             netrc file : None
           offline mode : False
@h-vetinari
Copy link
Member

This needs a newer sysroot (presumably RHEL 8 clone like alma), see conda-forge/conda-forge.github.io#1432

@isuruf
Copy link
Member

isuruf commented Apr 18, 2023

No, this just needs CentOS 7. You can do conda install sysroot_linux-64=2.17

@aseyboldt
Copy link

aseyboldt commented Nov 7, 2023

I've also been running into this while building iree. I could work around it by installing sysroot_linux-64 2.17
Do I understand correctly that we can't currently build C11 projects with the default sysroot_linux package?
Is there any way this could be fixed? Took me a day to figure this out...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants