[Lldb-commits] [PATCH] D67890: [lldb] [cmake] Fix installing Python modules on systems using /usr/lib

2019-09-29 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

I'm a tad late, but I just wanted to confirm for everyone that this works. 
Thanks everybody!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67890



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-17 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy reopened this revision.
ZeGentzy added a comment.
This revision is now accepted and ready to land.

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 having 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?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-18 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

That's odd

> Can you share your full compile command and environment?

I'm using this PKGBUILD: 
https://github.com/ZeGentzy/aur-buildscripts/blob/master/llvm-git-gentz/PKGBUILD#L376

The commands being run are these:

  export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
  export CFLAGS="$CFLAGS -m32"
  export CXXFLAGS="$CXXFLAGS -m32"
  export LDFLAGS="$LDFLAGS -m32"
  
  cmake /build/llvm-git-gentz/src/llvm-project32/llvm -G Ninja \
  -D CMAKE_BUILD_TYPE="Release" \
  -D LLVM_DEFAULT_TARGET_TRIPLE="i686-pc-linux-gnu" \
  -D LLVM_LIBDIR_SUFFIX=32 \
  -D LLVM_TARGET_ARCH:STRING=i686 \
  -D LLVM_CONFIG="/usr/bin/llvm-config32" \
  -D COMPILER_RT_BUILD_LIBFUZZER=OFF \
  -D LLVM_ENABLE_BINDINGS=OFF \
  -D PYTHON_EXECUTABLE=/usr/bin/python-32 \
  -D CMAKE_CXX_COMPILER="/usr/bin/clang++" \
  -D CMAKE_C_COMPILER="/usr/bin/clang" \
  -D LLVM_USE_LINKER="/usr/bin/ld.lld" \
  -D CMAKE_RANLIB="/usr/bin/llvm-ranlib" \
  -D CMAKE_AR="/usr/bin/llvm-ar" \
  -D LLVM_ENABLE_LTO=OFF \
  -D LLVM_BUILD_LLVM_DYLIB=ON \
  -D LLVM_LINK_LLVM_DYLIB=ON \
  -D LLVM_ENABLE_PROJECTS="clang;compiler-rt;lld;lldb;clang-tools-extra" \
  -D LLVM_APPEND_VC_REV=ON \
  -D LLVM_HOST_TRIPLE="x86_64-pc-linux-gnu" \
  -D LLVM_ENABLE_RTTI=ON \
  -D LLVM_ENABLE_FFI=ON \
  -D FFI_INCLUDE_DIR="/usr/lib32/libffi-3.2.1/include" \
  -D LLVM_BUILD_TESTS=ON \
  -D LLVM_VERSION_SUFFIX= \
  -D CMAKE_POLICY_DEFAULT_CMP0075=NEW \
  -D LLVM_OPTIMIZED_TABLEGEN=ON \
  -D LLVM_CCACHE_BUILD=ON \
  -D CMAKE_POLICY_DEFAULT_CMP0075=NEW \
  -D CMAKE_C_FLAGS="-march=native -O3 -pipe -ffast-math -funroll-loops 
-fstack-protector-strong -fno-plt -mno-xop -mno-fma4 -mno-tbm -m32" \
  -D CMAKE_CXX_FLAGS="-march=native -O3 -pipe -ffast-math -funroll-loops 
-fstack-protector-strong -fno-plt -mno-xop -mno-fma4 -mno-tbm -m32" \
  -D LLVM_TARGETS_TO_BUILD="AMDGPU;X86" \
  -D LLVM_BINUTILS_INCDIR=/usr/include \
  -D LLVM_EXTERNAL_LIT="/usr/bin/lit" \
  -D LLVM_BUILD_DOCS=OFF \
  -D LLVM_INCLUDE_DOCS=OFF \
  -D LLVM_ENABLE_SPHINX=OFF \
  -D LLVM_ENABLE_DOXYGEN=OFF \
  -D LLVM_INSTALL_UTILS=ON \
  -D LLVM_PARALLEL_LINK_JOBS=1 \
  -D CMAKE_INSTALL_PREFIX="/opt/llvm32"
  ninja -j4 all
  DESTDIR=/build/llvm-git-gentz/pkg/lib32-llvm-git-gentz ninja -j4 install

A lot... err, most... of the things I cargo culted from other sources.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-19 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

In D67583#1674912 , @hhb wrote:

> I don't have the right environment to try your command. But I didn't see 
> anything obviously problematic.
>
> Can you try the following:
>
>   cd /src/llvm-project/lldb/scripts/Python
>
>
> Then run the following python program:
>
>   import sys
>   sys.path.append('/src/llvm-project/lldb/scripts/Python')
>   import finishSwigPythonLLDB
>   vDictArgs = {"--srcRoot": "/src/llvm-project/lldb",
>"--targetDir": "/src/out/./lib32",
>"--cfgBldDir": "/src/out/tools/lldb/scripts",
>"--prefix": "/src/out",
>"--cmakeBuildConfiguration": ".",
>"--lldbLibDir": "lib32",
>"-m": None,
>   }
>   finishSwigPythonLLDB.get_framework_python_dir(vDictArgs)
>
>
> For me the output is:
>
>   (True, '/src/out/./lib/python2.7/site-packages/lldb', '')
>
>
> Notice that the lib part don't have 32 suffix, even we specified that in 
> parameters.
>
> I kind of feeling that we should change this script to simply return 
> targetDir. There's no good reason to use get_python_lib() and depend on 
> python's implementation. But I don't know enough to make this decision...


Unfortunately, the script does not seam to be functional:

  $ python a.py 
  Traceback (most recent call last):
File "a.py", line 3, in 
  import finishSwigPythonLLDB
File 
"/home/gentz/Documents/aur/gfx/backups/second/llvm-git-gentz/llvm-git-gentz/src/llvm-project32/lldb/scripts/Python/finishSwigPythonLLDB.py",
 line 47, in 
  import utilsOsType  # Determine the OS type this script is running on
  ModuleNotFoundError: No module named 'utilsOsType'
  
  $ python2 a.py  
  Traceback (most recent call last):
File "a.py", line 3, in 
  import finishSwigPythonLLDB
File 
"/home/gentz/Documents/aur/gfx/backups/second/llvm-git-gentz/llvm-git-gentz/src/llvm-project32/lldb/scripts/Python/finishSwigPythonLLDB.py",
 line 47, in 
  import utilsOsType  # Determine the OS type this script is running on
  ImportError: No module named utilsOsType
  
  $ pwd 
  
/home/gentz/Documents/aur/gfx/backups/second/llvm-git-gentz/llvm-git-gentz/src/llvm-project32/lldb/scripts/Python


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-19 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

In D67583#1675415 , @hhb wrote:

> Oh sorry my mistake. The current directory should be 
> llvm-project/lldb/scripts. I.e.
>
>   cd /src/llvm-project/lldb/scripts
>


Maybe I'm doing something wrong, but that does not work either.

  $ python a.py   
  Traceback (most recent call last):
File "a.py", line 3, in 
  import finishSwigPythonLLDB
  ModuleNotFoundError: No module named 'finishSwigPythonLLDB'
  
  $ python2 a.py
  Traceback (most recent call last):
File "a.py", line 3, in 
  import finishSwigPythonLLDB
  ImportError: No module named finishSwigPythonLLDB
  
  $ pwd 
  
/home/gentz/Documents/aur/gfx/backups/second/llvm-git-gentz/llvm-git-gentz/src/llvm-project32/lldb/scripts
  
  $ cat a.py
  import sys
  sys.path.append('/src/llvm-project/lldb/scripts/Python')
  import finishSwigPythonLLDB
  vDictArgs = {"--srcRoot": "/src/llvm-project/lldb",
   "--targetDir": "/src/out/./lib32",
   "--cfgBldDir": "/src/out/tools/lldb/scripts",
   "--prefix": "/src/out",
   "--cmakeBuildConfiguration": ".",
   "--lldbLibDir": "lib32",
   "-m": None,
  }
  finishSwigPythonLLDB.get_framework_python_dir(vDictArgs)




Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-19 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

