pjkundert / ezpwd-reed-solomon

Reed-Solomon & BCH encoding and decoding, in C++, Javascript & Python

Home Page:https://hardconsulting.com/products/13-reed-solomon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a Python package available?

caronoff opened this issue · comments

Swig wrapper compiling not working. I tried on Win10 and Mac 10.15. Has anyone succeeded in getting this to work in Python?

I think I might have fixed the issue w/ Swig 4.0.2 compatibility. Give it a try? Some pull requests for better testing would be appreciated... :)

Thank you for the fast fix but I think my problem is specific.

I am using Python 3.8 and the python setup.py install succeed to launch SWIG but SWIG craps out! Maybe a bad C++ compiler or unable to read the rs_base file in certain lines/
Error:
error:
C:\Users\caronoff\PycharmProjects\bchTest\ezpwd-reed-solomon\c++\ezpwd\rs_base(451): warning C4067: unexpected tokens following preprocessor directive - expected a newline
C:\Users\caronoff\PycharmProjects\bchTest\ezpwd-reed-solomon\c++\ezpwd\rs_base(454): fatal error C1021: invalid preprocessor command 'warning'
command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe' failed with exit status 2

OK, I've removed the #warning pre-processor directive that Visual Studio seems to be having trouble with...

OK, I've removed the #warning pre-processor directive that Visual Studio seems to be having trouble with...

Thank you for being so responsive! I am getting warmer now. Still failing at setup with this error now:

C:\Users\caronoff\PycharmProjects\bchTest\ezpwd-reed-solomon\c++\ezpwd\rs_base(451): warning C4067: unexpected tokens following preprocessor directive - expected a newline
C:\Users\caronoff\PycharmProjects\bchTest\ezpwd-reed-solomon\c++\ezpwd\rs_base(1322): warning C4067: unexpected tokens following preprocessor directive - expected a newline
../../c++\ezpwd/ezcod(620): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
../../c++\ezpwd/ezcod(568): note: while compiling class template member function 'int ezpwd::ezcod<3,9>::decode(const std::string &)'
ezcod/ezcod_wrap.cpp(7645): note: see reference to function template instantiation 'int ezpwd::ezcod<3,9>::decode(const std::string &)' being compiled
ezcod/ezcod_wrap.cpp(3320): note: see reference to class template instantiation 'ezpwd::ezcod<3,9>' being compiled
../../c++\ezpwd/ezcod(644): error C2065: 'M_PI': undeclared identifier
../../c++\ezpwd/ezcod(645): error C2065: 'M_PI': undeclared identifier
../../c++\ezpwd/ezcod(645): error C2065: 'M_PI': undeclared identifier
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe' failed with exit status 2

So apparently, file ezcod needs a line in header

#define _USE_MATH_DEFINES

as per this https://stackoverflow.com/questions/26065359/m-pi-flagged-as-undeclared-identifier

However, Windows Visual studio still craps out when compiling. I am not sure where the log file is to attach but theres a long dump of warnings. Then, there is the followoing errors below. I guess the platform for Windows VC tools has changed alot and broken the compatibility of the compiler since 2 years ago.

++\ezpwd/serialize(368): error C2181: illegal else without matching if
../../c++\ezpwd/serialize(368): error C2146: syntax error: missing ')' before identifier 'and'
../../c++\ezpwd/serialize(368): error C2065: 'and': undeclared identifier
../../c++\ezpwd/serialize(368): error C2146: syntax error: missing ';' before identifier 'pad'
../../c++\ezpwd/serialize(368): error C2059: syntax error: ')'
../../c++\ezpwd/serialize(369): error C2677: binary '*': no global operator found which takes type 'I' (or there is no acceptable conversion)
with
[
I=std::_String_iterator<std::_String_val<std::_Simple_types>>
]
../../c++\ezpwd/serialize(370): error C2181: illegal else without matching if
../../c++\ezpwd/rs(147): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
../../c++\ezpwd/ezcod(540): note: see reference to function template instantiation 'int ezpwd::strength<3>(int,const std::vector<int,std::allocator> &,const std::vector<int,std::allocator> &)' being compiled
../../c++\ezpwd/ezcod(496): note: while compiling class template member function 'int ezpwd::ezcod<3,9>::validate(std::string &) const'
../../c++\ezpwd/ezcod(573): note: see reference to function template instantiation 'int ezpwd::ezcod<3,9>::validate(std::string &) const' being compiled
../../c++\ezpwd/rs(148): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
../../c++\ezpwd/serialize(454): warning C4244: 'argument': conversion from '__int64' to '_Ty', possible loss of data
with
[
_Ty=int
]
../../c++\ezpwd/serialize(496): note: see reference to function template instantiation 'I ezpwd::serialize::base_generic<32,TABLES>::decode<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>>(I,I,std::vector<int,std::allocator> *,std::vector<char,std::allocator> *,ezpwd::serialize::ws_use_t,ezpwd::serialize::pd_use_t)' being com
piled
with
[
I=std::_String_iterator<std::_String_val<std::_Simple_types>>,
TABLES=ezpwd::serialize::ezpwd<32>,
_Elem=char
]
../../c++\ezpwd/serialize(495): note: see reference to function template instantiation 'I ezpwd::serialize::base_generic<32,TABLES>::decode<std::_String_iterator<std::_String_val<std::_Simple_types<_Elem>>>>(I,I,std::vector<int,std::allocator> *,std::vector<char,std::allocator> *,ezpwd::serialize::ws_use_t,ezpwd::serialize::pd_use_t)' being com
piled
with
[
I=std::_String_iterator<std::_String_val<std::_Simple_types>>,
TABLES=ezpwd::serialize::ezpwd<32>,
_Elem=char
]
../../c++\ezpwd/serialize(494): note: while compiling class template member function 'std::string &ezpwd::serialize::base_generic<32,TABLES>::decode(std::string &,std::vector<int,std::allocator> *,std::vector<char,std::allocator> *,ezpwd::serialize::ws_use_t,ezpwd::serialize::pd_use_t)'
with
[
TABLES=ezpwd::serialize::ezpwd<32>
]
../../c++\ezpwd/ezcod(455): note: see reference to function template instantiation 'std::string &ezpwd::serialize::base_generic<32,TABLES>::decode(std::string &,std::vector<int,std::allocator> *,std::vector<char,std::allocator> *,ezpwd::serialize::ws_use_t,ezpwd::serialize::pd_use_t)' being compiled
with
[
TABLES=ezpwd::serialize::ezpwd<32>
]
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe'