lab/技術情報/openCVonFCC
compile test †
Opencvと研究用ライブラリをFCCコンパイルでするのに本当に必要なものは何なのか,を探るページです.
contetns †
暫定OKな設定 †
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline'"
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.fccFCC.extern.alloca
make
make install
テスト †
shared library / static library あたりの設定 †
- configureの2965行目のexitをコメントアウト
- configureの2999行目のexitをコメントアウト
- configureの3046行目のexitをコメントアウト
- cv/src/cvcalibinit.cpp の70行目に
#define PRINTF(...)
を追加
- cv/src/cvkdtree.cppの46行目に
using namespace std;
を追加
- cvaux/include/cvvidsurv/.hppの51行目に
#define __GNUC__
を追加し,61行目に
#undef __GNUC__
を追加.
- include/opencv/cxmisc.hの122行目に
#define __GNUC__
を追加し,137行目に
#undef __GNUC__
を追加.
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline'"
../configure --disable-apps --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.fccFCC.extern.alloca
make
make install
ーここで負け
/usr/bin/install: cannot stat `.libs/libcxcore.so.2.0.0': No such file or directory
shared library / static library の設定2 †
- configureの2965行目のexitをコメントアウト
- configureの2999行目のexitをコメントアウト
- configureの3046行目のexitをコメントアウト
- cv/src/cvcalibinit.cpp の70行目に
#define PRINTF(...)
を追加
- cv/src/cvkdtree.cppの46行目に
using namespace std;
を追加
- cvaux/include/cvvidsurv/.hppの51行目に
#define __GNUC__
を追加し,61行目に
#undef __GNUC__
を追加.
setenv CXX FCC
setenv CXXFLAGS "--variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline'"
../configure --disable-apps --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.fccFCC.extern.alloca
make
make install
Kparallel †
- opencvのコンパイル
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction"
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.fccFCC.extern.alloca
make
make install
- opencvのコンパイルはok
- 続いて自前のライブラリ
FCC -Kparallel,reduction -frtti AAAA.cpp
- これもok
- 続いて自前のライブラリを使用したプログラム;
FCC -Kparallel,reduction -frtti CCCC.cpp
undefined reference to `__mpc_ppfj'
Kparallel - 2 †
- opencvのコンパイルはok
- 続いて自前のライブラリ
FCC -frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction AAAA.cpp
- 続いて自前のライブラリを使用したプログラム.まずはmakefileにgtkとgtherad関係のライブラリを追記:
INC += `pkg-config --cflags opencv gtk+-2.0 gdk-pixbuf-2.0`
LIB += `pkg-config --libs opencv gtk+-2.0 gdk-pixbuf-2.0` -lgthread-2.0
- 注意:これらのライブラリはopencv関係のライブラリよりも先にリンカに呼び出されなければならない.そこでMakefileにはopencv->gtk->gthreadの順で記載する.ライブラリは後ろから順に呼び出されるようである.
- さらに
CFLAGS = CFLAGS = --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction
をコンパイラオプションとして追加.
FCC --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction CCCCC.cpp
- 「-frtti」を付けるとコンパイルエラーとなった.外すとすんなり通る.もしかして不要?
Kparallel -3 †
OPENCVINC = `pkg-config --cflags opencv gtk+-2.0 gdk-pixbuf-2.0`
OPENCVLIB = `pkg-config --libs opencv gtk+-2.0 gdk-pixbuf-2.0` -lgthread-2.0
INC = ${OPENCVINC}
LIBS = -ltiff -lpng -ljpeg ${OPENCVLIB}
.cpp.o:
$(CC) -c -o $@ $< $(CFLAGS) $(INC)
$(OBJNAME):${OBJNAME}.o
$(CC) $(CFLAGS) -o $@ $@.o $(LIBS);
Kparallel & OpenMP -4 †
- FCCでopenMPを利用するには「-KOMP」オプションを付ければok
- OPENCVのコンパイル
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction,OMP"
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.Kparallel.withoutrtti
- 自前ライブラリを組み込んだプログラムのコンパイル。ここでは「-frtti」をはずす
CC = FCC
CFLAGS = --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction
OPENCVINC = `pkg-config --cflags opencv gtk+-2.0 gdk-pixbuf-2.0`
OPENCVLIB = `pkg-config --libs opencv gtk+-2.0 gdk-pixbuf-2.0` -lgthread-2.0
INC = ${OPENCVINC}
LIBS = -ltiff -lpng -ljpeg ${OPENCVLIB}
.cpp.o:
$(CC) -c -o $@ $< $(CFLAGS) $(INC)
$(OBJNAME):${OBJNAME}.o
$(CC) $(CFLAGS) -o $@ $@.o $(LIBS);
- 負け...OpenMPはダメなのか??
Kparallel &OpenMP@自前ライブラリ †
- opencvはOpenMPなしで,自前ライブラリはopenMPを付けてコンパイルしてみる
- OPENCVのコンパイル
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction"
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.Kparallel.withoutrtti
負け?configure後にmakefileを書き換えるステップを再開させてみるか.
Kparallel & makefile cleaning †
opencv/configure.inの19856行目,DEF_CXXFLAGSという箇所をコメントアウト.これで-O3,-fomit-frame-pointerオプションが入らなくなる.
- opencvのコンパイル
setenv CXX FCC
setenv CXXFLAGS "-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction,OMP"
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.Kparallel.withoutrtti
- 自前ライブラリを組み込んだプログラムのコンパイル。
CC = FCC
CFLAGS = --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca '-D_EXTERN_INLINE=static __inline' -Kparallel,reduction
OPENCVINC = `pkg-config --cflags opencv gtk+-2.0 gdk-pixbuf-2.0`
OPENCVLIB = `pkg-config --libs opencv gtk+-2.0 gdk-pixbuf-2.0` -lgthread-2.0
INC = ${OPENCVINC}
LIBS = -ltiff -lpng -ljpeg ${OPENCVLIB}
.cpp.o:
$(CC) -c -o $@ $< $(CFLAGS) $(INC)
$(OBJNAME):${OBJNAME}.o
$(CC) $(CFLAGS) -o $@ $@.o $(LIBS);
- LOST AGAIN...
de fact last chance †
- 「-D_EXTERN_INLINE=static __inline」がうまくいっていないと判断し,引用符付きで強引にコンパイラに食わせる方法「-W0,\"-D_EXTERN_INLINE=static __inline\"」に切り替え.これで通らなければもはや為す術なし.
- 「FCC -v -DHAVE_CONFIG_H -I. -I../../../cxcore/src -I../.. -I. -I../../../cxcore/include -I../../.. -DNDEBUG -frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca "-W0,-D_EXTERN_INLINE=\"static __inline\"" -Kparallel,reduction,OMP -c ../../../cxcore/src/dummy.cpp -o dummy.o」のように引用符の付き方がおかしいように表示されるが,-vオプションをつけて確認したところ問題なかったので注意.
- opencvのコンパイル
setenv CXX FCC
setenv CXXFLAGS '-frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca -W0,-D_EXTERN_INLINE=\"static\ __inline\" -Kparallel,reduction,OMP'
../configure --disable-apps --enable-static --disable-shared --without-python --prefix=/home/t/tXXXXX/opencv-1.1.0.Kparallel.withoutrtti
- 自前ライブラリのコンパイル
CC = FCC
CFLAGS = -frtti --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca -W0,-D_EXTERN_INLINE=\"static\ __inline\" -Kparallel,reduction
OPENCVINC = `pkg-config --cflags opencv`
.cpp.o:
$(CC) -c -o $@ $< $(CFLAGS) $(OPENCVINC)
- 自前ライブラリを組み込んだプログラムのコンパイル。
CC = FCC
CFLAGS = --variadic_macros --alternative_tokens -DUSE_C_ALLOCA -Dalloca=C_alloca -W0,-D_EXTERN_INLINE=\"static\ __inline\" -Kparallel,reduction
OPENCVINC = `pkg-config --cflags opencv gtk+-2.0 gdk-pixbuf-2.0`
OPENCVLIB = `pkg-config --libs opencv gtk+-2.0 gdk-pixbuf-2.0` -lgthread-2.0
INC = ${OPENCVINC}
LIBS = -ltiff -lpng -ljpeg ${OPENCVLIB}
.cpp.o:
$(CC) -c -o $@ $< $(CFLAGS) $(INC)
$(OBJNAME):${OBJNAME}.o
$(CC) $(CFLAGS) -o $@ $@.o $(LIBS);
last chance †
- include/opencv/cxmisc.hのかきかえ:
- コンパイルが無事通るようになりました!パチパチ・・・