hicawow924
hicawow924

Reputation: 31

How to create PJSUA2 Python 3 package?

I have a very hard time creating a PJSUA2 package for Python 3.x on Windows 10. I downloaded the source code from the pjsip site and I'm able to compile the C++ code without problems, but I cannot build the PJSUA2 module for Python. The docs mention using SWIG, but I had no luck so far.

When I run make from ./pjsip-apps/src/swig I get the following:

Makefile:1: ../../../build.mak: No such file or directory
make: *** No rule to make target '../../../build.mak'.  Stop.

When I run make from ./pjsip-apps/src/swig/python I get:

sed: -e expression #1, char 8: unterminated `s' command
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1250'>
OSError: [Errno 22] Invalid argument
python3 setup.py build --compiler=mingw32
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
helper.mak:2: /build/common.mak: No such file or directory
make[1]: *** No rule to make target '/build/common.mak'.  Stop.
running build
running build_py
running build_ext
building '_pjsua2' extension
x86_64-w64-mingw32-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -O2 -pipe -fno-ident -I/c/mingw-builds/ucrt64-seh-posix/x86_64-1220-posix-seh-ucrt-rt_v10-rev2/mingw64/opt/include -I/c/mingw-builds/ucrt64-seh-posix/prerequisites/x86_64-zlib-static/include -I/c/mingw-builds/ucrt64-seh-posix/prerequisites/x86_64-w64-mingw32-static/include -D__USE_MINGW_ANSI_STDIO=1 -IC:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/opt/include/python3.9 -c pjsua2_wrap.cpp -o build/temp.mingw_x86_64_ucrt-3.9/pjsua2_wrap.o
pjsua2_wrap.cpp:3841:10: fatal error: pjsua2.hpp: No such file or directory
 3841 | #include "pjsua2.hpp"
      |          ^~~~~~~~~~~~
compilation terminated.
error: command 'C:\\ProgramData\\chocolatey\\bin/x86_64-w64-mingw32-gcc.exe' failed with exit code 1
make: *** [Makefile:37: _pjsua2.so] Error 1

I don't understand what could be wrong, as I literally only downloaded the source code and did not touch anything.

Upvotes: 2

Views: 998

Answers (2)

Ahmed Farouk
Ahmed Farouk

Reputation: 29

As per documentation you have two options

  1. The doc just put a link to download SWIG :) here and do not mention any steps
  2. MSYS2 -- RECOMMENDED the steps are very easy see here

Upvotes: 0

Heifen
Heifen

Reputation: 26

When I was trying to install the PJSIP/PJSUA2 package firstly on windows it ran into constant build errors which would never go away, instead try to switch to a Linux based operating system. When that's not possible try to use the Windows Linux subsystem\WSL2 which gave me great success.

(Note that the use of audio is not possible inside WSL2, kind of defeating the purpose depending on what your project is about)

I'm hoping to have helped you out!

Upvotes: 0

Related Questions