py-toxcore-c icon indicating copy to clipboard operation
py-toxcore-c copied to clipboard

Failed to install package

Open nrcsuc opened this issue 3 years ago • 4 comments

clang: error: no such file or directory: 'pytox/av.c'
clang: error: no input files
error: command '/usr/bin/clang' failed with exit code 1

nrcsuc avatar Dec 24 '22 22:12 nrcsuc

In ubuntu 20.4LTS:

  1. create directory pytox and clone from this directory: git clone --recurse-submodules https://github.com/Toktok/c-toxcore
    git clone https://github.com/TokTok/py-toxcore-c.git
  2. create script build-toxcore.sh with +x mode:
#!/bin/bash

# dependencies for toxcore: libsodium, libm, libpthread, librt
# gits:
# git clone --recurse-submodules https://github.com/Toktok/c-toxcore
# git clone https://github.com/TokTok/py-toxcore-c.git


cd c-toxcore

rm -rf _build > /dev/null 2>&1

cmake -B _build -D BOOTSTRAP_DAEMON=OFF -D BUILD_TOXAV=OFF -D DHT_BOOTSTRAP=OFF -D ENABLE_SHARED=ON

cd _build

make


cd ../../

cp -r c-toxcore/toxav/* py-toxcore-c/pytox/toxav/
cp -r c-toxcore/toxcore/* py-toxcore-c/pytox/toxcore/
cp -r c-toxcore/toxencryptsave/* py-toxcore-c/pytox/toxencryptsave/


cp c-toxcore/_build/lib*.* py-toxcore-c/pytox/


# edit library-path in py-toxcore-c/setup.py: libraries = ["py-toxcore-c/pytox/toxcore",]

# pip install py-toxcore-c/

  1. edit cmake-options as you wish and execute build-toxcore.sh

  2. if the build is successful, then edit the correct path to the library in the file py-toxcore-c/setup.py:

from distutils.core import Extension
from distutils.core import setup

libraries = [
    "py-toxcore-c/pytox/toxcore",  # This !
]
cflags = [
    "-funsigned-char",
]

setup(
    name="py-toxcore-c",
    version="0.2.19",
    description="Python binding for Tox the skype replacement",
    author="Iphigenia Df",
    author_email="[email protected]",
    url="http://github.com/TokTok/py-toxcore-c",
    license="GPL",
    py_modules=["pytox.common"],
    ext_modules=[
        #Extension(
        #    "pytox.toxav.toxav",
        #    ["pytox/toxav/toxav.c"],
        #    extra_compile_args=cflags,
        #    libraries=libraries,
        #),
        Extension(
            "pytox.toxcore.tox",
            ["pytox/toxcore/tox.c"],
            extra_compile_args=cflags,
            libraries=libraries,
        ),
        #Extension(
        #    "pytox.toxencryptsave.toxencryptsave",
        #    ["pytox/toxencryptsave/toxencryptsave.c"],
        #    extra_compile_args=cflags,
        #    libraries=libraries,
        #),
    ],
)
  1. Enjoy: pip install py-toxcore-c/

longnetwork avatar Feb 29 '24 13:02 longnetwork

You need to run cython (for now). See the Dockerfile for an example. I'll add cythonize to the setup.py soon.

iphydf avatar Feb 29 '24 13:02 iphydf

iphydf, Please regenerate the api for the master branch toxcore Something is missing: python3 -c 'import pytox.toxcore.tox as core; print(core.Tox_Ptr.__init__.__doc__)' produce undefined symbol send_group_invite_packet:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /home/mint/_freeLance/8Work_kivy/src/.venv/lib/python3.8/site-packages/pytox/toxcore/tox.cpython-38-x86_64-linux-gnu.so: undefined symbol: send_group_invite_packet

longnetwork avatar Feb 29 '24 16:02 longnetwork

I'll look into it next week.

iphydf avatar Mar 01 '24 09:03 iphydf