In D67583#1675714 , @hhb wrote:

> My theory now is that your python has a different implementation of 
> get_python_lib(). After all we should not guess what python would do. I'm 
> making a change.
>  If you still interested in testing that, you can fix the path in a.py...


Oh, derp, I completely missed that. I get `(True, 
'/src/out/./lib/python3.7/site-packages/lldb', '')` for python and `(True, 
'/src/out/./lib/python2.7/site-packages/lldb', '')` for python2.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67583: Fix swig python package path

2019-09-20 Thread Hal Gentz via Phabricator via lldb-commits
ZeGentzy added a comment.

In D67583#1676531 , @labath wrote:

> I could be off mark here, but I do recall some people trying to get this code 
> to work in environments where python and lldb(llvm) are configured with 
> different libdirs (so LLVM_LIBDIR_SUFFIX in llvm, and `configure --prefix=X` 
> in python). Is that the case you're running into here?


I think not. I'm cross compiling llvm, getting it to build a 32-bit llvm for my 
64-bit host, so I can install it along side my 64-bit llvm and use it with my 
32-bit mesa.

I'm building two pythons, python2s, llvms and mesas, one for 32-bits and one 
for 64-bits.

My 32-bit python2, the one in use by llvm for it's 32-bit builds, was 
configured with the following options:

  --prefix=/usr 
  --enable-shared
  --with-threads
  --enable-optimizations
  --with-lto
  --enable-ipv6
  --with-system-expat
  --with-dbmliborder=gdbm:ndbm
  --with-system-ffi
  --without-ensurepip
  --libdir=/usr/lib32
  --libexecdir=/usr/lib32
  --includedir="/usr/lib32/python${_pybasever}/include"
  --exec_prefix="/usr/lib32/python${_pybasever}/"
  --bindir=/usr/bin
  --sbindir=/usr/bin
  --with-suffix='-32'

Python:

  --prefix=/usr 
  --enable-shared
  --with-threads
  --with-computed-gotos
  --enable-optimizations
  --with-lto
  --enable-ipv6
  --with-system-expat
  --with-dbmliborder=gdbm:ndbm
  --with-system-ffi
  --with-system-libmpdec
  --enable-loadable-sqlite-extensions
  --without-ensurepip
  --libdir=/usr/lib32
  --libexecdir=/usr/lib32
  --includedir=/usr/lib32/python${_pybasever}m/include
  --exec_prefix=/usr/lib32/python${_pybasever}/
  --bindir=/usr/bin
  --sbindir=/usr/bin
  --with-suffix='-32'

This is done so my 32-bit python stuff does not conflict with the 64-bit python 
stuff.

---

Actually, thinking about it, I should have probably run your scripts with the 
32-bit pythons, as those are what llvm uses:

  [root@GENTZ-PC-NEW2 scripts]# python a.py
  (True, '/src/out/./lib/python3.7/site-packages/lldb', '')
  [root@GENTZ-PC-NEW2 scripts]# python-32 a.py
  (True, '/src/out/./lib32/python3.7/site-packages/lldb', '')
  [root@GENTZ-PC-NEW2 scripts]# python2-32 a.py
  (True, '/src/out/./lib32/python2.7/site-packages/lldb', '')
  [root@GENTZ-PC-NEW2 scripts]# python2 a.py
  (True, '/src/out/./lib/python2.7/site-packages/lldb', '')
  [root@GENTZ-PC-NEW2 scripts]# file /usr/lib[0-9]*/python*/ 
  /usr/lib32/python2.7/:  directory
  /usr/lib32/python3.7/:  directory
  /usr/lib32/python3.7m/: directory
  /usr/lib64/python2.7/:  directory
  /usr/lib64/python3.7/:  directory


Repository:
  rL LLVM

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

https://reviews.llvm.org/D67583



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits