liuliu / ccv

C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library
http://libccv.org
Other
7.1k stars 1.71k forks source link

Linker fails on mac #90

Closed roseperrone closed 10 years ago

roseperrone commented 10 years ago

I'm running on Mac 10.9. When I run make in ccv/lib, I get the following errors (both on the stable and unstable branches). Make invoked from ccv/bin works fine. I make on only a couple targets (swtdetect and swtcreate). I'm trying to generate a dylib, using https://github.com/liuliu/ccv/pull/44/files, so that I can use the pyccv wrapper (https://github.com/veezio/pyccv), in order to use swtdetect in Python.

clang -dynamiclib ccv_algebra.o ccv_basic.o ccv_bbf.o ccv_cache.o ccv_classic.o ccv_convnet.o ccv_daisy.o ccv_dpm.o ccv_ferns.o ccv_icf.o ccv_io.o ccv_memory.o ccv_mser.o ccv_numeric.o ccv_resample.o ccv_sift.o ccv_swt.o ccv_tld.o ccv_transform.o ccv_util.o 3rdparty/dsfmt/dSFMT.o 3rdparty/kissfft/kiss_fft.o 3rdparty/kissfft/kiss_fftnd.o 3rdparty/kissfft/kiss_fftndr.o 3rdparty/kissfft/kiss_fftr.o 3rdparty/kissfft/kissf_fft.o 3rdparty/kissfft/kissf_fftnd.o 3rdparty/kissfft/kissf_fftndr.o 3rdparty/kissfft/kissf_fftr.o 3rdparty/sfmt/SFMT.o 3rdparty/sha1/sha1.o 3rdparty/sqlite3/sqlite3.o -o libccv.dylib -current_version 1.0 -lm -lpng -ljpeg -framework Accelerate -lavcodec -lavformat -lswscale -lcuda -lcudart -lcublas -L"/usr/local/cuda/lib" Undefined symbols for architecture x86_64: "_cwc_convnet_classify", referenced from: _ccv_convnet_classify in ccv_convnet.o "_cwc_convnet_compact", referenced from: _ccv_convnet_compact in ccv_convnet.o _ccv_convnet_free in ccv_convnet.o "_cwc_convnet_encode", referenced from: _ccv_convnet_encode in ccv_convnet.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *\ [libccv.dylib] Error 1

liuliu commented 10 years ago

Well, that script is old, I think you just need to include cuda/cwc_convnet.o target file too (probably the script author didn't have CUDA capacity as you do, thus, he/she doesn't have this issue). Also, if you only uses ccv's SWT function, you can delete a lot of other functions (as I recommended the way to ship with ccv). But as for experiment, your method is OK.

roseperrone commented 10 years ago

Thanks, what do you mean by "include cuda/cwc_convnet.o target file too"?

liuliu commented 10 years ago

Run clang -dynamiclib ccv_algebra.o cuda/cwc_convnet.o ccv_basic.o ccv_bbf.o ccv_cache.o ccv_classic.o ccv_convnet.o ccv_daisy.o ccv_dpm.o ccv_ferns.o ccv_icf.o ccv_io.o ccv_memory.o ccv_mser.o ccv_numeric.o ccv_resample.o ccv_sift.o ccv_swt.o ccv_tld.o ccv_transform.o ccv_util.o 3rdparty/dsfmt/dSFMT.o 3rdparty/kissfft/kiss_fft.o 3rdparty/kissfft/kiss_fftnd.o 3rdparty/kissfft/kiss_fftndr.o 3rdparty/kissfft/kiss_fftr.o 3rdparty/kissfft/kissf_fft.o 3rdparty/kissfft/kissf_fftnd.o 3rdparty/kissfft/kissf_fftndr.o 3rdparty/kissfft/kissf_fftr.o 3rdparty/sfmt/SFMT.o 3rdparty/sha1/sha1.o 3rdparty/sqlite3/sqlite3.o -o libccv.dylib -current_version 1.0 -lm -lpng -ljpeg -framework Accelerate -lavcodec -lavformat -lswscale -lcuda -lcudart -lcublas -L"/usr/local/cuda/lib"

roseperrone commented 10 years ago

Thanks! That worked