Skip to content

viztracer C code requires C99  #227

Closed
@comzyh

Description

@comzyh

Reproduce:

In the viztracer directory

docker run --rm -it  -v $(pwd):/root/viztracer centos/python-36-centos7  pip install /root/viztracer

Last few lines of error:

gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/rh-python36/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/opt/rh/rh-python36/root/usr/include/python3.6m -c src/viztracer/modules/snaptrace.c -o build/temp.linux-x86_64-3.6/src/viztracer/modules/snaptrace.o -Werror
src/viztracer/modules/snaptrace.c: In function ‘snaptrace_tracefunc’:
src/viztracer/modules/snaptrace.c:306:17: error: ‘for’ loop initial declarations are only allowed in C99 mode
                 for (int i = 0; i < length; i++) {
                 ^
src/viztracer/modules/snaptrace.c:306:17: note: use option -std=c99 or -std=gnu99 to compile your code
src/viztracer/modules/snaptrace.c:337:21: error: ‘for’ loop initial declarations are only allowed in C99 mode
                     for (size_t i = 0; i < sizeof(curr_task_getters)/sizeof(curr_task_getters[0]); i++) {
                     ^
error: command 'gcc' failed with exit status 1
----------------------------------------
 Command "/opt/app-root/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-n3jn03ib-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-83jv757d-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/app-root/include/site/python3.6/viztracer" failed with error code 1 in /tmp/pip-n3jn03ib-build/

I will raise a PR later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions