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

Installation failure: for’ loop initial declarations are only allowed in C99 mode #20

Open
angerhang opened this issue Nov 18, 2021 · 0 comments

Comments

@angerhang
Copy link

angerhang commented Nov 18, 2021

When running pip install catch22, the C compilation seems to complain. I tried it with python 3.7-3.9.

 C/CO_AutoCorr.c:531:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
             for(int j = 0; j < numBins; j++){
             ^
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/cxx579/anaconda3/envs/test_env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-l6lnk30h/catch22_0230d4e651e84fa1a6f4489c53513e34/setup.py'"'"'; __file__='"'"'/tmp/pip-install-l6lnk30h/catch22_0230d4e651e84fa1a6f4489c53513e34/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-g8rdn06o/install-record.txt --single-version-externally-managed --compile --install-headers /home/cxx579/anaconda3/envs/test_env/include/python3.9/catch22 Check the logs for full command output.

I am not an expert in C and how it tights up with the Python wrapper but it might. have to do with this? Any ideas how to fix this. Thx :D

This issue can be fixed by

export CFLAGS="-std=c99"

However, it might be good to change the for loop instantiation that is more compatible by declaring the the iteration variable outside the loop like:

int i;
for (i=0;i<10;i++) { ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant