Boolector/boolector

How to install pyboolector for pypy

see01995 opened this issue · 2 comments

hi

i try to install pyboolector for pypy, but failed:

~/work/PyBoolector-3.2.3.20230913.1$ pypy setup.py install
/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/config/setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
warnings.warn(msg, warning_class)
/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'licenses'
warnings.warn(msg)
running install
/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
writing PyBoolector.egg-info/PKG-INFO
writing dependency_links to PyBoolector.egg-info/dependency_links.txt
writing top-level names to PyBoolector.egg-info/top_level.txt
listing git files failed - pretending there aren't any
reading manifest file 'PyBoolector.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'PyBoolector.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
Traceback (most recent call last):
File "/mnt/c/Users/yang.chen/Desktop/work/PyBoolector-3.2.3.20230913.1/setup.py", line 67, in
setup(
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/init.py", line 87, in setup
return distutils.core.setup(**attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/install.py", line 74, in run
self.do_egg_install()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/install.py", line 123, in do_egg_install
self.run_command('bdist_egg')
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/bdist_egg.py", line 165, in run
cmd = self.call_command('install_lib', warn_dir=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/bdist_egg.py", line 151, in call_command
self.run_command(cmdname)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/install_lib.py", line 11, in run
self.build()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/command/install_lib.py", line 112, in build
self.run_command('build_ext')
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 466, in build_extensions
self._build_extensions_serial()
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 492, in _build_extensions_serial
self.build_extension(ext)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
_build_ext.build_extension(self, ext)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
new_ext = cythonize(
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 1010, in cythonize
module_list, module_metadata = create_extension_list(
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 859, in create_extension_list
kwds = deps.distutils_info(file, aliases, base).values
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 707, in distutils_info
return (self.transitive_merge(filename, self.distutils_info0, DistutilsInfo.merge)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 716, in transitive_merge
return self.transitive_merge_helper(
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 722, in transitive_merge_helper
deps = extract(node)
^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 687, in distutils_info0
cimports, externs, incdirs = self.cimports_externs_incdirs(filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Utils.py", line 129, in wrapper
res = cache[args] = f(self, *args)
^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 574, in cimports_externs_incdirs
for include in self.included_files(filename):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Utils.py", line 129, in wrapper
res = cache[args] = f(self, *args)
^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Build/Dependencies.py", line 556, in included_files
include_path = self.context.find_include_file(include, source_file_path=filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Compiler/Main.py", line 299, in find_include_file
error(pos, "'%s' not found" % filename)
File "/home/see01995/pypy/pypy3.10-v7.3.12-linux64/lib/pypy3.10/site-packages/Cython/Compiler/Errors.py", line 178, in error
raise InternalError(message)
Cython.Compiler.Errors.InternalError: Internal compiler error: 'pyboolector_enums.pxd' not found

i modified .build.sh, and gen whl:

#!/usr/bin/env bash
set -e -o pipefail

mkdir -p ./build
cd ./build

echo "Hello from PyPi build.sh"

BUILD_DIR=`pwd`
N_CORES=`nproc`

#test -n "$PYTHON_VERSIONS" || { echo PYTHON_VERSIONS must be set.; exit 1; }

echo "copy start"

cp -r ../boolector .

echo "copy end"

# Setup dependencies
cd boolector
#/bin/sh ./contrib/setup-btor2tools.sh
#/bin/sh ./contrib/setup-cadical.sh
#/bin/sh ./contrib/setup-lingeling.sh
./contrib/setup-btor2tools.sh
./contrib/setup-cadical.sh
./contrib/setup-lingeling.sh

#********************************************************************
#* boolector
#********************************************************************
cd ${BUILD_DIR}

cd boolector

#./configure.sh --python --shared --prefix output
./configure.sh --python --shared --prefix /usr/local
cd build

echo "make"

make -j${N_CORES}

make install

#********************************************************************
#* pyboolector
#********************************************************************

cd ${BUILD_DIR}
rm -rf pyboolector

export CC=gcc
export CXX=g++

# Specify path to CmakeLists.txt so setup.py can extract the version
export CMAKELISTS_TXT=${BUILD_DIR}/boolector/CMakeLists.txt

cp -r ${BUILD_DIR}/boolector/pypi pyboolector

# Prepare the artifact directory.
rm -rf ${BUILD_DIR}/boolector/result
mkdir -p ${BUILD_DIR}/boolector/result

# Grab the main license file
cp ${BUILD_DIR}/boolector/COPYING pyboolector/LICENSE

cd pyboolector

#for py in $PYTHON_VERSIONS; do
#  python=$(ls /opt/python/${py}-*/bin/python)
#  echo "Python: ${python}"
#  ${python} -m pip install cython wheel
#  cd ${BUILD_DIR}/pyboolector
#  rm -rf src
#  cp -r ${BUILD_DIR}/boolector/src/api/python src
#  sed -i -e 's/override//g' \
#     -e 's/noexcept/_GLIBCXX_USE_NOEXCEPT/g' \
#     -e 's/\(BoolectorException (const.*\)/\1\n    virtual ~BoolectorException() _GLIBCXX_USE_NOEXCEPT {}/' \
#       src/pyboolector_abort.cpp
#  mkdir -p src/utils
#  cp ${BUILD_DIR}/boolector/src/*.h src
#  cp ${BUILD_DIR}/boolector/src/utils/*.h src/utils
#  $python ./src/mkenums.py ./src/btortypes.h ./src/pyboolector_enums.pxd
#  $python setup.py sdist bdist_wheel
#done

echo "python"

  python=/usr/bin/pypy
  echo "Python: ${python}"
  ${python} -m pip install cython wheel
  cd ${BUILD_DIR}/pyboolector
  rm -rf src
  cp -r ${BUILD_DIR}/boolector/src/api/python src
  sed -i -e 's/override//g' \
     -e 's/noexcept/_GLIBCXX_USE_NOEXCEPT/g' \
     -e 's/\(BoolectorException (const.*\)/\1\n    virtual ~BoolectorException() _GLIBCXX_USE_NOEXCEPT {}/' \
       src/pyboolector_abort.cpp
  mkdir -p src/utils
  cp ${BUILD_DIR}/boolector/src/*.h src
  cp ${BUILD_DIR}/boolector/src/utils/*.h src/utils
  $python ./src/mkenums.py ./src/btortypes.h ./src/pyboolector_enums.pxd
  $python setup.py sdist bdist_wheel

# Copy the source distribution into the artifact directory.
cp dist/*.tar.gz ${BUILD_DIR}/boolector/result

# Repair wheels and place them into the artifact directory.
for whl in dist/*.whl; do
  auditwheel repair --plat manylinux_2_24_x86_64 --wheel-dir ${BUILD_DIR}/boolector/result/dist $whl
done

Boolector is not actively maintained and developed anymore. It was succeeded by Bitwuzla and the repository is now archived.