conflicting define on Solaris - build failure (Bug #890)
Description
build of OpenCV on Solaris 11express fails with the below message.
This is because one of the system headers on solaris defines CS to 15.
the attached patch solved it for me
...
[ 71%] Building CXX object modules/flann/CMakeFiles/opencv_flann.dir/src/precomp.o
cd /export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann && /opt/sunstudio12.1/bin/CC -Dopencv_flann_EXPORTS -DHAVE_CONFIG_H -DCVAPI_EXPORTS -D_REENTRANT -DNDEBUG -D+EXTENSIONS+ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DSOLARIS -DSOLARIS10 -DNO_DEBUG -D_UNICODE -DUNICODE -D_RWSTD_REENTRANT -D_XOPEN_SOURCE=500 -D_XPG5 -I/usr/include/stdcxx4/ansi -I/usr/include/stdcxx4 -I/opt/kde4/include -I/usr/include/stdcxx4/ansi -I/usr/include/stdcxx4 -library=no%Cstd -library=Crun -features=anachronisms,except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic -instances=global -template=geninlinefuncs -s -xdebugformat=dwarf -xlang=c99 -xalias_level=compatible -xustr=ascii_utf16_ushort -Qoption ccfe -features=gcc -Qoption ccfe -features=zla -Qoption ccfe ++boolflag:sunwcch=false -mt -xF=%none -xbuiltin=%all -xinline=%auto -xprefetch=auto -xprefetch_auto_type=indirect_array_access -xprefetch_level=3 -xalias_level=compatible -KPIC -DPIC -xipo=0 -xO3 -xregs=no%frameptr -xjobs=2 -xrestrict=%all -xthreadvar=%all -z combreloc -z redlocsym -z nodefaultlib -z ignore -z now -z rescan -z absexec -xldscope=symbolic -xlibmil -s -xtarget=pentium4 -m32 -xarch=sse2 -xchip=pentium4 -xcache=8/64/4:256/128/8 -lc -lm -ldl -lpthread -lposix4 -lrt -mt -Y P,/opt/kde4/lib -i -L/opt/kde4/lib -R/opt/kde4/lib -L/usr/lib -R/usr/lib -Bdynamic -lstdcxx4 -lCrun -lc -lm -m32 -s -Y P,/opt/kde4/lib -i -L/opt/kde4/lib -R/opt/kde4/lib -L/usr/lib -R/usr/lib -Bdynamic -lstdcxx4 -lCrun -lc -lm -xtarget=pentium4 -m32 -xarch=sse2 -xchip=pentium4 -xcache=8/64/4:256/128/8 -xipo=0 -xO3 -xO3 -DNDEBUG -KPIC -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/. -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0 -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/include -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/include/opencv -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann/include -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann/src -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann -I/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann/../core/include -o CMakeFiles/opencv_flann.dir/src/precomp.o -c /export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann/src/precomp.cpp
"/export/home/test/packages/BUILD/OpenCV-2.2.0/i386/OpenCV-2.2.0/modules/flann/include/opencv2/flann/general.h", line 76: Error: Identifier expected instead of "15".
Associated revisions
Prefixed constants in flann with FLANN_ to prevent clashes with constants from other includes, closes bug #890
Merge pull request #890 from caorong:patch-1
Merge remote-tracking branch 'origin/2.4' into merge-2.4
Merged pull requests:
#890 from caorong:patch-1
#893 from jet47:gpu-arm-fixes
#933 from pengx17:2.4_macfix_cont
#935 from pengx17:2.4_filter2d_fix
#936 from bitwangyaoyao:2.4_perf
#937 from bitwangyaoyao:2.4_fixPyrLK
#938 from pengx17:2.4_surf_sample
#939 from pengx17:2.4_getDevice
#940 from SpecLad:autolock
#941 from apavlenko:signed_char
#946 from bitwangyaoyao:2.4_samples2
#947 from jet47:fix-gpu-arm-build
#948 from jet47:cuda-5.5-support
#952 from SpecLad:jepg
#953 from jet47:fix-bug-3069
#955 from SpecLad:symlink
#957 from pengx17:2.4_fix_corner_detector
#959 from SpecLad:qt4-build
#960 from SpecLad:extra-modules
Conflicts:
modules/core/include/opencv2/core/core.hpp
modules/gpu/CMakeLists.txt
modules/gpu/include/opencv2/gpu/device/vec_math.hpp
modules/gpu/perf/perf_video.cpp
modules/gpuimgproc/src/cuda/hough.cu
modules/ocl/include/opencv2/ocl/ocl.hpp
modules/ocl/src/pyrlk.cpp
samples/gpu/driver_api_multi.cpp
samples/gpu/driver_api_stereo_multi.cpp
samples/ocl/surf_matcher.cpp
History
Updated by Marius Muja about 14 years ago
Fixed in r4730.
- Status changed from Open to Done
- (deleted custom field) set to fixed
Updated by Boris Mansencal about 14 years ago
Changes in r4730 "Prefixed constants in flann with FLANN_ to prevent clashes with constants from other includes, closes bug #890"
break compatibility with exisiting working OpenCV 2.2.0 code.
Indeed, we have for example to replace :
cvflann::set_distance_type(cvflann::MINKOWSKI, order);
by
cvflann::set_distance_type(cvflann::FLANN_DIST_MINKOWSKI, order);
It seems that only "CS" is a problem.
Would it possible to add :
#ifdef CS
#undef CS
#endif
in the concerned file ?
- Status changed from Done to Cancelled
- (deleted custom field) deleted (
fixed)
Updated by Vadim Pisarevsky almost 14 years ago
if your code is supposed to work with 2.2.0 and trunk/2.3 etc., you can use conditional compilation:
#if CV_MAJOR_VERSION*100+CV_MINOR_VERSION*10+CV_SUBMINOR_VERSION > 220 cvflann::set_distance_type(cvflann::FLANN_DIST_MINKOWSKI, order); #else cvflann::set_distance_type(cvflann::MINKOWSKI, order); #endif
- Status changed from Cancelled to Done
- (deleted custom field) set to worksforme