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

oneflow import failed when built with libudev-dev #10615

Open
xuchunmei000 opened this issue Jan 16, 2025 · 1 comment
Open

oneflow import failed when built with libudev-dev #10615

xuchunmei000 opened this issue Jan 16, 2025 · 1 comment
Labels
bug community events from community

Comments

@xuchunmei000
Copy link

xuchunmei000 commented Jan 16, 2025

Summary

Build oneflow from source in ubuntu22.04 with libudev-dev installed, after install oneflow, exec python3 -m oneflow will get this error:

# python3 -m oneflow
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/local/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/workspace/oneflow/python/oneflow/__init__.py", line 26, in <module>
    import oneflow._oneflow_internal
ImportError: /workspace/oneflow/build/liboneflow.so: undefined symbol: udev_unref

A short description about the bug/issue

Code to reproduce bug

cd /workspace && git clone https://github.com/Oneflow-Inc/oneflow.git && cd oneflow && git checkout v1.0.0
apt update && apt install -y libopenblas-dev nasm g++ gcc python3-pip cmake autoconf libtool
mkdir build
cd build
cmake .. -C ../cmake/caches/cn/cuda.cmake
make -j$(nproc)

System Information

  • What is your OneFlow installation (pip, source, dockerhub):
  • OS: Ubuntu22.04
  • OneFlow version (run python3 -m oneflow --doctor):1.0.0
  • Python version:3.10.12
  • CUDA driver version:11.8
  • GPU models:
  • Other info:

hwloc is built as libhwloc.a, and liboneflow.so linked to libhwloc.a. When libudev-dev is installed, according to hwloc.pc:

# cat hwloc.pc
prefix=/workspace/oneflow/build/third_party_install/hwloc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: hwloc
Description: Hardware locality detection and management library
Version: 2.4.1rc3-git
Requires.private: pciaccess
Cflags: -I${includedir}
Libs: -L${libdir} -lhwloc
Libs.private: -lm  -ludev -L/workspace/oneflow/build/third_party_install/pciaccess/lib -lpciaccess    -lpthread

link to hwloc should add Libs.private, which include udev. while in cmake/third_party.cmake, hwloc is linked without libraries in Libs.private.

@xuchunmei000 xuchunmei000 added bug community events from community labels Jan 16, 2025
@xuchunmei000
Copy link
Author

if udev for hwloc is not needed,maybe can be fixed by:

diff --git a/cmake/third_party/hwloc.cmake b/cmake/third_party/hwloc.cmake
index 87ba638bd..07b29226d 100644
--- a/cmake/third_party/hwloc.cmake
+++ b/cmake/third_party/hwloc.cmake
@@ -90,7 +90,7 @@ if(BUILD_HWLOC)
       CONFIGURE_COMMAND ${HWLOC_SOURCE_DIR}/src/hwloc/autogen.sh
       COMMAND ${HWLOC_SOURCE_DIR}/src/hwloc/configure --prefix=${HWLOC_INSTALL}
               PKG_CONFIG_PATH=${PCIACCESS_INSTALL}/lib/pkgconfig --disable-libxml2 --enable-static
-              --enable-shared=no
+              --enable-shared=no --disable-libudev
       BUILD_COMMAND make -j${PROC_NUM} CFLAGS=${HWLOC_CFLAGS}
       BUILD_BYPRODUCTS ${ONEFLOW_HWLOC_STATIC_LIBRARIES}
       INSTALL_COMMAND make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug community events from community
Projects
None yet
Development

No branches or pull requests

1 participant