leimingyu / HMM_cuda

Hidden Markov Model for Isolated Word Recognition on GPU
MIT License
4 stars 2 forks source link

cmake failed #1

Closed andyyuan78 closed 8 years ago

andyyuan78 commented 9 years ago

ubgpu@ubgpu:~/github/HMM_cuda$ cmake . -- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PythonInterp: /usr/bin/python (found version "2.7.6") -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "7.0") CMake Error at /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1455 (_cuda_get_important_host_flags): _cuda_get_important_host_flags Function invoked with incorrect arguments for function named: _cuda_get_important_host_flags Call Stack (most recent call first): /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1570 (CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS) unit_test/CMakeLists.txt:51 (cuda_add_executable) unit_test/CMakeLists.txt:63 (add_gmock_test)

CMake Error at /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1455 (_cuda_get_important_host_flags): _cuda_get_important_host_flags Function invoked with incorrect arguments for function named: _cuda_get_important_host_flags Call Stack (most recent call first): /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1570 (CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS) unit_test/CMakeLists.txt:51 (cuda_add_executable) unit_test/CMakeLists.txt:64 (add_gmock_test)

CMake Error at /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1455 (_cuda_get_important_host_flags): _cuda_get_important_host_flags Function invoked with incorrect arguments for function named: _cuda_get_important_host_flags Call Stack (most recent call first): /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1570 (CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS) unit_test/CMakeLists.txt:51 (cuda_add_executable) unit_test/CMakeLists.txt:65 (add_gmock_test)

CUDA found! CMake Error at /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1455 (_cuda_get_important_host_flags): _cuda_get_important_host_flags Function invoked with incorrect arguments for function named: _cuda_get_important_host_flags Call Stack (most recent call first): /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1526 (CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS) CMakeLists.txt:58 (cuda_add_library)

CMake Error at /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1455 (_cuda_get_important_host_flags): _cuda_get_important_host_flags Function invoked with incorrect arguments for function named: _cuda_get_important_host_flags Call Stack (most recent call first): /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:1570 (CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS) CMakeLists.txt:71 (cuda_add_executable)

-- Configuring incomplete, errors occurred! See also "/home/ubgpu/github/HMM_cuda/CMakeFiles/CMakeOutput.log". See also "/home/ubgpu/github/HMM_cuda/CMakeFiles/CMakeError.log". ubgpu@ubgpu:~/github/HMM_cuda$

leimingyu commented 9 years ago

It seems there is a bug in FindCUDA.cmake to support separable compilation. I am using Ubuntu 14.04, cuda 7, without errors. Could you provide the "/home/ubgpu/github/HMM_cuda/CMakeFiles/CMakeError.log ?"

andyyuan78 commented 9 years ago

ubgpu@ubgpu:~/github/HMM_cuda/build$ vim /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeError.log

Determining if the pthread_create exist failed with the following output: Change Dir: /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec2936996512/fast" /usr/bin/make -f CMakeFiles/cmTryCompileExec2936996512.dir/build.make CMakeFiles/cmTryCompileExec2936996512.dir/build make[1]: Entering directory /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec2936996512.dir/CheckSymbolExists.c.o /usr/bin/cc -o CMakeFiles/cmTryCompileExec2936996512.dir/CheckSymbolExists.c.o -c /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c Linking C executable cmTryCompileExec2936996512 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2936996512.dir/link.txt --verbose=1 /usr/bin/cc CMakeFiles/cmTryCompileExec2936996512.dir/CheckSymbolExists.c.o -o cmTryCompileExec2936996512 -rdynamic CMakeFiles/cmTryCompileExec2936996512.dir/CheckSymbolExists.c.o: In functionmain': CheckSymbolExists.c:(.text+0x16): undefined reference to pthread_create' collect2: error: ld returned 1 exit status make[1]: *** [cmTryCompileExec2936996512] Error 1 make[1]: Leaving directory/home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp' make: *\ [cmTryCompileExec2936996512/fast] Error 2

File /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c: /* */

include

int main(int argc, char\ argv) { (void)argv;

ifndef pthread_create

return ((int*)(&pthread_create))[argc];

else

(void)argc; return 0;

endif

}

Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec672727640/fast" /usr/bin/make -f CMakeFiles/cmTryCompileExec672727640.dir/build.make CMakeFiles/cmTryCompileExec672727640.dir/build make[1]: Entering directory /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec672727640.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTryCompileExec672727640.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.2/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec672727640 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec672727640.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTryCompileExec672727640.dir/CheckFunctionExists.c.o -o cmTryCompileExec672727640 -rdynamic -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status make[1]: *** [cmTryCompileExec672727640] Error 1 make[1]: Leaving directory/home/ubgpu/github/HMM_cuda/build/CMakeFiles/CMakeTmp' make: *\ [cmTryCompileExec672727640/fast] Error 2

