Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

cmake 过程发生错误 #840

Closed
iclementine opened this issue Jul 4, 2022 · 8 comments · Fixed by #890
Closed

cmake 过程发生错误 #840

iclementine opened this issue Jul 4, 2022 · 8 comments · Fixed by #890

Comments

@iclementine
Copy link

iclementine commented Jul 4, 2022

按照 README 中 Installation 所说的,使用了 Docker 镜像 paddlepaddle/paddle:latest-dev-cuda11.2-cudnn8-gcc82,执行 cmake 的过程中发生错误。

执行的命令是在 CINN/build 目录下 cmake .. -DPY_VERSION=3.9(我使用的 Python 虚拟环境对应的 python 版本是 3.9)

报错信息如下
图片

按照报错的 CMakeLists.txt 查看,link 的是 python 动态库。

find_package(PythonInterp ${PY_VERSION} REQUIRED)
find_package(PythonLibs ${PY_VERSION} REQUIRED)


cc_test(test_cost_model SRCS cost_model_test.cc cost_model.cc DEPS pybind gtest_main)

target_link_libraries(test_cost_model ${PYTHON_LIBRARIES})

这个 so 是能被找到的。但是仍然出现上述的报错。
请问这改如何解决呢?

详细的 CMake 输出文件如下:

CMakeOutput.log
CMakeError.log

@iclementine
Copy link
Author

错误看起来和 pthread 找不到有关。
图片

但是系统上 libpthread-stubs0-dev 是安装了的。

@iclementine
Copy link
Author

Same Issue as #754

@iclementine
Copy link
Author

最新的发现是,link 到 python library 失败的问题。而不是 pthread 的问题。

find_package(PythonInterp ${PY_VERSION} REQUIRED)
find_package(PythonLibs ${PY_VERSION} REQUIRED)


cc_test(test_cost_model SRCS cost_model_test.cc cost_model.cc DEPS pybind gtest_main)

target_link_libraries(test_cost_model ${PYTHON_LIBRARIES})

去掉这一行 target_link_libraries(test_cost_model ${PYTHON_LIBRARIES}) 可以在 -DWITH_TESTONG=OFF 的情况下生成 build system 以及编译成功。但是为何无法成功 link python library 原因未知。

@gsq7474741
Copy link

用官方docker也会报错 @gglin001

@zhhsplendid
Copy link
Member

我们这边正在查看中,对于您快速解决,可否先注释掉 cinn/auto_schedule/cost_model/CMakeLists.txt 中的

cc_test(test_cost_model SRCS cost_model_test.cc cost_model.cc DEPS pybind gtest_main)

target_link_libraries(test_cost_model ${PYTHON_LIBRARIES})

@zhhsplendid
Copy link
Member

我们当前直接在镜像中使用Python3.9没有问题,没有复现相关现象。从issue描述上看,现在应该是和虚环境有关,我们将进一步搭建虚环境,跟踪查看一下,这个是什么问题。

@BiynXu
Copy link
Collaborator

BiynXu commented Aug 18, 2022

这个问题是由于在-DWITH_TESTONG=OFF 的情况下,test_cost_model没有生成,因此链接出现问题。
请参考#890

CtfGo pushed a commit that referenced this issue Aug 18, 2022
@BiynXu
Copy link
Collaborator

BiynXu commented Aug 18, 2022

找不到pthread的报错并不是pthread本身的问题,在解决了上面的链接问题后就不会出现这个log了。#890

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants