ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

undefined reference to `facedetect_cnn(unsigned char*, unsigned char*, int, int, int)' #82

Closed Adhders closed 5 years ago

Adhders commented 5 years ago

我在Ubantu上运行g++ libfacedetectcnn-example.cpp ./test.jpg -O3 pkg-config --libs --cflags opencv4 undefined reference to `facedetect_cnn(unsigned char, unsigned char, int, int, int)', 我已经加头文件了啊

Adhders commented 5 years ago

咱们这个readme 文件应该添加下运行的指令

MarkMa1990 commented 5 years ago

I actually have some other problem when compiling the code.


g++ -c facedetectcnn.cpp -o facedetectcnn.o

facedetectcnn.cpp: In function ‘float dotProductFloatChGeneral(float*, float*, int, int)’:
facedetectcnn.cpp:102:39: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
     __m256 sumvec = _mm256_setzero_ps();
                                       ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:41:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:1202:1: error: inlining failed in call to always_inline ‘__m256 _mm256_setzero_ps()’: target specific option mismatch
 _mm256_setzero_ps (void)
 ^
facedetectcnn.cpp:102:38: error: called from here
     __m256 sumvec = _mm256_setzero_ps();
                                      ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:79:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/fmaintrin.h:63:1: error: inlining failed in call to always_inline ‘__m256 _mm256_fmadd_ps(__m256, __m256, __m256)’: target specific option mismatch
 _mm256_fmadd_ps (__m256 __A, __m256 __B, __m256 __C)
 ^
facedetectcnn.cpp:114:33: error: called from here
         sumvec = _mm256_fmadd_ps(avec, bvec, sumvec);
                                 ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:41:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:846:1: error: inlining failed in call to always_inline ‘__m256 _mm256_load_ps(const float*)’: target specific option mismatch
 _mm256_load_ps (float const *__P)
 ^
facedetectcnn.cpp:107:38: error: called from here
         bvec = _mm256_load_ps(p2 + i);
                                      ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:41:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:846:1: error: inlining failed in call to always_inline ‘__m256 _mm256_load_ps(const float*)’: target specific option mismatch
 _mm256_load_ps (float const *__P)
 ^
facedetectcnn.cpp:106:38: error: called from here
         avec = _mm256_load_ps(p1 + i);
                                      ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:41:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:258:1: error: inlining failed in call to always_inline ‘__m256 _mm256_hadd_ps(__m256, __m256)’: target specific option mismatch
 _mm256_hadd_ps (__m256 __X, __m256 __Y)
 ^
facedetectcnn.cpp:118:28: error: called from here
     sumvec = _mm256_hadd_ps(sumvec, sumvec);
                            ^
In file included from /usr/lib/gcc/x86_64-linux-gnu/5/include/immintrin.h:41:0,
                 from facedetectcnn.h:41,
                 from facedetectcnn.cpp:26:
/usr/lib/gcc/x86_64-linux-gnu/5/include/avxintrin.h:258:1: error: inlining failed in call to always_inline ‘__m256 _mm256_hadd_ps(__m256, __m256)’: target specific option mismatch
 _mm256_hadd_ps (__m256 __X, __m256 __Y)
 ^
facedetectcnn.cpp:119:28: error: called from here
     sumvec = _mm256_hadd_ps(sumvec, sumvec);
lucasjinreal commented 5 years ago

@Mark Same error here

daixiangzi commented 5 years ago

same erro

frommyhearttoyourheart commented 5 years ago

@mark Same error here

you should add like this :QMAKE_CXXFLAGS += "-mavx" QMAKE_CXXFLAGS += "-mfma",when you compile.emmm,I use Qt + CMake.I hope to help you.

frommyhearttoyourheart commented 5 years ago

那个方法好像没有实现吧,所以报错了

dzyjjpy commented 5 years ago

@Adhders @MarkMa1990 @daixiangzi I have met the same issue. Solved by add -L./ -lfacedetection to point out the library we want to link. g++ libfacedetectcnn-example.cpp -L./ -lfacedetection -Wl,-rpath=. pkg-config --cflags --libs opencv -o facedetect pls have a try, good luck.

yangn0 commented 5 years ago

@Adhders @MarkMa1990 @daixiangzi I have met the same issue. Solved by add -L./ -lfacedetection to point out the library we want to link. g++ libfacedetectcnn-example.cpp -L./ -lfacedetection -Wl,-rpath=. pkg-config --cflags --libs opencv -o facedetect pls have a try, good luck.

what is -lfacedetection?

/usr/bin/ld: 找不到 -lfacedetection collect2: error: ld returned 1 exit status

yangn0 commented 5 years ago

咱们这个readme 文件应该添加下运行的指令

请问下 这个问题最后怎么解决的。谢谢大佬~