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

error while compling ROI Align #127

Closed
guyan277 opened this issue Apr 16, 2018 · 13 comments
Closed

error while compling ROI Align #127

guyan277 opened this issue Apr 16, 2018 · 13 comments

Comments

@guyan277
Copy link

creating home/guyan/tmp/frrcnn/lib/model/roi_align
creating home/guyan/tmp/frrcnn/lib/model/roi_align/src
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/guyan/anaconda3/envs/Maxwell2/include/python2.7 -c _roi_align.c -o ./_roi_align.o
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/guyan/anaconda3/envs/Maxwell2/include/python2.7 -c /home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c -o ./home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.o
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c: In function ‘roi_align_backward’:
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:65:9: warning: unused variable ‘batch_size’ [-Wunused-variable]
int batch_size = THFloatTensor_size(bottom_grad, 0);
^
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignForwardCpu’:
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:87:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:88:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:88:5: note: use option -std=c99 or -std=gnu99 to compile your code
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignBackwardCpu’:
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:145:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/guyan/tmp/frrcnn/lib/model/roi_align/src/roi_align.c:146:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
Traceback (most recent call last):
File "build.py", line 38, in
ffi.build()
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/init.py", line 164, in build
_build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/torch/utils/ffi/init.py", line 100, in _build_extension
ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/cffi/api.py", line 684, in compile
compiler_verbose=verbose, debug=debug, **kwds)
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/cffi/recompiler.py", line 1484, in recompile
compiler_verbose, debug)
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/cffi/ffiplatform.py", line 20, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/home/guyan/anaconda3/envs/Maxwell2/lib/python2.7/site-packages/cffi/ffiplatform.py", line 56, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.error.VerificationError: CompileError: command 'gcc' failed with exit status 1

@jwyang
Copy link
Owner

jwyang commented Apr 16, 2018

Hi, @guyan277 I guess it is because your gcc version does not support the compile.

@guyan277
Copy link
Author

Thx @jwyang i will check it

@WBinke
Copy link

WBinke commented Apr 20, 2018

I met the same problem,could you tell me what is your gcc version?Mine is 4.84.Thanks! @jwyang

@jwyang
Copy link
Owner

jwyang commented Apr 20, 2018

Hi, @WBinke it is gcc 5.4.0

@liuhyCV
Copy link

liuhyCV commented Apr 22, 2018

Thx! I have the same problem like it. The reason is: Ubuntu 14 gcc version = 4.8, need to update to 5.4.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

Then can be complier sucessfully

@liuhyCV
Copy link

liuhyCV commented Apr 22, 2018

I have alse meet the error:
ImportError:pytorch-faster-rcnn/tools/../lib/nms/_ext/nms/_nms.so: undefined symbol: state
the same error in: undefined symbol: state
and refered some explanatioin "ImportError: undefined symbol: state" -- since last upgrade

so I also upgrade the pytorch version to 0.2.0_post3 and
recompiled it, the problem is solved.

@ksaito-ut
Copy link

Hi, I meet a similar error when compiling roi align. I updated the version of gcc, but the error was not solved. How can I fix it ? Thanks in advance.

File "build.py", line 38, in
ffi.build()
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/torch/utils/ffi/init.py", line 167, in build
_build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/torch/utils/ffi/init.py", line 103, in _build_extension
ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/cffi/api.py", line 697, in compile
compiler_verbose=verbose, debug=debug, **kwds)
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/cffi/recompiler.py", line 1520, in recompile
compiler_verbose, debug)
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 22, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/home/mil/ksaito/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 58, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.error.VerificationError: CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

@chj1933
Copy link

chj1933 commented May 9, 2018

@ksaito-ut Hi, I meet a similar error when compiling roi align. I updated the version of gcc, but the error was not solved. How can I fix it ? Thanks in advance.
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:87:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:87:5: note: use option -std=c99 or -std=gnu99 to compile your code
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignBackwardCpu’:
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:143:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:144:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
Traceback (most recent call last):
File "build.py", line 38, in
ffi.build()
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 167, in build
_build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 103, in _build_extension
ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/api.py", line 697, in compile
compiler_verbose=verbose, debug=debug, **kwds)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/recompiler.py", line 1520, in recompile
compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 22, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 58, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.error.VerificationError: CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

@chj1933
Copy link

chj1933 commented May 10, 2018

@guyan277 I have solved this by
int idx;
for (idx = 0; idx < output_size; ++idx)
but appear
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignForwardCpu’:
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:86:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:14: error: redeclaration of ‘idx’ with no linkage
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:87:9: note: previous declaration of ‘idx’ was here
int idx;
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:5: note: use option -std=c99 or -std=gnu99 to compile your code
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignBackwardCpu’:
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:144:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:146:14: error: redeclaration of ‘idx’ with no linkage
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:145:9: note: previous declaration of ‘idx’ was here
int idx;
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:146:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
Traceback (most recent call last):
File "build.py", line 38, in
ffi.build()
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 167, in build
_build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 103, in _build_extension
ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/api.py", line 697, in compile
compiler_verbose=verbose, debug=debug, **kwds)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/recompiler.py", line 1520, in recompile
compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 22, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 58, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.error.VerificationError: CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1
for (idx = 0; idx < output_size; ++idx)
but appear
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignForwardCpu’:
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:86:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:14: error: redeclaration of ‘idx’ with no linkage
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:87:9: note: previous declaration of ‘idx’ was here
int idx;
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:88:5: note: use option -std=c99 or -std=gnu99 to compile your code
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c: In function ‘ROIAlignBackwardCpu’:
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:144:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
#pragma omp parallel for
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:146:14: error: redeclaration of ‘idx’ with no linkage
for (int idx = 0; idx < output_size; ++idx)
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:145:9: note: previous declaration of ‘idx’ was here
int idx;
^
/home/chenghj/faster-rcnn.pytorch/lib/model/roi_align/src/roi_align.c:146:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int idx = 0; idx < output_size; ++idx)
^
Traceback (most recent call last):
File "build.py", line 38, in
ffi.build()
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 167, in build
_build_extension(ffi, cffi_wrapper_name, target_dir, verbose)
File "/usr/local/lib/python2.7/dist-packages/torch/utils/ffi/init.py", line 103, in _build_extension
ffi.compile(tmpdir=tmpdir, verbose=verbose, target=libname)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/api.py", line 697, in compile
compiler_verbose=verbose, debug=debug, **kwds)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/recompiler.py", line 1520, in recompile
compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 22, in compile
outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
File "/home/chenghj/.local/lib/python2.7/site-packages/cffi/ffiplatform.py", line 58, in _build
raise VerificationError('%s: %s' % (e.class.name, e))
cffi.error.VerificationError: CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

@WBinke
Copy link

WBinke commented May 10, 2018

Check your x86_64-linux-gnu-gcc version,maybe its verion is still 4.8,beacause it is a softlink.Just check it. @ksaito-ut @chj1933

@ksaito-ut
Copy link

@WBinke Thank you for your advice! I checked my x86_64-linux-gnu-gcc version and found it was still 4.8. So, I changed the link to x86_64-linux-gnu-gcc-5. It worked!

@inkawhich
Copy link

export CXXFLAGS="-std=c++11"
export CFLAGS="-std=c99"

@jwyang
Copy link
Owner

jwyang commented Jun 29, 2018

cheers you solved the problem, closing this issue.

@jwyang jwyang closed this as completed Jun 29, 2018
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

7 participants