This is a rare case, when install pynng in Windows 10 and VS 2019, need to oversome several issues. Here just a quick fix.
first, using following command to install
git clone https://github.com/codypiersall/pynng
cd pynng
pip3 install -e .
before pip3 install -e .
, change the setup.py
.
in build_libs
function:
def build_libs():
"""
Builds the nng and mbedtls libs.
"""
# The user has to have the correct Visual Studio version on the path or the
# build will fail, possibly in exciting and mysterious ways.
major, minor, *_ = sys.version_info
flags = ['-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true']
is_64bit = sys.maxsize > 2**32
if WINDOWS:
if is_64bit:
flags += ['-G', 'Visual Studio 16 2019']
flags += ['-A', 'x64']
else:
flags += ['-A', 'win32']
# if shutil.which('ninja'):
# # the ninja build generator is a million times faster.
# flags += ['-G', 'Ninja']
build_mbedtls(flags)
build_nng(flags)
to force make in VS2019 and x64.
in build_mbedtls
function:
def build_mbedtls(cmake_args):
"""
Clone mbedtls and build it with cmake.
"""
do = check_call
if not os.path.exists('mbedtls'):
do('git clone --recursive {}'.format(MBEDTLS_REPO), shell=True)
# for local hacking, just copy a directory (network connection is slow)
# do('cp -r ../mbedtls mbedtls', shell=True)
# do('git checkout {}'.format(MBEDTLS_REV), shell=True, cwd='mbedtls')
cwd = 'mbedtls/build'
os.mkdir(cwd)
cmake_cmd = ['cmake'] + cmake_args
cmake_cmd += [
'-DENABLE_PROGRAMS=OFF',
'-DCMAKE_BUILD_TYPE=Release',
'-DCMAKE_INSTALL_PREFIX=../prefix',
'..'
]
print('building mbedtls with:', cmake_cmd)
do(cmake_cmd, cwd=cwd)
do(
'cmake --build . --config Release --target install',
shell=True,
cwd=cwd,
)
here is the mbedtle version problem (i guess).
then run pip3 install -e .
, suppose there some error pop up, telling the encoding warnning as error (when you are not in English version VS).
now change CMakeKists.txt
under mbedtls
folder.
option(MBEDTLS_FATAL_WARNINGS "Compiler warnings treated as errors" OFF)
< turn this option to OFF.
delete mbedtls\build
folder then try again, should work like a charm.
Comments
comments powered by Disqus