leimingyu commented 9 years ago

"Determining if the function pthread_create exists in the pthreads failed with the following output: ... /usr/bin/ld: cannot find -lpthreads ... " It seems that pthreads lib is not found.

andyyuan78 commented 9 years ago

yes, just don't know how to fix it.

here is a link , would you check it? http://stackoverflow.com/questions/15193785/how-to-get-cmake-to-recognize-pthread-on-ubuntu

I tried but it doesn't work , I am not good at cmake, would you like see and try to fix it?

leimingyu commented 9 years ago

Define the requirement in CMake find_package(Threads REQUIRED) Then, when you compile the target, link the pthread lib. The example is below. target_link_libraries(program_exe pthread) If you are using debian based Linux, run the following command as suggested here. However, it usually comes with gcc. sudo apt-get install libpthread-stubs0-dev

andyyuan78 commented 9 years ago

sudo apt-get install libpthread-stubs0-dev is done, but it cannot fix the issue.

leimingyu commented 9 years ago

What's the output by running the command below? $locate libpthread

andyyuan78 commented 9 years ago

ubgpu@ubgpu:~/github/HMM_cuda$ locate libpthread /home/ubgpu/.local/share/Trash/files/ida_tools/Hex-Rays IDA 6.1 Pro Andvanced/Hex-Rays.IDA.Pro.Advanced.v6.1.Windows.incl.Hex-Rays.x86.Decompiler.v1.5.READ.NFO-RDW/ida61/ids/epoc9/arm/libpthread.ids /home/ubgpu/.local/share/Trash/files/ida_tools/Hex-Rays.IDA.Pro.Advanced.v6.1.Win.incl.Hex-Rays.x86.Decompiler.v1.5.FLAIR.IDSUtils.LOADINT.TILIB.SDK-RDW/IDA6.1/ids/epoc9/arm/libpthread.ids /home/ubgpu/.local/share/Trash/files/ida_tools/ida64plus/ids/epoc9/arm/libpthread.ids /home/ubgpu/A_D/external/valgrind/main/drd/tests/supported_libpthread /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib/libpthread-2.11.1.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib/libpthread.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib/libpthread.so.0 /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib/libpthread_nonshared.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/libpthread-2.11.1.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/libpthread.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/libpthread.so.0 /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/libpthread_nonshared.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/xen/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/sysroot/usr/lib32/xen/libpthread_nonshared.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/libpthread-2.15.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/libpthread.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/libpthread.so.0 /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib/libpthread_nonshared.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/libpthread-2.15.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/libpthread.so /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/libpthread.so.0 /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/libpthread_nonshared.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/xen/libpthread.a /home/ubgpu/A_D/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/sysroot/usr/lib32/xen/libpthread_nonshared.a /home/ubgpu/book-src/src_YOCTO/build/tmp/stamps/armv5te-poky-linux-gnueabi/libpthread-stubs /home/ubgpu/book-src/src_YOCTO/build/tmp/work-shared/gcc-4.8.2-r0/gcc-4.8.2/gcc/config/openbsd-libpthread.h /home/ubgpu/book-src/src_YOCTO/poky/meta/recipes-graphics/xorg-lib/libpthread-stubs_0.3.bb /lib/i386-linux-gnu/libpthread-2.19.so /lib/i386-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread-2.19.so /lib/x86_64-linux-gnu/libpthread.so.0 /lib32/libpthread-2.19.so /lib32/libpthread.so.0 /libx32/libpthread-2.19.so /libx32/libpthread.so.0 /usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so /usr/lib/i386-linux-gnu/libpthread.a /usr/lib/i386-linux-gnu/libpthread.so /usr/lib/i386-linux-gnu/libpthread_nonshared.a /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/x86_64-linux-gnu/libpthread.so /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib32/libpthread.a /usr/lib32/libpthread.so /usr/lib32/libpthread_nonshared.a /usr/libx32/libpthread.a /usr/libx32/libpthread.so /usr/libx32/libpthread_nonshared.a /usr/share/doc/libpthread-stubs0-dev /usr/share/doc/libpthread-stubs0-dev/README /usr/share/doc/libpthread-stubs0-dev/changelog.Debian.gz /usr/share/doc/libpthread-stubs0-dev/copyright /var/lib/dpkg/info/libpthread-stubs0-dev:amd64.list /var/lib/dpkg/info/libpthread-stubs0-dev:amd64.md5sums ubgpu@ubgpu:~/github/HMM_cuda$

leimingyu commented 9 years ago

Yours has pthreads. Maybe you can write a simple cmake test program to debug it. Check this one. http://stackoverflow.com/questions/1620918/cmake-and-libpthread