kmaninis / COB

Convolutional Oriented Boundaries
http://www.vision.ee.ethz.ch/~cvlsegmentation/cob/
Other
195 stars 59 forks source link

compiling problems #1

Closed zeakey closed 8 years ago

zeakey commented 8 years ago

I compiled COB on my computer, the environment is: Ubuntu14 with g++4.8.4.

The origin mex compile option is: GCC='g++' in build.m line64:

gcc_string = ['GCC=''' gcc_compiler ''' '];.

A error occured when I compile with this option which said:

COB/src/misc/containers.hpp:28:32: error: range-based ‘for’ loops are not allowed in C++98 mode

Obviously c++11 is not on, so I add '-std=c++11' to the option:

gcc_string = ['GCC=''', gcc_compiler, ''' ', 'CXXFLAGS=''', '-std=c++11', ''' '];

Error resolved but another occurs:

mex_assess_one_sel.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /tmp/mex_2366922350995321_500/mex_assess_one_sel.o: error adding symbols: Bad value collect2: error: ld returned 1 exit status

I don't exactly know what it is, but as it prompted, I go on add -fPIC to the CXXFLAGS: gcc_string = ['GCC=''', gcc_compiler, ''' ', 'CXXFLAGS=''', '-std=c++11 -fPIC', ''' '];

everything works well after this, hope this experience helps somebody else.

jponttuset commented 8 years ago

Thanks @zeakey! We updated the building script with your suggestion, hopefully this will prevent these errors for future users.