Skip to content
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

make fails in master branch #87

Closed
luotao1 opened this issue Jul 6, 2017 · 5 comments
Closed

make fails in master branch #87

luotao1 opened this issue Jul 6, 2017 · 5 comments
Labels
enhancement A feature or an optimization request

Comments

@luotao1
Copy link

luotao1 commented Jul 6, 2017

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!

@rsdubtso
Copy link

rsdubtso commented Jul 6, 2017

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

@luotao1
Copy link
Author

luotao1 commented Jul 6, 2017

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

@rsdubtso
Copy link

rsdubtso commented Jul 6, 2017

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

@luotao1
Copy link
Author

luotao1 commented Jul 6, 2017

Thx very much!

@rsdubtso rsdubtso added the enhancement A feature or an optimization request label Jul 6, 2017
@tprimak
Copy link
Contributor

tprimak commented Jul 7, 2017

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

@tprimak tprimak closed this as completed Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature or an optimization request
Projects
None yet
Development

No branches or pull requests

3 participants