[PATCH] D67583: Fix swig python package path

Haibo Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 14:14:50 PDT 2019


hhb added a comment.

In D67583#1674430 <https://reviews.llvm.org/D67583#1674430>, @hhb wrote:

> In D67583#1673356 <https://reviews.llvm.org/D67583#1673356>, @ZeGentzy wrote:
>
> > Hello folks,
> >
> > These changes break running `ninja install` when building with `-D LLVM_LIBDIR_SUFFIX=32`.
> >
> >   [...]
> >   -- Up-to-date: /build/llvm-git-gentz/pkg/lib32-llvm-git-gentz/opt/llvm32/include
> >   -- Up-to-date: /build/llvm-git-gentz/pkg/lib32-llvm-git-gentz/opt/llvm32/include/lldb
> >   -- Up-to-date: /build/llvm-git-gentz/pkg/lib32-llvm-git-gentz/opt/llvm32/include/lldb/Host
> >   -- Installing: /build/llvm-git-gentz/pkg/lib32-llvm-git-gentz/opt/llvm32/include/lldb/Host/Config.h
> >   CMake Error at tools/lldb/scripts/cmake_install.cmake:41 (file):
> >     file INSTALL cannot find
> >     "/build/llvm-git-gentz/src/_build32_final/./lib/python3.7".
> >   Call Stack (most recent call first):
> >     tools/lldb/cmake_install.cmake:50 (include)
> >     tools/cmake_install.cmake:50 (include)
> >     cmake_install.cmake:68 (include)
> >  
> >  
> >   FAILED: CMakeFiles/install.util 
> >   cd /build/llvm-git-gentz/src/_build32_final && /usr/bin/cmake -P cmake_install.cmake
> >   ninja: build stopped: subcommand failed.
> >
> >
> > After some investigation, I found that there is no `/build/llvm-git-gentz/src/_build32_final/./lib/python3.7` but there is an `/build/llvm-git-gentz/src/_build32_final/./lib32/python3.7`.
> >
> > I've temporary solved this problem by applying the following patch:
> >
> >   diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt
> >   index 9de96ef5565..7d346deee7f 100644
> >   --- a/lldb/scripts/CMakeLists.txt
> >   +++ b/lldb/scripts/CMakeLists.txt
> >   @@ -47,7 +47,7 @@ if(NOT LLDB_BUILD_FRAMEWORK)
> >      if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
> >        set(swig_python_subdir Lib/site-packages)
> >      else()
> >   -    set(swig_python_subdir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
> >   +    set(swig_python_subdir lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
> >      endif()
> >   
> >      set(SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${swig_python_subdir})
> >
> >
> > I believe solving this problem correctly would also involve updating https://github.com/python/cpython/blob/3.8/Lib/distutils/sysconfig.py#L150 to account for `${LLVM_LIBDIR_SUFFIX}`, however, I've never used the script before and am unfamiliar with it's purpose.
> >
> > @hhb Could you please revisit this revision so that it doesn't break builds with a modified `LLVM_LIBDIR_SUFFIX` and revert this revision until then?
>
>
> Hmm that's interesting... In my case the issue is opposite: LLVM_LIBDIR_SUFFIX=64 but the file is in lib/ .
>
> I don't think we can change python to fix this. But I'm curious how the suffix is applied. Let me try LLVM_LIBDIR_SUFFIX=32...


Can you share your full compile command and environment? I tried to build on Ubuntu (Python 2.7.16) with the latest llvm source code:

  $ cmake /src/llvm-project/llvm -DLLVM_LIBDIR_SUFFIX=32 "-DLLVM_ENABLE_PROJECTS=clang;lldb"  -DCMAKE_INSTALL_PREFIX=/src/llvm-install -DLLDB_DISABLE_LIBEDIT=ON -GNinja
  $ ninja
  ...
  $ find -name site-packages
  ./lib/python2.7/site-packages

Or with python 3.6.8:

  $ cmake /src/llvm-project/llvm -DLLVM_LIBDIR_SUFFIX=32 "-DLLVM_ENABLE_PROJECTS=clang;lldb"  -DCMAKE_INSTALL_PREFIX=/src/llvm-install -DLLDB_DISABLE_LIBEDIT=ON -GNinja -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6 -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so
  $ ninja
  ...
  $ find -name site-packages
  ./lib/python3.6/site-packages
  $ ls lib32/python*
  zsh: no matches found: lib32/python*


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67583/new/

https://reviews.llvm.org/D67583





More information about the llvm-commits mailing list