libais icon indicating copy to clipboard operation
libais copied to clipboard

Build errors with Python

Open donzash opened this issue 8 years ago • 9 comments

Can anyone help guide me on building this one? I am seeing the following issue when building using python; "running build running build_py creating build creating build\lib.win-amd64-2.7 creating build\lib.win-amd64-2.7\ais copying ais\io.py -> build\lib.win-amd64-2.7\ais copying ais\lut.py -> build\lib.win-amd64-2.7\ais copying ais\nmea.py -> build\lib.win-amd64-2.7\ais copying ais\nmea_messages.py -> build\lib.win-amd64-2.7\ais copying ais\nmea_queue.py -> build\lib.win-amd64-2.7\ais copying ais\stats.py -> build\lib.win-amd64-2.7\ais copying ais\tag_block.py -> build\lib.win-amd64-2.7\ais copying ais\uscg.py -> build\lib.win-amd64-2.7\ais copying ais\util.py -> build\lib.win-amd64-2.7\ais copying ais\vdm.py -> build\lib.win-amd64-2.7\ais copying ais__init__.py -> build\lib.win-amd64-2.7\ais creating build\lib.win-amd64-2.7\ais\compatibility copying ais\compatibility\gpsd.py -> build\lib.win-amd64-2.7\ais\compatibility copying ais\compatibility__init__.py -> build\lib.win-amd64-2.7\ais\compatibility creating build\lib.win-amd64-2.7\ais\stream copying ais\stream\checksum.py -> build\lib.win-amd64-2.7\ais\stream copying ais\stream__init__.py -> build\lib.win-amd64-2.7\ais\stream creating build\lib.win-amd64-2.7\test creating build\lib.win-amd64-2.7\test\compatibility copying test\compatibility\gpsd_test.py -> build\lib.win-amd64-2.7\test\compatibility copying test\compatibility__init__.py -> build\lib.win-amd64-2.7\test\compatibility running build_ext building '_ais' extension creating build\temp.win-amd64-2.7 creating build\temp.win-amd64-2.7\Release creating build\temp.win-amd64-2.7\Release\src creating build\temp.win-amd64-2.7\Release\src\libais C:\Users\donzash\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Anaconda2\include -IC:\Anaconda2\PC /Tpsrc\libais\ais_py.cpp /Fobuild\temp.win-amd64-2.7\Release\src\libais\ais_py.obj ais_py.cpp C:\Users\donzash\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc c:\users\donzash\desktop\libais-master\src\libais\ais.h(607) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(607) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(607) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(607) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(608) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(608) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(608) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(608) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(691) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(691) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(691) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(691) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(711) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(711) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(711) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(711) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(969) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(969) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(969) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(969) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1199) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1199) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1199) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(1199) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1202) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1202) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1202) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(1202) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1601) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1601) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1601) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(1601) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1602) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1602) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1602) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(1602) : error C2238: unexpected token(s) preceding ';' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1627) : error C2039: 'array' : is not a member of 'std' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1627) : error C2143: syntax error : missing ';' before '<' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1627) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\donzash\desktop\libais-master\src\libais\ais.h(1627) : error C2238: unexpected token(s) preceding ';' src\libais\ais_py.cpp(198) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(261) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(309) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(425) : error C2039: 'capabilities' : is not a member of 'libais::Ais6_1_4' c:\users\donzash\desktop\libais-master\src\libais\ais.h(604) : see declaration of 'libais::Ais6_1_4' src\libais\ais_py.cpp(428) : error C2039: 'cap_reserved' : is not a member of 'libais::Ais6_1_4' c:\users\donzash\desktop\libais-master\src\libais\ais.h(604) : see declaration of 'libais::Ais6_1_4' src\libais\ais_py.cpp(546) : error C2039: 'spare2' : is not a member of 'libais::Ais6_1_18' c:\users\donzash\desktop\libais-master\src\libais\ais.h(681) : see declaration of 'libais::Ais6_1_18' src\libais\ais_py.cpp(547) : error C2039: 'spare2' : is not a member of 'libais::Ais6_1_18' c:\users\donzash\desktop\libais-master\src\libais\ais.h(681) : see declaration of 'libais::Ais6_1_18' src\libais\ais_py.cpp(576) : error C2039: 'services' : is not a member of 'libais::Ais6_1_20' c:\users\donzash\desktop\libais-master\src\libais\ais.h(699) : see declaration of 'libais::Ais6_1_20' src\libais\ais_py.cpp(689) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(766) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(780) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(993) : error C2039: 'spare2' : is not a member of 'libais::Ais8_1_19' c:\users\donzash\desktop\libais-master\src\libais\ais.h(959) : see declaration of 'libais::Ais8_1_19' src\libais\ais_py.cpp(994) : error C2039: 'spare2' : is not a member of 'libais::Ais8_1_19' c:\users\donzash\desktop\libais-master\src\libais\ais.h(959) : see declaration of 'libais::Ais8_1_19' src\libais\ais_py.cpp(995) : error C2039: 'spare2' : is not a member of 'libais::Ais8_1_19' c:\users\donzash\desktop\libais-master\src\libais\ais.h(959) : see declaration of 'libais::Ais8_1_19' src\libais\ais_py.cpp(996) : error C2039: 'spare2' : is not a member of 'libais::Ais8_1_19' c:\users\donzash\desktop\libais-master\src\libais\ais.h(959) : see declaration of 'libais::Ais8_1_19' src\libais\ais_py.cpp(1264) : error C2039: 'next_ports' : is not a member of 'libais::Ais8_1_24' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1194) : see declaration of 'libais::Ais8_1_24' src\libais\ais_py.cpp(1264) : error C2228: left of '.c_str' must have class/struct/union src\libais\ais_py.cpp(1265) : error C2039: 'next_ports' : is not a member of 'libais::Ais8_1_24' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1194) : see declaration of 'libais::Ais8_1_24' src\libais\ais_py.cpp(1265) : error C2228: left of '.c_str' must have class/struct/union src\libais\ais_py.cpp(1271) : error C2039: 'solas_status' : is not a member of 'libais::Ais8_1_24' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1194) : see declaration of 'libais::Ais8_1_24' src\libais\ais_py.cpp(1722) : error C2039: 'gauge_ids' : is not a member of 'libais::Ais8_200_24' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1598) : see declaration of 'libais::Ais8_200_24' src\libais\ais_py.cpp(1727) : error C2039: 'levels' : is not a member of 'libais::Ais8_200_24' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1598) : see declaration of 'libais::Ais8_200_24' src\libais\ais_py.cpp(1776) : error C2039: 'spare2' : is not a member of 'libais::Ais8_200_55' c:\users\donzash\desktop\libais-master\src\libais\ais.h(1622) : see declaration of 'libais::Ais8_200_55' src\libais\ais_py.cpp(1922) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2038) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2052) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2109) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2131) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2157) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2177) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2209) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2238) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2258) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2323) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2363) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2429) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2462) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2498) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2527) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2553) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2567) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2591) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2635) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2663) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2757) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2762) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2762) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2762) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2794) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2799) : error C2065: 'nullptr' : undeclared identifier src\libais\ais_py.cpp(2799) : error C2065: 'nullptr' : undeclared identifier error: command 'C:\Users\donzash\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2

