-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build error, missing -lpthread for tests #172
Comments
Thanks for the report. Can you please clarify: does the Clang you have support OpenMP? Can you just please paste the relevant portion of the cmake output? |
It found C but not C++. cmake .. |
I just found this as a possible fix |
Seems like the problem is exactly in mismatch of OpenMP flags in C and CXX. |
My current weird guess is that you make cmake use clang-5.0++ for C++ compiler, but not for C compiler. And C compiler has openmp, while C++ for some reasons doesn't. By the way, how did you make cmake use clang instead of gcc? Did you specify CXX=clang++? If so, did you specify CC=clang? |
I did not specify cmake .. |
I am confused. Is this the whole output of cmake? I don't see the part where it dumps C compiler... |
that is it. here is the steps I did to install and build mkl-dnn. I put all new projects in to new containers. allows me to not clutter up my desktop system. Create new container and share /home/ubuntu and ssh authorized_keys, sudo apt-get install cmake doxygen clang-5.0 |
Hmm... really strange. Could you please clean the build directory and try the following: CC=clang-5.0 CXX=clang++-5.0 cmake .. && make -j |
Thanks -- The C compiler identification is Clang 5.0.0 Running tests... 100% tests passed, 0 tests failed out of 32 Total Test time (real) = 798.00 sec |
Description
I had a problem building mkl-dnn. I fixed it with this patch but it is a hack.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2a8e78ce..1ea11f9e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -42,7 +42,7 @@ endif()
add_executable(api-c api.c)
set_property(TARGET api-c PROPERTY C_STANDARD 99)
-target_link_libraries(api-c ${LIB_NAME} ${EXTRA_LIBS})
+target_link_libraries(api-c ${LIB_NAME} ${EXTRA_LIBS} -lpthread)
add_test(api-c api-c)
if(WIN32)
Environment
Intel MKL-DNN includes hardware-specific optimizations and may behave
differently on depending on the compiler and build environment. Include
the following information to help reproduce the issue:
CPU make and model (try
lscpu
)Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz
Stepping: 3
CPU MHz: 3500.000
CPU max MHz: 3900.0000
CPU min MHz: 800.0000
BogoMIPS: 6996.45
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm xsaveopt dtherm ida arat pln pts
OS version (
uname -a
)Linux mlkdnn 4.4.0-104-generic benchdnn and rdpmc #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Compiler version (
gcc --version
)ubuntu@mlkdnn:~/mkl-dnn/tests$ clang -v
clang version 5.0.0-3 (tags/RELEASE_500/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.2.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.2.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
MKLROOT value (
echo MKLROOT=$MKLROOT
)echo MKLROOT=$MKLROOT
MKLROOT=
CMake version (
cmake --version
)cmake version 3.9.1
CMake output log
Steps to reproduce
Please check that the issue is reproducible with the latest revision on
master. Include the steps to reproduce the issue. A short C/C++ program
or modified unit tests demonstrating the issue will greatly help
with the investigation.
[ 47%] Linking CXX executable test_convolution_backward_data_f32
/usr/bin/ld: gtest/libmkldnn_gtest.a(gtest-all.cc.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
tests/gtests/CMakeFiles/test_convolution_backward_data_f32.dir/build.make:125: recipe for target 'tests/gtests/test_convolution_backward_data_f32' failed
make[2]: *** [tests/gtests/test_convolution_backward_data_f32] Error 1
CMakeFiles/Makefile2:496: recipe for target 'tests/gtests/CMakeFiles/test_convolution_backward_data_f32.dir/all' failed
make[1]: *** [tests/gtests/CMakeFiles/test_convolution_backward_data_f32.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Actual behavior
Describe the behavior you see.
Expected behavior
Describe the behavior you expect.
The text was updated successfully, but these errors were encountered: