oneDNN icon indicating copy to clipboard operation
oneDNN copied to clipboard

make fails in master branch

Open luotao1 opened this issue 9 years ago • 5 comments

When I make from current master branch, it fails as follows:

[100%] Building CXX object tests/benchdnn/CMakeFiles/benchdnn.dir/ip/ref_ip.cpp.o
[100%] Building CXX object tests/benchdnn/CMakeFiles/benchdnn.dir/mkldnn_common.cpp.o
Linking CXX executable benchdnn
CMakeFiles/benchdnn.dir/common.cpp.o: In function `benchdnn_timer_t::reset()':
common.cpp:(.text+0x583): undefined reference to `clock_gettime'
CMakeFiles/benchdnn.dir/common.cpp.o: In function `benchdnn_timer_t::start()':
common.cpp:(.text+0x605): undefined reference to `clock_gettime'
CMakeFiles/benchdnn.dir/common.cpp.o: In function `benchdnn_timer_t::stop()':
common.cpp:(.text+0x689): undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/benchdnn/benchdnn] Error 1
make[1]: *** [tests/benchdnn/CMakeFiles/benchdnn.dir/all] Error 2
make: *** [all] Error 2

But if I switch to v0.9 tag, I can make successfully. Looking forward to your reply!

luotao1 avatar Jul 06 '17 09:07 luotao1

Which Linux distribution are you building mkldnn on? Does adding -lrt to the CMAKE_EXE_LINKER_FLAGS fix the issue?

rsdubtso avatar Jul 06 '17 09:07 rsdubtso

Thx for your quick reply. After adding -lrt in https://github.com/01org/mkl-dnn/blob/master/CMakeLists.txt#L45 :

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -lrt")

And I can make successfully. Is this adding correct, so I can pull a request? The linux distribution is (using lsb_release command):

LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.3 (Final)
Release:        6.3
Codename:       Final

luotao1 avatar Jul 06 '17 10:07 luotao1

Thanks for a quick response. On the second thought, I think that -lrt should go to the benchdnn's CMakeLists.txt rather than the top-level one:

diff --git a/tests/benchdnn/CMakeLists.txt b/tests/benchdnn/CMakeLists.txt
index d41fcb59..2637e6c1 100644
--- a/tests/benchdnn/CMakeLists.txt
+++ b/tests/benchdnn/CMakeLists.txt
@@ -33,6 +33,7 @@ include_directories(
 add_executable(benchdnn ${SOURCES})
 set_property(TARGET benchdnn PROPERTY CXX_STANDARD 11)
 target_link_libraries(benchdnn ${LIB_NAME})
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lrt")
 # add_test(benchdnn benchdnn)

 file(COPY inputs DESTINATION .)

I'll push this change to our internal repo and it should appear on github soon.

Update: and, of course this line must be protected by an OS check

rsdubtso avatar Jul 06 '17 10:07 rsdubtso

Thx very much!

luotao1 avatar Jul 06 '17 10:07 luotao1

Fix is available on github now (commit de7321599fe459cf650433e2ce5122a0b39f80c7). Closing this issue.

tprimak avatar Jul 07 '17 22:07 tprimak