hemprasad / cubgs

Automatically exported from code.google.com/p/cubgs
0 stars 0 forks source link

compile under linux #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am trying to compile cuda-bgs in linux.
I have commented out 2-3 lines of code that used "conio.h" which is not 
portable.
If i try to compile with nvcc the main.cpp it says that it can not link the 
cuda functions.
If i rename it to main.cu i get the following error:
http://tech.groups.y...V/message/81513

Any Ideas how to overcome this?
If i comment out an include line in the cuFastBG..ver5.cu file i can do:
nvcc -c cuFastBG..ver5.cu and end up with an .o file .
Then i use the following command:
g++ CvFastBgGMM_ver5.o main.cpp -o loadimg -I"/usr/include/opencv" -lcxcore 
-lcv -lhighgui -lcuda -I"/usr/local/cuda/include" -L/usr/local/cuda/lib64 
-lcudart

but it produces:
main.cpp:(.text+0x105): undefined reference to `cvCreateFastBgGMMParams(int, 
int)'
main.cpp:(.text+0x127): undefined reference to 
`cvCreateFastBgGMM(CvFastBgGMMParams*, _IplImage*)'
main.cpp:(.text+0x162): undefined reference to 
`cvUpdateFastBgGMMTimer(CvFastBgGMM*, _IplImage*)'
main.cpp:(.text+0x2bc): undefined reference to 
`cvReleaseFastBgGMM(CvFastBgGMM**)'

if i try and compile main.cpp with g++ it succedes,if i compile the .cu file 
with nvcc it also succedes.
But if i try:
g++ main.o CvFastBgGMM_ver5.o -I"/usr/include/opencv" -lcxcore -lcv -lhighgui 
-lcuda -I"/usr/local/cuda/include" -L/usr/local/cuda/lib64 -lcudart
I get the exact same error.

Original issue reported on code.google.com by apostgle...@gmail.com on 4 Nov 2011 at 10:55

GoogleCodeExporter commented 9 years ago
Hi,

I don't know if you had solved this problem yet, But I guess if you are using 
version5 of your .cu code for GMM, you need to change your #define 
CUDAGMM_VERSION to 5 from 4 inside CvFastBgGMM.h because that is preventing the 
code from getting inside CvFastBgGMM_ver5.cu at the entry point. Also you might 
have to provide a template option of no. of blocks in line 171 and 180 of 
cudaUpdateFastBgGMM . This should solve the problem and help you compile it.

Original comment by flair.ra...@gmail.com on 30 Jul 2012 at 8:37

GoogleCodeExporter commented 9 years ago
The problem has been solved and the program has now been successfully compiled 
under linux.
If you have any further suggestions for the linux code I would be glad to look 
into it.

Original comment by apostgle...@gmail.com on 30 Jul 2012 at 10:15

GoogleCodeExporter commented 9 years ago
How did you solve this problem?

Original comment by waren...@gmail.com on 5 Nov 2012 at 10:56