donzash avatar May 02 '16 18:05 donzash

Same problem. Could you solve it?

singhketan avatar Sep 10 '16 09:09 singhketan

did you get this solved?If not then please add a comment.

h-krishna avatar Dec 23 '16 08:12 h-krishna

nullptr is C++11. You need to tell it to build as C++11. I don't work on windows. Can anyone contribute a patch?

schwehr avatar Dec 05 '17 23:12 schwehr

I also don't work with msvc, but the python docs say you have to match the version CPython was compiled which - for CPython 2.7 that's visual studio 9 i.e. 2008, and the one apparently used above. This may be sufficiently far back to be uninteresting to support, as newer CPython versions apparently use much more up to date vs versions.

(I personally use libais as a python library very successfully on Windows under msys2/mingw64, compiling with gcc.)

https://wiki.python.org/moin/WindowsCompilers

jamtho avatar Dec 05 '17 23:12 jamtho

Well, MSVC from 2008 is a no go with C++11. If someone wants that, they will have to fork the project. Based on https://msdn.microsoft.com/en-us/library/hh567368.aspx?f=255&MSPPError=-2147217396 libais might be okay for a while with Visual Studio 2013, but Visual Studio 2015 is possibly the minimum. I'm likely to start using C++14 soonish, so 2013 will be out.

schwehr avatar Dec 06 '17 01:12 schwehr

Would it be possible to keep ais.h compatible with C++11? I'm working on (open source) larger in-process AIS processing pipelines as C++ libraries for other languages inc R and Python, and it helps a bit!

Edit: actually it's really not that massive a deal. Ignore me, I'll cope :)

jamtho avatar Dec 06 '17 02:12 jamtho

Ok. I was going to ask what was would make C++14 difficult. It does currently cause me some trouble as my primary workstation is Ubuntu 14.04 for a bit longer... And I haven't gotten myself into regular use of docker on my machines where it would be easy to stick to something like debian-testing or ubuntu 17.10.

schwehr avatar Dec 06 '17 05:12 schwehr

My main problem in the past was Rcpp, which proved sufficiently difficult to use with C++14 that I just back ported a load of my AIS related code to 11. This may have change now, haven't checked.

Really I'd like to isolate libais completely behind a C interface, and my current best approach is linking in a python, calling ais_py.cpp functions manually from my C++ code, and converting the PyDict objects to json-c objects for passing to library clients. But it's massively overcomplicated when the need is just to get the libais C++ objects into a uniform object schema for external consumption.

(Most people just care about messages 1, 2, 3, 5, 18, 19, 24, 27, so I've sidestepped this problem in the past by hand mapping from those C++ classes, effectively doing my own partial ais_py.cpp via some dynamic casts. But it's looking like people want a 'full' solution now. Users are UK public sector scientists who can't afford infrastructure, fwiw.)

jamtho avatar Dec 06 '17 11:12 jamtho

Below linked worked for me. https://stackoverflow.com/questions/24433436/compile-error-nullptr-undeclared-identifier

writetoneeraj avatar Jan 29 '19 05:01 writetoneeraj